function index() { $ajax = isset($_POST['ajax']); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $this->form_validation->set_rules('subject', 'Subject', 'trim|required|xss_clean'); $this->form_validation->set_rules('category[]', 'Category', 'required|exact_length[1]|integer'); $this->form_validation->set_rules('content', 'Content', 'trim|required'); if ($this->form_validation->run()) { $subject = $this->form_validation->set_value('subject'); $content = $this->form_validation->set_value('content'); $category = $this->form_validation->set_value('category[]'); $comment = array('user_id' => $this->session->userdata('user_id'), 'category' => (int) $category[0], 'subject' => $subject, 'content' => _process_post($content), 'original_content' => $content); $comment['thread_id'] = $this->thread_dal->new_thread($comment); $this->user_dal->update_thread_count($comment['user_id']); $this->thread_dal->new_comment($comment); $url = '/thread/' . $comment['thread_id'] . '/' . url_title($subject, 'dash', TRUE); if ($ajax) { return send_json($this->output, 201, array('ok' => true, 'url' => $url)); } else { redirect($url); } } else { if ($_SERVER['REQUEST_METHOD'] === 'POST' && $ajax) { return send_json($this->output, 400, array('error' => true, 'reason' => validation_errors())); } } $this->load->view('shared/header'); $this->load->view('newthread'); $this->load->view('shared/footer'); }
public function update() { $auth_user = User::getAuthenticated(); if (!$auth_user) { throw new PermissionException(); } send_json(array('hasUpdates' => Follow::getUpdates($auth_user) ? true : false)); }
function load($thread_id) { $segments = $this->uri->segment_array(); while ($seg = next($segments)) { if ($seg == 'p') { $page = (int) next($segments); } } if (!isset($page)) { $page = 0; } $thread = $this->thread_model->get_thread($thread_id, $this->meta, $page); $uri = '/thread/' . $thread_id . '/' . url_title($thread->information->subject, 'dash', TRUE); // if they roll in with something unexpected // or the thread doesnt exist // send them home if ($thread == null) { redirect('/'); } // if the thread is closed then we're not accepting any new data if (!$thread->information->closed || $thread->information->author_acquaintance_type == 2) { // we're going to go ahead and do the form processing for the reply now // if they're submitting data, we're going to refresh the page anyways // so theres no point in running the query below the form validation $this->form_validation->set_rules('content', 'Content', 'required'); $this->form_validation->set_rules('ajax', 'ajax'); // if a comment was submitted if ($this->form_validation->run()) { $content = $this->form_validation->set_value('content'); $ajax = $this->form_validation->set_value('ajax'); $comment_id = $this->thread_model->new_comment((object) array('thread_id' => $thread_id, 'user_id' => $this->meta['user_id'], 'content' => _process_post($content), 'original_content' => $content)); $this->user_dal->update_comment_count($this->meta['user_id']); $this->thread_model->update_comment_count($thread_id); $shown = $this->meta['comments_shown']; $last_page = ceil(($thread->information->comment_count + 1) / $this->meta['comments_shown']) * $this->meta['comments_shown'] - $this->meta['comments_shown']; // Append some unique junk to make sure the page path is different, // otherwise wont redirecr $redirection = $uri . '/p/' . $last_page . '/' . '#bottom'; if ($ajax || $this->is_request_json()) { return send_json($this->output, 201, array('ok' => true, 'url' => $redirection, 'comment_id' => $comment_id, 'thread_id' => $thread_id)); } else { redirect($redirection); } } } $this->pagination->initialize(array('num_links' => 3, 'base_url' => $uri .= '/p/', 'total_rows' => $thread->information->comment_count, 'uri_segment' => 5, 'per_page' => $this->meta['comments_shown'], 'full_tag_open' => '<div class="main-pagination">', 'full_tag_close' => '</div>', 'cur_tag_open' => '<div class="selected-page">', 'cur_tag_close' => '</div>', 'num_tag_open' => '', 'num_tag_close' => '')); $uri .= isset($uri_assoc['p']) ? (int) $uri_assoc['p'] : 0; $thread->pagination = (object) array('links' => $this->pagination->create_links(), 'lower_limit' => $page + 1, 'upper_limit' => min(array($page + $this->meta['comments_shown'], $thread->information->comment_count)), 'category' => '<a href="/f/' . strtolower($thread->information->category) . '">' . $thread->information->category . '</a>', 'thread' => '<a href="/thread/' . $thread_id . '/' . url_title($thread->information->subject, 'dash', TRUE) . '">' . $thread->information->subject . '</a>'); $thread->pagination_object = $this->pagination; $thread->pagination_row_offset = (int) $page; $thread->information->page = $page; $this->load->helper('content_render'); $this->load->view('shared/header', array('page_title' => $thread->information->subject)); $this->load->view('thread', $thread); $this->load->view('shared/footer'); }
/** * Simple validation after filter_input() function, to keep code clean. * * @param string $name * @param string $email * @param string $message */ function validate($name, $email, $message) { $errors = array(); if (null == $name) { $errors['name'] = 'Enter your name'; } if (null == $email || false === $email) { $errors['email'] = 'Enter correct email'; } if (null == $message) { $errors['message'] = 'Enter your message'; } // If errors - die if (!empty($errors)) { send_json(false, $errors); } }
function edit() { $thread_id = $this->input->post('thread_id'); if ($thread_id) { $rules = 'required|min_length[1]|max_length[64]|xss_clean'; $this->form_validation->set_rules('title', 'Title', $rules); if ($this->form_validation->run() && $this->sauth->is_logged_in()) { $title = $this->input->post('title'); $user_id = $this->session->userdata('user_id'); $this->load->model('thread_dal'); echo $this->thread_dal->update_subject($thread_id, $title, $user_id) ? "saved" : "error"; } else { echo "error"; } } else { $rules = 'required|min_length[1]|max_length[36]|xss_clean'; $this->form_validation->set_rules('title', 'Title', $rules); if ($this->form_validation->run() && $this->sauth->is_logged_in()) { $title = $this->input->post('title'); $auth_id = $this->session->userdata('user_id'); $sql = "INSERT INTO titles(title_text, author_id) VALUES(?, ?)"; $this->db->query($sql, array($title, $auth_id)); if ($this->is_request_json()) { return send_json($this->output, 200, array('ok' => true, 'title' => $title)); } else { echo "saved"; } } else { if ($this->is_request_json()) { return send_json($this->output, 412, array('error' => 'error')); } else { echo "error"; } } } }
function send_error($type, $info = null) { $error = get_error($type); if ($info != null) { $error['message'] = $error['message'] . ' -' . $info; } send_json($error); }
function redirect($destination_url, $message) { global $forum_db, $forum_config, $lang_common, $forum_user, $base_url, $forum_loader; define('FORUM_PAGE', 'redirect'); ($hook = get_hook('fn_redirect_start')) ? eval($hook) : null; // Prefix with base_url (unless it's there already) if (strpos($destination_url, 'http://') !== 0 && strpos($destination_url, 'https://') !== 0 && strpos($destination_url, '/') !== 0) { $destination_url = $base_url . '/' . $destination_url; } // Do a little spring cleaning $destination_url = preg_replace('/([\\r\\n])|(%0[ad])|(;[\\s]*data[\\s]*:)/i', '', $destination_url); if (defined('FORUM_REQUEST_AJAX')) { $json_data = array('code' => -2, 'message' => $message, 'destination_url' => $destination_url); ($hook = get_hook('fn_redirect_pre_send_json')) ? eval($hook) : null; send_json($json_data); } // If the delay is 0 seconds, we might as well skip the redirect all together if ($forum_config['o_redirect_delay'] == '0') { header('Location: ' . str_replace('&', '&', $destination_url)); } // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // For HTTP/1.0 compability // Send the Content-type header in case the web server is setup to send something else header('Content-type: text/html; charset=utf-8'); // Load the redirect template if (file_exists(FORUM_ROOT . 'style/' . $forum_user['style'] . '/redirect.tpl')) { $tpl_path = FORUM_ROOT . 'style/' . $forum_user['style'] . '/redirect.tpl'; } else { $tpl_path = FORUM_ROOT . 'include/template/redirect.tpl'; } ($hook = get_hook('fn_redirect_pre_template_loaded')) ? eval($hook) : null; $tpl_redir = forum_trim(file_get_contents($tpl_path)); ($hook = get_hook('fn_redirect_template_loaded')) ? eval($hook) : null; // START SUBST - <!-- forum_local --> $tpl_redir = str_replace('<!-- forum_local -->', 'xml:lang="' . $lang_common['lang_identifier'] . '" lang="' . $lang_common['lang_identifier'] . '" dir="' . $lang_common['lang_direction'] . '"', $tpl_redir); // END SUBST - <!-- forum_local --> // START SUBST - <!-- forum_head --> $forum_head['refresh'] = '<meta http-equiv="refresh" content="' . $forum_config['o_redirect_delay'] . ';URL=' . str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url) . '" />'; $forum_head['title'] = '<title>' . $lang_common['Redirecting'] . $lang_common['Title separator'] . forum_htmlencode($forum_config['o_board_title']) . '</title>'; ob_start(); // Include stylesheets require FORUM_ROOT . 'style/' . $forum_user['style'] . '/' . $forum_user['style'] . '.php'; $head_temp = forum_trim(ob_get_contents()); $num_temp = 0; foreach (explode("\n", $head_temp) as $style_temp) { $forum_head['style' . $num_temp++] = $style_temp; } ob_end_clean(); ($hook = get_hook('fn_redirect_head')) ? eval($hook) : null; $tmp_head = implode("\n", $forum_head) . $forum_loader->render_css(); $tpl_redir = str_replace('<!-- forum_head -->', $tmp_head, $tpl_redir); unset($forum_head, $tmp_head); // END SUBST - <!-- forum_head --> // START SUBST - <!-- forum_redir_main --> ob_start(); ?> <div id="brd-main" class="main basic"> <div class="main-head"> <h1 class="hn"><span><?php echo $message . $lang_common['Redirecting']; ?> </span></h1> </div> <div class="main-content main-message"> <p><?php printf($lang_common['Forwarding info'], $forum_config['o_redirect_delay'], intval($forum_config['o_redirect_delay']) == 1 ? $lang_common['second'] : $lang_common['seconds']); ?> <span> <a href="<?php echo $destination_url; ?> "><?php echo $lang_common['Click redirect']; ?> </a></span></p> </div> </div> <?php $tpl_temp = "\t" . forum_trim(ob_get_contents()); $tpl_redir = str_replace('<!-- forum_redir_main -->', $tpl_temp, $tpl_redir); ob_end_clean(); // END SUBST - <!-- forum_redir_main --> // START SUBST - <!-- forum_debug --> if (defined('FORUM_SHOW_QUERIES')) { $tpl_redir = str_replace('<!-- forum_debug -->', get_saved_queries(), $tpl_redir); } // End the transaction $forum_db->end_transaction(); // END SUBST - <!-- forum_debug --> // START SUBST - <!-- forum_include "*" --> while (preg_match('#<!-- ?forum_include "([^/\\\\]*?)" ?-->#', $tpl_redir, $cur_include)) { if (!file_exists(FORUM_ROOT . 'include/user/' . $cur_include[1])) { error('Unable to process user include <!-- forum_include "' . forum_htmlencode($cur_include[1]) . '" --> from template redirect.tpl.<br />There is no such file in folder /include/user/.'); } ob_start(); include FORUM_ROOT . 'include/user/' . $cur_include[1]; $tpl_temp = ob_get_contents(); $tpl_redir = str_replace($cur_include[0], $tpl_temp, $tpl_redir); ob_end_clean(); } // END SUBST - <!-- forum_include "*" --> // Close the db connection (and free up any result data) $forum_db->close(); exit($tpl_redir); }
function me() { $user = null; if ($this->sauth->is_logged_in()) { $user_id = $this->session->userdata('user_id'); if (false !== $user_id) { $user = $this->user_dal->get_user_by_id($user_id); } } // show error if not logged in if (null === $user) { if ($this->is_request_json()) { $json = array('error' => 'You are not logged in, fella.'); return send_json($this->output, 401, $json); } else { return show_error('You are not logged in, fella.', 401); } } // send response for logged in user if ($this->is_request_json()) { $user_id = $this->session->userdata('user_id'); return send_json($this->output, 200, array('ok' => true, 'user_id' => (int) $user_id, 'username' => $this->session->userdata('username'), 'avatar_url' => avatar_url_for_logged_in_user(true), 'unread_message_count' => (int) $this->message_dal->unread_messages($user_id), 'online_buddies' => $this->get_online_buddies())); } else { return redirect_with_format('/user/' . $user->username); } }
// 数据库配置 require_once AROOT . 'config' . DS . 'app.php'; // 应用配置 require_once AROOT . 'lib' . DS . 'functions.php'; // 公用函数 if (is_devmode()) { ini_set('display_errors', true); error_reporting(E_ALL); } $force_build = !on_sae() && is_devmode() && c('buildeverytime'); load_route_file($force_build); } catch (PDOException $e) { $error = get_error('DATABASE'); $error['message'] = $error['message'] . '- ' . $e->getMessage(); send_json($error); } catch (\Lazyphp\Core\RestException $e) { $class_array = explode('\\', get_class($e)); $class = t(end($class_array)); $prefix = strtoupper(rremove($class, 'Exception')); $error = get_error($prefix); $error['message'] = $error['message'] . '- ' . $e->getMessage(); send_json($error); } catch (\Exception $e) { // alway send json format $class_array = explode('\\', get_class($e)); $class = t(end($class_array)); $prefix = strtoupper(rremove($class, 'Exception')); $error = get_error($prefix); $error['message'] = $error['message'] . '- ' . $e->getMessage(); send_json($error); }
function send($to = '') { $user_id = (int) $this->session->userdata('user_id'); $data = array('to' => str_replace('-', ' ', $to), 'message' => array('recipients' => str_replace('-', ' ', $to), 'subject' => '', 'content' => '')); $this->form_validation->set_message('required', "%s is required"); $this->form_validation->set_error_delimiters('<li>', '</li>'); $this->form_validation->set_rules('recipients', 'At least one recipient', 'trim|required|xss_clean'); $this->form_validation->set_rules('subject', 'Subject', 'trim|required|xss_clean'); $this->form_validation->set_rules('save_sent', 'Save sent'); $this->form_validation->set_rules('read_receipt', 'Read receipt'); $this->form_validation->set_rules('content', 'Content', 'trim|required|xss_clean'); // process the error checking on the form if ($this->form_validation->run()) { // array of user names $usernames = explode(',', $this->form_validation->set_value('recipients')); // TODO: remember why I limited it to 10. if (count($usernames) < 11) { // translated into user ids $user_ids = $this->user_dal->get_user_ids_from_array($this->session->userdata('user_id'), $usernames); // make sure the amount of users returned by the database // matches how many users we want to message if (count($usernames) === $user_ids->num_rows) { $recipient_ids = array(); $have_me_enemied = array(); // loop through the results to pull out user ids and see if anyone // has me enemied foreach ($user_ids->result() as $row) { $recipient_ids[] = (int) $row->id; if ($row->type == '2') { // this user has me as their enemy $have_me_enemied[] = $row->username; } } // if no one has me enemied if (count($have_me_enemied) === 0) { // put together the data for a new pm $message = array('sender' => (int) $this->session->userdata('user_id'), 'recipients' => $recipient_ids, 'subject' => $this->form_validation->set_value('subject'), 'content' => $this->form_validation->set_value('content')); // insert a new PM into the database $message['id'] = $this->message_dal->new_message($message); // loop through all recipients foreach ($message['recipients'] as $recipient) { // send the message and increment the message counter $receipt = $this->form_validation->set_value('read_receipt'); $this->message_dal->new_inbox($recipient, $message, $receipt); // if we want to save a message to our outbox if ($this->form_validation->set_value('save_sent') == 'save') { $this->message_dal->new_outbox($recipient, $message); } } // redirect them to the inbox if ($this->is_request_json()) { return send_json($this->output, 201, array('ok' => true, 'message_id' => $message['id'])); } else { redirect('/messages/inbox'); } } elseif (count($have_me_enemied) === 1 && count($recipient_ids) === 1) { $data['errors'] = "<li>That user has you enemied.</li>"; } else { $data['errors'] = "<li>The following users have you enemied:<ul>"; foreach ($have_me_enemied as $jerk) { $data['errors'] .= '<li>' . $jerk . '</li>'; } $data['errors'] .= '</ul></li>'; } } else { $data['errors'] = "<li>One or more of the recipients does not exist</li>"; } } else { $data['errors'] = validation_errors(); } } $this->load->view('shared/header'); $this->load->view('messages/send', $data); $this->load->view('shared/footer'); }
$g->add_resource_triple($doc_uri, 'http://purl.org/dc/terms/hasFormat', $alt_uri); $g->add_resource_triple($alt_uri, 'http://purl.org/dc/terms/isFormatOf', $doc_uri); $g->add_resource_triple($alt_uri, RDF_TYPE, 'http://purl.org/dc/dcmitype/Text'); $g->add_resource_triple($alt_uri, RDF_TYPE, FOAF_DOCUMENT); $g->add_resource_triple($alt_uri, FOAF_PRIMARYTOPIC, $resource_uri); $g->add_literal_triple($alt_uri, 'http://purl.org/dc/terms/format', $type_info['type']); $g->add_literal_triple($alt_uri, 'http://purl.org/dc/terms/title', 'Linked Data in ' . $type_info['label'] . ' format for ' . $g->get_label($resource_uri, TRUE)); } if ($doc_type == 'rdf') { send_rdfxml('200 OK', $g->to_rdfxml(), $content_location, $etag); } else { if ($doc_type == 'ttl') { send_turtle('200 OK', $g->to_turtle(), $content_location, $etag); } else { if ($doc_type == 'json') { send_json('200 OK', $g->to_json(), $content_location, $etag); } else { header("Content-Type: text/html; charset=UTF-8"); $title = $g->get_label($resource_uri, TRUE); $page_title = 'Linked Data for ' . $g->get_label($resource_uri, TRUE) . ' | ' . htmlspecialchars($this_host); $body .= '<p>A description of the resource identified by <a href="' . htmlspecialchars($resource_uri) . '">' . htmlspecialchars($resource_uri) . '</a></p>' . "\n"; $body .= ' <table class="linkeddata" summary="RDF description of the resource identified by ' . htmlspecialchars($resource_uri) . '. Property names are in the first column, values are in the second.">' . "\n"; $body .= ' <tbody>' . "\n"; $properties = $g->get_subject_properties($resource_uri, TRUE); $priority_properties = array_intersect($ordered_properties, $properties); $remaining_properties = array_diff($properties, $priority_properties); sort($remaining_properties); $properties = array_merge($priority_properties, $remaining_properties); $class = 'oddrow'; $index = $g->get_index(); foreach ($properties as $p) {
<?php require '_init.php'; $pid = $_REQUEST['pid']; $retailer = $_REQUEST['retailer']; $list_id = @$_REQUEST['list']; $remove = @$_REQUEST['remove'] == 'true'; if (!$list_id) { $list_id = 'def_' . current_user(); } $product_title = @$_REQUEST['p_title']; $product_url = @$_REQUEST['p_url']; $product_price = @$_REQUEST['p_price']; $product_image_url = @$_REQUEST['p_image']; $product = product_get($retailer, $pid); if (!$product && $product_url && $product_title && $product_image_url && $pid && $product_price) { $product_price = preg_replace('#[^0-9\\.]+#m', '', $product_price) * 1; $product = product_create($retailer, $pid, array('title' => $product_title, 'url' => $product_url, 'price' => $product_price, 'currency' => 'GBP', 'image_url' => $product_image_url)); } if ($product) { if (!$remove) { product_add_to_list($retailer, $pid, $list_id); } else { product_remove_from_list($retailer, $pid, $list_id); } $ret = array('ok' => true, 'product' => $product); send_json($ret); } else { $ret = array('ok' => false); send_json($ret, 500); }
function send_error($type, $info = null, $force_json = false) { if ($error = get_error($type)) { if ($info != null) { $error['message'] = $error['message'] . ' -' . $info; } } else { $error['message'] = $info; } //print_r( $error ); //send_json($error); if (is_json_request() || $force_json) { return send_json($error); } elseif (is_ajax_request()) { return render_ajax($error, 'info'); } else { return render_web($error, 'info'); } }
function put_content_file($name, $path, $content) { if (!empty($name) && !empty($path)) { if (file_exists($path . $name)) { if (is_writable($path . $name)) { try { file_put_contents($path . $name, $content); send_json(null, null); } catch (Exception $e) { send_json($e->getMessage(), null); throw new Exception($e->getMessage()); } } else { send_json($name . " can't be writable !!", null); throw new Exception($name . " can't be writable !!"); } } else { send_json("File " . $name . " not found !!", null); throw new Exception("File " . $name . " not found !!"); } } }
function forgot_password() { // set validation for the form $this->form_validation->set_rules('email', 'Email', 'required'); $this->form_validation->set_rules('key', 'Key', 'required'); // Sends the initial form if a plain GET request if (!$this->form_validation->run()) { $this->load->view('forgot_password/request', array('error' => '')); return; } // get the values $email = $this->form_validation->set_value('email'); $key = $this->form_validation->set_value('key'); // make sure the session key matches if (!$key === $this->session->userdata('session_id')) { return send_json($this->output, 412, array('error' => "invalid key")); } // find the user $user = $this->user_dal->get_user_by_email($email); // if user exists if (!$user) { $err = "Hmm, I couldn't find any accounts with that email address. Are you " . "sure that's the one you signed up with?"; return send_json($this->output, 412, array('error' => $err)); } $passwords = array('airplane', 'apple', 'booger', 'bug', 'burrito', 'catapult', 'dude', 'godzilla', 'hamburger', 'jabba', 'jacket', 'peach', 'red', 'silly', 'stupid', 'sunshine', 'taco', 'threadless', 'wookie', 'yes'); $password = $passwords[mt_rand(0, 19)] . mt_rand(10, 99) . $passwords[mt_rand(0, 19)]; $data = array('id' => $user->id, 'password' => $password); // reset it! $this->sauth->reset_password($data); $this->email->initialize(array('protocol' => 'smtp', 'smtp_host' => 'smtp.sendgrid.net', 'smtp_user' => $this->config->item('sendgrid_username'), 'smtp_pass' => $this->config->item('sendgrid_password'), 'smtp_port' => 587, 'crlf' => "\r\n", 'newline' => "\r\n")); $this->email->from($this->config->item('email_addy'), $this->config->item('email_signature')); $this->email->to($email); $this->email->subject('Your new password!'); $this->email->message($this->load->view('emails/forgot_password', $data, true)); $this->email->send(); return send_json($this->output, 200, array('ok' => true)); }
function send_error() { send_json(array('success' => false)); }
<?php require '_init.php'; $pid = $_REQUEST['pid']; $retailer = $_REQUEST['retailer']; $product_title = @$_REQUEST['p_title']; $product_url = @$_REQUEST['p_url']; $product_price = @$_REQUEST['p_price']; $product_image_url = @$_REQUEST['p_image']; $product = product_create($retailer, $pid, array('title' => $product_title, 'url' => $product_url, 'price' => $product_price, 'currency' => 'GBP', 'image_url' => $product_image_url)); $ret = array('ok' => true, 'product' => $product); send_json($ret);
<?php require '_init.php'; $user = user_get_current(); $user['friends'] = $user['exists'] ? user_friends() : array(); send_json($user);
function comment_save() { $comment_id = (int) $this->input->post('comment_id'); if ($comment_id === 0) { return; } $existing = $this->thread_dal->get_comment($comment_id)->row(); if ((int) $existing->user_id === $this->user_id) { $content = $this->input->post('content'); $processed = _process_post($content); if (strtotime($existing->created) > time() - 60 * 60 * 24 || $this->thread_dal->is_first_comment($existing->thread_id, $comment_id)) { $this->thread_dal->update_comment($comment_id, $content, $processed, $this->session->userdata('user_id')); if ($this->is_request_json()) { return send_json($this->output, 201, array('ok' => true, 'comment_id' => $comment_id, 'thread_id' => $existing->thread_id)); } else { echo $processed; } } else { echo "Permission Denied"; } } return; }
function send_error($type, $info = null, $force_json = false) { if ($type == null) { $error['message'] = $info; } elseif ($error = get_error($type)) { if ($info != null) { $error['message'] = $error['message'] . ' -' . $info; } } $error['created'] = date("Y-m-d H:i:s"); //print_r( $error ); //send_json($error); if (is_json_request() || $force_json || c('api_server_only')) { return send_json($error); } elseif (is_ajax_request()) { return render_ajax($error, 'info'); } else { return render_web($error, 'info'); } }