#$temp = json_encode($temp,true); #print_r($temp); #exit(); /*json*/ $val = @$_GET['val']; $val = json_decode($val, true); #$val = array('0'=>'www.eflydns.com'); if (count($val) == 0) { print_r(json_encode(result_init('1', 'val input wrong!', ''))); exit; } $data = ''; $ret = 0; switch ($opt) { case 'chart': $data = get_chart_data($val); if ($data) { $ret = 0; } else { $ret = 1; $data = "信息不存在"; } break; case 'add': $arr = set_value($val); $data = $arr['msg']; $ret = $arr['ret']; break; case 'del': $arr = del_value($val); $data = $arr['msg'];
$xml .= '</menu>' . chr(10); } break; case 'chart': $modID = $_GET['modID']; $fID = $_GET['fID']; $x = 0; $data = array(); while (isset($_GET['d' . $x])) { $data[$x] = $_GET['d' . $x]; $x++; } if (file_exists(DIR_FS_MODULES . $modID . '/functions/' . $modID . '.php')) { gen_pull_language($modID); require_once DIR_FS_MODULES . $modID . '/functions/' . $modID . '.php'; if ($results = get_chart_data($fID, $data)) { $xml .= xmlEntry('modID', $_GET['modID']); $xml .= xmlEntry('type', $results['type']); $xml .= xmlEntry('title', $results['title']); $xml .= xmlEntry('width', $results['width']); $xml .= xmlEntry('height', $results['height']); $xml .= xmlEntry('rowCnt', sizeof($results['data'])); if (sizeof($results['data']) > 0) { foreach ($results['data'] as $value) { $xml .= '<chartData>'; $xml .= xmlEntry('string', $value['label']); $xml .= xmlEntry('number', $value['value']); $xml .= '</chartData>'; } } else { $xml .= xmlEntry('error', 'No data returned from function call!');
} } if (!$found) { continue; } $xml .= "<staticanalysis>"; $xml .= add_XML_value("group_name", $static_group["name"]); $xml .= add_XML_value("group_name_clean", sanitize_string($static_group["name"])); foreach ($static_measurements as $measurement) { $xml .= "<measurement>"; $xml .= add_XML_value("name", $measurement); $xml .= add_XML_value("nice_name", sanitize_string($measurement)); $xml .= add_XML_value("sort", $sort["build_" . $measurement]); $value = get_current_value($static_group["name"], $measurement); $xml .= add_XML_value("value", $value); $chart_data = get_chart_data($static_group["name"], $measurement); $xml .= add_XML_value("chart", $chart_data); $xml .= "</measurement>"; } $xml .= "</staticanalysis>"; } $end = microtime_float(); $xml .= "<generationtime>" . round($end - $start, 3) . "</generationtime>"; $xml .= "</cdash>"; // Now do the xslt transition if (!isset($NoXSLGenerate)) { generate_XSLT($xml, "overview"); } // Replace various characters that trip up Javascript with underscores. function sanitize_string($input_string) {
} if (!$found) { continue; } $SA_response = array(); $SA_response['group_name'] = $static_group['name']; $SA_response['group_name_clean'] = sanitize_string($static_group['name']); $measurements_response = array(); foreach ($static_measurements as $measurement) { $measurement_response = array(); $measurement_response['name'] = $measurement; $measurement_response['name_clean'] = sanitize_string($measurement); $measurement_response['sort'] = $sort["build {$measurement}"]; $value = get_current_value($static_group['name'], $measurement); $measurement_response['value'] = $value; $chart_data = get_chart_data($static_group['name'], $measurement); $measurement_response['chart'] = $chart_data; $measurements_response[] = $measurement_response; } $SA_response['measurements'] = $measurements_response; $static_analyses_response[] = $SA_response; } $response['staticanalyses'] = $static_analyses_response; $end = microtime_float(); $response['generationtime'] = round($end - $start, 3); $response = json_encode(cast_data_for_JSON($response)); // Cache the overview page for 6 hours if ($CDASH_MEMCACHE_ENABLED) { cdash_memcache_set($memcache, cdash_memcache_key('overview'), $response, 60 * 60 * 6); } echo $response;
:</td><td><?php echo get_tasks(); ?> </td></tr> <tr><td><img align="top" style="margin-top:0px;margin-right:5px;margin-left:5px;" src="images/icons/downloads.png"><?php echo $lang[$l][41]; ?> :</td><td><?php echo get_loaded(); ?> </td></tr> </table> </td> <td style="background:#fff;" align="center"> <?php echo get_chart_data(); ?> </td> </tr> </table> <h1 style="margin-top:20px;margin-bottom:20px;text-align:center;"><?php echo $lang[$l][43]; ?> </h1> <table cellspacing="0"> <tr><th style="width:20%;">IP</th><th>BID</th></th><th style="width:30%;"><?php echo $lang[$l][44]; ?> </th><th>Система</th></th><th><?php echo $lang[$l][45];
function proc_main($user) { $data = array(); global $g_config; $deleteUrl = ajaxLink('delete'); $clearUrl = ajaxLink('clearbalance'); $chart_data = get_chart_data(); $week = json_encode($chart_data['week']); $month = json_encode($chart_data['month']); $month_label = json_encode($chart_data['month_label']); $year = json_encode($chart_data['year']); $year_label = json_encode($chart_data['year_label']); $script = <<<EOF \t \$(function(){ \t Chart.defaults.global.responsive = true; var data = { \tweek:{ \t labels: ["Monday","Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday"], \t datasets: [ \t { \t label: "Spend", \t fillColor: "rgba(151,187,205,0.2)", \t strokeColor: "rgba(151,187,205,1)", \t pointColor: "rgba(151,187,205,1)", \t pointStrokeColor: "#fff", \t pointHighlightFill: "#fff", \t pointHighlightStroke: "rgba(151,187,205,1)", \t data: {$week} \t } \t ] \t}, \tmonth:{ \t labels: {$month_label}, \t datasets: [ \t \t { \t label: "Spend", \t fillColor: "rgba(151,187,205,0.2)", \t strokeColor: "rgba(151,187,205,1)", \t pointColor: "rgba(151,187,205,1)", \t pointStrokeColor: "#fff", \t pointHighlightFill: "#fff", \t pointHighlightStroke: "rgba(151,187,205,1)", \t data: {$month} \t } \t ] \t}, \tyear:{ \t labels: {$year_label}, \t datasets: [ \t \t { \t label: "Spend", \t fillColor: "rgba(151,187,205,0.2)", \t strokeColor: "rgba(151,187,205,1)", \t pointColor: "rgba(151,187,205,1)", \t pointStrokeColor: "#fff", \t pointHighlightFill: "#fff", \t pointHighlightStroke: "rgba(151,187,205,1)", \t data: {$year} \t } \t ] \t}, }; var char_list = new Array(); function draw(id){ \tif(char_list[id]){ \t\tchar_list[id].destroy(); \t} \t\$("#"+id).html('<canvas id="Total_'+id+'"></canvas>'); \tvar ctx = document.getElementById('Total_'+id).getContext("2d"); \t \tchar_list[id] = new Chart(ctx).Line(data[id],{}); \t \t\t } draw("week"); \$(document).delegate('#chartm li a','click',function(e){ \tvar ca = \$(this).attr('href'); \tvar ca = ca.substr(1); \t \tdraw(ca); }); \t\$('.delete').click(function(){ \t\tvar id = \$(this).attr('data'); \t\tif(confirm('Are you sure to delete this statement?')){ \t\t\t\$.getJSON('{$deleteUrl}',{id:id},function(result){ \t\t\t\tif(result.status == '200'){ \t\t\t\t\talert('ok'); \t\t\t\t\twindow.location.href = 'index.php'; \t\t\t\t}else{ \t\t\t\t\talert(result.message); \t\t\t\t} \t\t\t}); \t\t} \t\t \t}); \t\$('#clear-balance').click(function(){ \t\tvar id = \$(this).attr('data'); \t\tif(confirm('Are you sure to clear the balance? This will clear both your roommate\\'s balance')){ \t\t\t\$.getJSON('{$clearUrl}',{},function(result){ \t\t\t\tif(result.status == '200'){ \t\t\t\t\talert('Clear Balance Successful'); \t\t\t\t\twindow.location.href = 'index.php'; \t\t\t\t}else{ \t\t\t\t\talert('You can not delete a cleared transaction'); \t\t\t\t} \t\t\t}); \t\t} \t}); }); EOF; $form['amount'] = ''; $form['description'] = ''; if (isset($_GET['status']) && $_GET['status'] == 'ok') { $data['notice'] = array('type' => 'success', 'message' => 'Add data successfully'); } if (isset($_POST['amount']) && isset($_POST['description'])) { $payee = []; foreach ($g_config['account'] as $u) { $payee_name = 'payee_' . $u['account']; if (isset($_POST[$payee_name])) { $payee[] = $u['account']; } } if (count($payee) == NUM_OF_USR) { $payee = []; } $form['amount'] = safe($_POST['amount']); $form['description'] = safe($_POST['description']); if (!is_numeric($form['amount'])) { $data['notice'] = array('type' => 'danger', 'message' => 'The amount is not a number'); } else { if (add($form['amount'], $form['description'], join(':', $payee))) { header('Location: index.php?status=ok'); } else { $data['notice'] = array('type' => 'danger', 'message' => 'Database error'); } } } $data['user'] = $user; $data['limit'] = 20; if (isset($_GET['page'])) { $data['page'] = intval(safe($_GET['page'])); $data['current_offset'] = $data['limit'] * $data['page']; } else { $data['page'] = 0; $data['current_offset'] = 0; } $data['detail'] = get_list($data['current_offset'], $data['limit']); $data['form'] = $form; foreach ($g_config['account'] as $key => $value) { $balance = get_user_current_balance($key); $data['current_balance_user'][$key]['balance'] = $balance; $data['current_balance_user'][$key]['name'] = $g_config['account'][$key]['name']; $data['current_balance_user'][$key]['phone'] = $g_config['account'][$key]['phone']; } $data['current_balance'] = get_total_current_balance(); renderMain($data, $script); }