function dispJson() { print 'command is :' . $this->cmd . '<br>'; # ob_clean(); #clean up the output buffer $json_string = file_get_contents($this->cmd); $obj = format_json($json_string, 1, 1); var_dump($obj); }
$nct_id = ''; } if (isset($_GET['population'])) { $population = $_GET['population']; } else { $population = ''; } $Query = "SELECT * FROM results_baseline WHERE id = '" . $id . "'"; $Database = mysql_query($Query) or die('Query failed: ' . mysql_error()); if ($Database && mysql_num_rows($Database)) { $query = "UPDATE results_baseline SET"; if (isset($id)) { $query .= "id='" . mysql_real_escape_string($id) . "'"; } if (isset($rslts_baseline_id)) { $query .= "rslts_baseline_id='" . mysql_real_escape_string($rslts_baseline_id) . "'"; } if (isset($nct_id)) { $query .= "nct_id='" . mysql_real_escape_string($nct_id) . "'"; } if (isset($population)) { $query .= "population='" . mysql_real_escape_string($population) . "'"; } $query .= " WHERE id = '" . $id . "'"; mysql_query($query) or die('Query failed: ' . mysql_error()); $ReturnObject = array(); $ReturnObject['message'] = "Results_baseline Updated!"; } $app->response()->header("Content-Type", "application/json"); echo stripslashes(format_json(json_encode($ReturnObject))); });
$road_map_id = $Database['road_map_id']; $title = $Database['title']; $image = $Database['image']; $header = $Database['header']; $footer = $Database['footer']; $KeysQuery = "SELECT * from keys k"; $KeysQuery .= " WHERE road_map_id = " . $road_map_id; $KeysQuery .= " ORDER BY name ASC"; $KeysResults = mysql_query($KeysQuery) or die('Query failed: ' . mysql_error()); $road_map_id = prepareIdOut($road_map_id, $host); $F = array(); $F['road_map_id'] = $road_map_id; $F['title'] = $title; $F['image'] = $image; $F['header'] = $header; $F['footer'] = $footer; // Keys $F['keys'] = array(); while ($Keys = mysql_fetch_assoc($KeysResults)) { $name = $Keys['name']; $description = $Keys['description']; $K = array(); $K['name'] = $name; $K['description'] = $description; array_push($F['keys'], $K); } $ReturnObject = $F; } $app->response()->header("Content-Type", "application/json"); echo format_json(json_encode($ReturnObject)); });
# Script: group.php # # Takes a group id and displays the contained documents. # # HS 2011-06-15 ########################################################## require_once 'config.inc.php'; require_once 'functions.inc.php'; require_once 'Mendeley.php'; $mendeley = new Mendeley(API_KEY); if (isset($_GET['gid']) && $_GET['gid'] != "") { $gid = $_GET['gid']; is_mendeley_group_id($gid) or die('invalid gid'); if (isset($_GET['format']) && $_GET['format'] == "raw") { $json = $mendeley->fetch_docs_in_group($gid); format_json($json); } else { $uuids = $mendeley->get_uuids_in_group($gid); if (count($uuids) == 0) { echo 'No documents found'; link_home(); } else { html_header(); link_home(); echo '<h3>Documents in group ' . $gid . '</h3>'; foreach ($uuids as $uuid) { $paper = $mendeley->get_document($uuid); echo '<P>'; $paper->format_html(); echo '</P>'; }
<body> <?php require_once 'test-util.php'; require_once dirname(__FILE__) . '/../lib/ca-main.php'; echo '<div class="apitest">'; echo '<h1>users_processes_notes_index</h1>'; $ca = new CityApi(); $ca->debug = true; $ca->json = true; echo "<h2>Test:</h2>"; $userid = 238801; $processid = 12343; $results = $ca->users_processes_notes_index($userid, $processid, array('page' => 1)); echo "<h2>results:</h2>{$results}"; echo '<h2>Formatted JSON results: </h2>'; echo '<pre>'; echo format_json($results); echo '</pre>'; echo '<h2>HTTP Response Info</h2>'; echo '<pre>'; var_dump($ca->get_last_status_code()); var_dump($ca->get_last_response_start_line()); var_dump($ca->get_last_headers()); echo '</pre>'; echo '</div>'; ?> </body> </html>
$results = $ca->users_index(array('page' => '1')); $total_pages = $results['total_pages']; $total_entries = $results['total_entries']; $per_page = $results['per_page']; echo "<h2>Got {$total_pages} pages, {$total_entries} users, {$per_page} per page</h2>"; echo '<h2>Formatted JSON results: </h2>'; echo '<pre>'; echo format_json(json_encode($results)); echo '</pre>'; // get remaining pages for ($page = 2; $page <= $total_pages; $page++) { $results = $ca->users_index(array('page' => $page)); echo "<h2>Page {$page}:</h2>"; echo '<h2>Formatted JSON results: </h2>'; echo '<pre>'; echo format_json(json_encode($results)); echo '</pre>'; } /* $ca->debug = true; //$ca->json = true; //$results = $ca->users_index(array('page'=>'1')); $results = $ca->users_index(); echo "<h2>results:</h2>$results"; echo '<h2>Formatted JSON results: </h2>'; echo '<pre>'; echo format_json($results); echo '</pre>'; $user_count = $results['count']; */
<html> <head> <link rel="stylesheet" href="assets/css/bootstrap.min.css" /> </head> <body> <h2>List Subjects for Galleries</h2> <i>This example returns a list of subjects currently enrolled in a given gallery</i><br /> <?php //* * * * include the wrapper class include '../Kairos.php'; include 'assets/helper.php'; //* * * * sample api credentials (works for example) $app_id = 'e2a8eaa7'; $api_key = '4092e4a45070bca728644e9285f084b4'; //* * * * create a new instance and authenticate $Kairos = new Kairos($app_id, $api_key); /* In this example, we request a list of all galleries */ $gallery_id = "people"; $response = $Kairos->listSubjectsForGallery($gallery_id); echo '<br /><b>Response:</b><br />'; echo '<div class="text-left" style="padding:10px;border:1px solid rgba(51, 51, 51, 0.08);background-color: rgba(204, 204, 204, 0.26);"><br />'; echo format_json($response, true); echo '</div>'; ?> </body> </html>
} if ($action) { $account = trim(getgpc('name')); $password = trim(getgpc('password')); $confirm = getgpc('confirm'); $avatar = getgpc('avatar'); $gid = getnum('gid', 0); $state = getnum("state", 1); $gender = getnum('gender', 0); $email = getgpc('email'); $phone = getgpc('phone'); $blog = getgpc('blog'); $qq = getgpc('qq'); $birthday = getgpc('birthday'); $extra = $_POST['extra']; $extra = format_json(fix_json($extra)); } //连接数据库 System::connect(); //动作处理 switch ($action) { case "add": //检查权限 $func = 'system-admin-add'; System::check_func($func, FALSE); //查询数据 $sql = "SELECT * FROM `sys:admin` WHERE account='" . $account . "'"; $row = System::$db->getOne($sql); if ($row) { $_G['project']['message'] = "已经存在同名用户!"; } else {
/** * Generates the json output for an api request. * * @param array $data * * @return string The api result as json. */ function gen_json($data) { // Allow the use of this json on any domain. header('Access-Control-Allow-Origin: *'); $data = tidy_array($data, null); $json = format_json(json_encode($data, JSON_UNESCAPED_UNICODE)); // JSONP callback function if (isset($_GET["callback"])) { header('Content-Type: application/javascript; charset=utf-8'); $json = safe_callback($_GET["callback"]) . "(" . $json . ");"; } else { header('Content-Type: application/json; charset=utf-8'); } return $json; }
//loader require 'include/naver.admin.php'; //菜单处理 $action = getgpc('action'); $jump = getgpc('jump'); //下一步 $next = true; $gid = getnum('id', 0); $name = getgpc('name'); $state = getnum('state', 0); $medal = getgpc("medal"); $description = getgpc('description'); if ($action) { //权限配置 $config = $_POST['config']; $config = format_json(fix_json($config)); //快捷方式 $module = $_POST['module']; $module = serialize($module); //小工具 $widget = $_POST['widget']; $widget = serialize($widget); } //连接数据库 System::connect(); //动作处理 switch ($action) { case "add": //检查权限 $func = 'system-group-add'; System::check_func($func, FALSE);
echo "<p>You entered SOME_PASSWORD as your password.</p>"; echo "<p>Welcome to WP API demo. Remember to put <b>'http://' or 'https://'</b> in front of your URL.</p>"; get_form(); // show the form description(); // Using apache authorization information $args = array('headers' => array('Authorization' => 'Basic ' . base64_encode($username . ':' . $password))); // Check submit form if (isset($_POST['submit_input'])) { $request_url = $_POST['url_request']; $wp_http = new WP_Http(); $result = $wp_http->request($request_url, $args); echo "<hr>"; echo "You requested: <b>{$request_url}</b> <br>"; echo "Go to <a href='http://json.parser.online.fr' target='_blank'> JSON Parser Online</a> to simply format the JSON"; put_json(format_json($result['body'])); // unset because we are done unset($_POST['submit_input']); } } function format_json($json, $html = false, $tabspaces = null) { $tabcount = 0; $result = ''; $inquote = false; $ignorenext = false; if ($html) { $tab = str_repeat(" ", $tabspaces == null ? 4 : $tabspaces); $newline = "<br/>"; } else { $tab = $tabspaces == null ? "\t" : str_repeat(" ", $tabspaces);
<?php $route = '/'; $app->get($route, function () use ($app){ $E = array(); $E['Message'] = "Welcome!"; $app->response()->status(200); $app->response()->header("Content-Type", "application/json"); echo format_json(json_encode($E)); }); ?>
public static function examine_insert($perm, $appid, $func, $summary, $execute, $original = array()) { global $_G; global $_CACHE; //如果有执行权限 if (array_key_exists($perm, $_G['group'])) { self::examine_execute($appid, $execute, $summary, $original); } else { //记录新审核 $sql = "INSERT INTO `sys:examine`(account,aid,appid,func,summary,original,execute,state,dateline,ip) values('" . $_G['manager']['account'] . "','" . $_G['manager']['id'] . "','" . $appid . "','" . $func . "','" . format_json(fix_json($summary)) . "','" . format_json(fix_json($original)) . "','" . addslashes($execute) . "',-1,'" . time() . "','" . GetIP() . "')"; self::$db->execute($sql); //查找拥有审核权限的用户组 $gid = self::get_func_gid($perm); //查找拥有审核权限的用户组 $uid = self::get_user_gid($gid); //批量发送审核提醒邮件 foreach ($_CACHE['system']['admin'] as $aid => $row) { if (in_array($aid, $uid) && $row['email']) { self::sendmail('新审核请求……', $row['email'], '', $row['account'] . '<br />$content'); } } } }