Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.81 KB | None | 0 0
  1. <?php
  2.  
  3. JavascriptFile("/extensions/jqplot/jquery.jqplot.js");
  4. JavascriptFile("/extensions/jqplot/plugins/jqplot.dateAxisRenderer.js");
  5. JavascriptFile("/extensions/jqplot/plugins/jqplot.barRenderer.js");
  6. JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js");
  7. JavascriptFile('/yaamp/ui/js/auto_refresh.js');
  8.  
  9. $recents = array();
  10. $raw_recents = isset($_COOKIE['wallets'])? explode("|", $_COOKIE['wallets']): array();
  11. // make it unique
  12. foreach($raw_recents as $addr) {
  13. $recents[$addr] = $addr;
  14. }
  15.  
  16. $address = getparam('address');
  17.  
  18. $drop_address = getparam('drop');
  19. if (!empty($drop_address)) {
  20. // to clean cookies
  21. foreach($recents as $k=>$addr) {
  22. if ($addr == $drop_address) {
  23. unset($recents[$k]);
  24. if (controller()->admin)
  25. setcookie('wallets', implode("|", $recents), time()+60*60*24*30, '/');
  26. break;
  27. }
  28. }
  29. }
  30.  
  31. $user = getuserparam($address);
  32. if($user)
  33. {
  34. user()->setState('yaamp-wallet', $user->username);
  35. $recents[$user->username] = $user->username;
  36.  
  37. $coin = getdbo('db_coins', $user->coinid);
  38. if($coin) echo <<<END
  39. <script type="text/javascript">
  40. $(function() {
  41. $('#favicon').remove();
  42. $('head').append('<link href="{$coin->image}" id="favicon" rel="shortcut icon">');
  43. });
  44. </script>
  45. END;
  46.  
  47. if(empty($user->hostaddr) && !$this->admin) {
  48. $user->hostaddr = $_SERVER['REMOTE_ADDR'];
  49. $user->save();
  50. }
  51. }
  52.  
  53. $username = $user? $user->username: '';
  54.  
  55. if(!controller()->admin)
  56. setcookie('wallets', implode("|", $recents), time()+60*60*24*30, '/');
  57.  
  58. echo <<<END
  59. <div id='resume_update_button' style='color: #444; background-color: #ffd; border: 1px solid #eea;
  60. padding: 10px; margin-left: 20px; margin-right: 20px; margin-top: 15px; cursor: pointer; display: none;'
  61. onclick='auto_page_resume();' align=center>
  62. <b>Auto refresh is paused - Click to resume</b></div>
  63.  
  64. END;
  65. echo "<div class='row'>";
  66. if($user) echo <<<END
  67. <div class='col-lg-6 col-md-12 col-xs-12'>
  68. <div id='main_wallet_results'></div>
  69. </div>
  70. END;
  71.  
  72. if($user) echo <<<END
  73. <div class='col-lg-6 col-md-12 col-xs-12'>
  74. <div class="col-md-12">
  75. <div class="panel-body h-200 list">
  76. <div class="stats-title" style="display: flex;">
  77. <h4 style="width: 100%;">Last 24 Hours Balance: $user->username</h4>
  78. <label id="myLocalTime" style="text-align:right;width: 100%;color: #838383;margin-bottom: 10px;">22:53:03</label>
  79. </div>
  80. </div>
  81. <div class=""col-md-12">
  82. <div class="panel-body">
  83. <div id='graph_earnings_results'></div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. END;
  89. echo "</div>";
  90.  
  91. if($user) echo <<<END
  92. <div id='main_graphs_results'>
  93.  
  94. </div>
  95. END;
  96.  
  97. if($user) echo <<<END
  98. <div id='main_miners_results'>
  99.  
  100. </div>
  101. END;
  102. // echo "<div class='col-lg-6 col-md-12 col-xs-12'>";
  103. // echo '<div class="table-responsive" id="transactiontable">';
  104. // echo '<div class="panel panel-filled c-accent">';
  105. // echo '<table class="table" id="transactiontableobj">';
  106. // foreach($recents as $addr)
  107. // {
  108. // if(empty($addr)) continue;
  109.  
  110. // $user = getuserparam($addr);
  111. // if(!$user) continue;
  112.  
  113. // $coin = getdbo('db_coins', $user->coinid);
  114.  
  115. // if($user->username == $username)
  116. // echo "<tr style='background-color: #e0d3e8;'><td width=24>";
  117. // else
  118. // echo "<tr class='ssrow'><td width=24>";
  119.  
  120. // if($coin)
  121. // echo '<img width="16px" src="'.$coin->image.'">';
  122.  
  123. // echo '</td><td><a class="address" href="/?address='.$addr.'" style="font-family: monospace; font-size: 1.1em;">'.
  124. // $addr.'</a></td>';
  125.  
  126. // $balance = bitcoinvaluetoa($user->balance);
  127.  
  128. // if($coin)
  129. // $balance = $balance>0? "$balance $coin->symbol": '';
  130. // else
  131. // $balance = $balance>0? "$balance BTC": '';
  132.  
  133. // echo '<td align="right">'.$balance.'</td>';
  134. // echo '<td style="width: 16px; max-width: 16px;">'.
  135. // '<img src="/images/base/delete.png" onclick="javascript:drop_cookie(this);" style="cursor:pointer;"/>'.
  136. // '</td>';
  137. // echo '</tr>';
  138. // }
  139.  
  140. // echo "</table>";
  141. // echo "</div>";
  142. // echo "</div>";
  143. // echo "</div>";
  144.  
  145. echo <<<END
  146. <div class='col-lg-6 col-md-12 col-xs-12'>
  147. <div id='pool_current_results'></div>
  148. </div>
  149.  
  150. END;
  151.  
  152. if($user) echo <<<END
  153. <div class='col-lg-6 col-md-12 col-xs-12'>
  154. <div id='found_results'></div>
  155. </div>
  156. END;
  157.  
  158. echo <<<END
  159. </div>
  160. <script>
  161.  
  162. function page_refresh()
  163. {
  164. pool_current_refresh();
  165. found_refresh();
  166.  
  167. if('$username' != '')
  168. {
  169. main_wallet_refresh();
  170. main_miners_refresh();
  171.  
  172. main_graphs_refresh();
  173. main_title_refresh();
  174. }
  175. }
  176.  
  177. function select_algo(algo)
  178. {
  179. window.location.href = '/site/algo?algo='+algo+'&r=/site/mining';
  180. }
  181.  
  182. ////////////////////////////////////////////////////
  183.  
  184. function main_wallet_ready(data)
  185. {
  186. $('#main_wallet_results').html(data);
  187. }
  188.  
  189. function main_wallet_refresh()
  190. {
  191. var url = "/site/wallet_results?address=$username";
  192. $.get(url, '', main_wallet_ready);
  193. }
  194.  
  195. function main_wallet_refresh_details()
  196. {
  197. var url = "/site/wallet_results?address=$username&showdetails=1";
  198. $.get(url, '', main_wallet_ready);
  199. }
  200.  
  201. ////////////////////////////////////////////////////
  202.  
  203. function main_miners_ready(data)
  204. {
  205. $('#main_miners_results').html(data);
  206. }
  207.  
  208. function main_miners_refresh()
  209. {
  210. var url = "/site/wallet_miners_results?address=$username";
  211. $.get(url, '', main_miners_ready);
  212. }
  213.  
  214. ////////////////////////////////////////////////////
  215.  
  216. function pool_current_ready(data)
  217. {
  218. $('#pool_current_results').html(data);
  219. }
  220.  
  221. function pool_current_refresh()
  222. {
  223. var url = "/site/current_results";
  224. $.get(url, '', pool_current_ready);
  225. }
  226.  
  227. ////////////////////////////////////////////////////
  228.  
  229. function main_title_ready(data)
  230. {
  231. document.title = data;
  232. }
  233.  
  234. function main_title_refresh()
  235. {
  236. var url = "/site/title_results?address=$username";
  237. $.get(url, '', main_title_ready);
  238. }
  239.  
  240. ////////////////////////////////////////////////////
  241.  
  242. function found_ready(data)
  243. {
  244. $('#found_results').html(data);
  245. }
  246.  
  247. function found_refresh()
  248. {
  249. var url = "/site/user_earning_results?address=$username";
  250. $.get(url, '', found_ready);
  251. }
  252.  
  253. ////////////////////////////////////////////////////
  254.  
  255. var last_graph_update = 0;
  256.  
  257. function main_graphs_ready(data)
  258. {
  259. $('#main_graphs_results').html(data);
  260. $('.graph_algo').each(function()
  261. {
  262. var algo = $(this).attr('id');
  263. main_refresh_hashrate(algo);
  264. });
  265. }
  266.  
  267. function main_graphs_refresh()
  268. {
  269. var now = Date.now()/1000;
  270.  
  271. if(now < last_graph_update + 900) return;
  272. last_graph_update = now;
  273.  
  274. var url = "/site/wallet_graphs_results?address=$username";
  275. $.get(url, '', main_graphs_ready);
  276.  
  277. graph_earnings_refresh();
  278. }
  279.  
  280. ///////////////////////////////////////////////////////////////////////
  281.  
  282. function main_refresh_hashrate(algo)
  283. {
  284. var url = "/site/graph_user_results?address=$username&algo="+algo;
  285. $.get(url, '', function(data)
  286. {
  287. graph_init_hashrate(data, algo);
  288. });
  289. }
  290.  
  291. ///////////////////////////////////////////////////////////////////////
  292.  
  293. function graph_init_hashrate(data, algo)
  294. {
  295. var gdata = $.parseJSON(data);
  296. $.plot($('#graph_results_'+algo), [gdata]);
  297. }
  298.  
  299. ///////////////////////////////////////////////////////////////////////
  300.  
  301. function graph_earnings_ready(data)
  302. {
  303. graph_earnings_init(data);
  304. }
  305.  
  306. function graph_earnings_refresh()
  307. {
  308. var url = "/site/graph_earnings_results?address=$username";
  309. $.get(url, '', graph_earnings_ready);
  310. }
  311.  
  312. function graph_earnings_init(data)
  313. {
  314. var gdata = $.parseJSON(data);
  315. $.plot($('#graph_earnings_results'), [gdata]);
  316.  
  317. }
  318.  
  319. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  320.  
  321. function main_wallet_tx()
  322. {
  323. var w = window.open("/site/tx?address=$username", "yaamp_tx",
  324. "width=800,height=600,location=no,menubar=no,resizable=yes,status=yes,toolbar=no");
  325. }
  326.  
  327. function drop_cookie(el)
  328. {
  329. var addr = $(el).closest('tr').find('td a.address').text();
  330. window.location.href = '?address={$address}&drop=' + addr;
  331. }
  332.  
  333. </script>
  334.  
  335.  
  336. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement