\n"; $page_scripts .= trim($script); } } # function addCSS($css) { global $page_css; $page_css .= $css; } # function addGBase() { $g = "function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));} function sep(d){ans={};var ar=d.split('\\t');var l=ar.length;for(var i=0;i(zm-0.5)){return(zm-0.5)}return z} function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)} function gchy(c,y){return gch((1-y)*c['ym']+c['yo'],c['ctx'].canvas.height)} function gx0(c){return -c['xo']/c['xm']}; function gy0(c){return -c['yo']/c['ym']}; function gto(c,xo,yo){c['xo']+=xo;c['yo']+=yo} function gts(c,xs,ys){c['xm']*=xs;c['ym']*=ys} function gtso(c,xs,ys){gto(c,c['xm']*(1.0-xs)/2.0,c['ym']*(1.0-ys)/2.0);gts(c,xs,ys)} function gfs(c,bg){c['ctx'].fillStyle=bg} function gss(c,fg){c['ctx'].strokeStyle=fg} function glw(c,w){c['ctx'].lineWidth=w} function gfz(c,x,y,ox,oy,t,co,a){gfs(c,co);c['ctx'].textAlign=a;c['ctx'].fillText(t,gchx(c,x)+ox,gchy(c,y)-oy)} function gbe(c,x,y){c['ctx'].beginPath();c['ctx'].moveTo(gchx(c,x),gchy(c,y))} function gln(c,x,y){c['ctx'].lineTo(gchx(c,x),gchy(c,y))} function gct(c,x1,y1,x2,y2,x3,y3){c['ctx'].bezierCurveTo(gchx(c,x1),gchy(c,y1),gchx(c,x2),gchy(c,y2),gchx(c,x3),gchy(c,y3))} function glm(c,x,y){c['ctx'].moveTo(gchx(c,x),gchy(c,y))} function gle(c){c['ctx'].closePath()} function gfl(c){c['ctx'].fill()} function gst(c){c['ctx'].stroke()} function gfi(c){gle(c);gst(c)} function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)} function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av,w,cols){ gtso(c,xs,ys); gss(c,'black');glw(c,1.5); gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c); glw(c,0.2); var hi=c['ctx'].measureText('M').width, wi=c['ctx'].measureText('1').width; for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')} gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left'); var m=Math.round(0.5+xn/20.0); for(var i=0;i=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}} glw(c,1); if(c['smooth']){for(var j=1;j0){gss(c,'red');var y=(av-y0)/(y1-y0); gbe(c,0,y);gln(c,1,y);gst(c); var t=''+av.toFixed(2)+'av';gfz(c,1,y,1,0,t,'red','left')} if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;ic['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['pxe']=Math.max(Math.round(c['xm']/250),1)} function opts(t,i){var e=document.getElementById(i);if(t.checked){e.style.visibility='visible'}else{e.style.visibility='hidden'}} function ghrs(c){c['hrs']=[1,2,3,4,6,8,12,24,48];c['hln']=[1,2,3,4,6]} function ghg(c,dx){var tl=dx/(gchx(c,1)/50)/3600;for(var j=c['hrs'].length-1;j>=0;j--){if(tl 0) $form .= ""; return $form; } # function dotrm($html, $dontdoit) { if ($dontdoit === true) return $html; else return preg_replace('/ *\n */', '', $html); } # function trm($html) { global $dont_trm; return dotrm($html, $dont_trm); } # function trm_force($html) { return dotrm($html, false); } # function pghead($css_marker, $script_marker, $name) { global $page_title; $iCrap = strpos($_SERVER['HTTP_USER_AGENT'],'iP'); $head = "\n"; $head .= "$page_title$name"; $head .= ""; $head .= ""; $head .= ""; $head .= "\n"; $head .= "\n"; $head .= ''; $head .= $script_marker; // where to put the scripts $head .= ''; return $head; } # function pgtop($info, $dotop, $user, $douser) { global $site_title, $loginfailed; $phr = '?THs'; $plb = '?'; $nlb = '?'; $pac = '0'; $per = '0'; $uhr = '?GHs'; $u1hr = ''; if ($info !== false) { $now = time(); if (isset($info['p_hashrate5m'])) $phr = $info['p_hashrate5m']; // if (isset($info['p_elapsed']) // and isset($info['p_hashrate1hr']) // and $info['p_elapsed'] > 3600) // $phr = $info['p_hashrate1hr']; if ($phr == '?') $phr = '?THs'; else $phr = dsprate($phr); if (isset($info['lastblock'])) { $plb = $info['lastblock']; if ($plb != '?') { $sec = $now - $plb; if ($sec < 60) $plb = $sec.'s'; else { if ($sec < 3600) { $min = round($sec / 60); $plb = $min.'m'; } else { $min = round($sec / 60); $hr = round($min / 60); $min -= ($hr * 60); $plb = $hr.'h'; if ($min > 0) $plb .= ' '.$min.'m'; } } } } if (isset($info['lastblockheight'])) $plb .= ' ('.$info['lastblockheight'].')'; if (isset($info['lastbc'])) { $nlb = $info['lastbc']; if ($nlb != '?') { $sec = $now - $nlb; $min = round($sec / 60); $nlb = $min.'m'; $s = $sec - $min * 60; if ($s > 0) $nlb .= " ${s}s"; } } if (isset($info['lastheight'])) $nlb .= ' ('.$info['lastheight'].')'; if (isset($info['blockacc'])) { $acc = $info['blockacc']; $pac = number_format($acc, 0); if (isset($info['currndiff'])) { $cur = $info['currndiff']; if ($cur != '?' && $cur > 0.0) $pac .= ' ('.number_format(100.0*$acc/$cur, 2).'%)'; } } if (isset($info['blockerr'])) { $rej = $info['blockerr']; $per = number_format($info['blockerr'], 0); if (isset($info['blockacc']) && ($acc+$rej) > 0) $per .= ' ('.number_format(100.0*$rej/($acc+$rej), 3).'%)'; } if (isset($info['u_hashrate5m'])) { $uhr = $info['u_hashrate5m']; if ($uhr == '?') $uhr = '?GHs'; else $uhr = dsprate($uhr); } if (isset($info['u_hashrate1hr']) and isset($info['u_elapsed']) and $info['u_elapsed'] > 3600) { $u1hr = $info['u_hashrate1hr']; if ($u1hr == '?') $u1hr = ''; else { $u1hr = '/'.dsprate($u1hr); // Remove the first XHs if they are the same if (substr($u1hr, -3) == substr($uhr, -3)) $uhr = substr($uhr, 0, -3); } } } $top = ""; if ($loginfailed === true) $top .= '
Login Failed
'; if (isset($info['u_nopayaddr'])) $top .= '
Please set a payout address on your account!
'; if (isset($info['u_noemail'])) $top .= '
Please set an email address on your account!
'; $top .= '
'; if ($dotop === true) { $lh = ''; $ls = ''; $lw = ''; if (isset($info['now']) && isset($info['lastsh']) && isset($info['lasthb']) && isset($info['lastwi'])) { $lsn = $info['now'] - $info['lastsh']; $lhn = $info['now'] - $info['lasthb']; $lwn = $info['now'] - $info['lastwi']; if ($lsn < 8) $lsc = 'green.png'; else { if ($lsn < 10) $lsc = 'orange.png'; else $lsc = 'red.png'; } if ($lhn < 5) $lhc = 'green.png'; else { if ($lhn < 10) $lhc = 'orange.png'; else $lhc = 'red.png'; } if ($lwn < 36) $lwc = 'green.png'; else { if ($lwn < 46) $lwc = 'orange.png'; else $lwc = 'red.png'; } $img1 = ''; $top .= 'Workers: '; $top .= ' '.$info['workers'].''; $top .= ''; if ($douser === true) { $top .= ''; } $top .= ''; } else $top .= ' '; $top .= '
'; return $top; } # function pgmenu($menus) { $iCrap = strpos($_SERVER['HTTP_USER_AGENT'],'iP'); $ret = "\n"; $ret .= '
'; $ret .= ''; $ret .= ''; $side = ''; foreach ($menus as $menu => $submenus) { if ($menu == 'Admin' && $submenus == null) continue; if ($menu == 'gap') { $side = 'r'; continue; } if ($iCrap) { foreach ($submenus as $submenu => $item) $ret .= ""; } else { $ret .= "
\n"; return $ret; } # function pgbody($info, $page, $menu, $dotop, $user, $douser) { $body = ' 5000) $syc = 'hi'; else $syc = 'lo'; $syncd = number_format($sync); $foot .= "sync: $syncd "; } $foot .= 'Copyright © Kano 2014'; $now = date('Y'); if ($now != '2014') $foot .= "-$now"; $foot .= ' Z/s'; $foot .= "\n"; return $foot; } # function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true) { global $dbg, $stt; global $page_css, $page_scripts; $dbg_marker = '[@dbg@]'; $css_marker = '[@css@]'; $script_marker = '[@scripts@]'; if ($dbg === true) $pg = $dbg_marker.'
'; else $pg = ''; if ($info === NULL) $info = homeInfo($user); if ($ispage == true) { $both = array('info' => $info, 'data' => $data); $pg .= $pagefun($both, $user); } else $pg .= $pagefun; // if (isset($_SESSION['logkey'])) // unset($_SESSION['logkey']); $head = pghead($css_marker, $script_marker, $name); $body = pgbody($info, $page, $menu, $dotop, $user, $douser); $foot = pgfoot($info); if ($dbg === true) $pg = str_replace($dbg_marker, cvtdbg(), $pg); $head = str_replace($css_marker, $page_css, $head); if ($page_scripts != '') $page_scripts .= ""; $head = str_replace($script_marker, $page_scripts, $head); $all = $head; $all .= trm_force($body); $all .= trm($pg); if (isset($_SERVER["REQUEST_TIME_FLOAT"])) $elapsed = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; else $elapsed = microtime(true) - $stt; $foot = trm_force(str_replace('Z/', number_format($elapsed, 4), $foot)); usleep(100000); echo $all.$foot; exit(0); } ?>