function show_orders(&$allorders, &$services, $btcmhd = 0) { $algo = user()->getState('yaamp-algo'); $price = controller()->memcache->get_database_scalar("current_price-{$algo}", "select price from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo)); foreach ($allorders as $i => $order) { if ($order['price'] < $btcmhd) { continue; } if ($order['workers'] <= 0 && !isset($order['me'])) { continue; } if ($order['speed'] <= 0 && !isset($order['me'])) { continue; } $service_btcmhd = mbitcoinvaluetoa($order['price']); $hash = Itoa2($order['speed'] * 1000000000) . 'h/s'; $limit = Itoa2($order['limit'] * 1000000000) . 'h/s'; $btc = round($order['btc'] * 1000, 1); $profit = $price > $service_btcmhd ? round(($price - $service_btcmhd) / $service_btcmhd * 100) . '%' : ''; show_services($services, $service_btcmhd); if (isset($order['me'])) { echo "<tr class='ssrow' style='background-color: #dfd'>"; } else { echo "<tr class='ssrow'>"; } echo "<td></td>"; echo "<td><b>{$hash}</b> ({$order['workers']})</td>"; echo "<td align=right style='font-size: .8em;'>{$limit}</td>"; echo "<td align=right style='font-size: .8em;'>{$btc}</td>"; echo "<td align=right style='font-size: .8em;'><b>{$profit}</b></td>"; echo "<td></td>"; echo "<td></td>"; echo "<td align=right style='font-size: .8em;'><b>{$service_btcmhd}</b></td>"; echo "</tr>"; unset($allorders[$i]); } }
* Dispatches the request */ // Adds a service port or updates one or more services ports if (isset($_POST['uaction']) && $_POST['uaction'] != 'reset') { add_update_services($_POST['uaction'] == 'add' ? true : false); user_goto('settings_ports.php'); } // Deletes a service port if (isset($_GET['delete'])) { delete_service(clean_input($_GET['delete'])); user_goto('settings_ports.php'); } $cfg = EasySCP_Registry::get('Config'); $tpl = EasySCP_TemplateEngine::getInstance(); $template = 'admin/settings_ports.tpl'; show_services($tpl); // static page messages $tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP - Admin/Settings'), 'TR_ACTION' => tr('Action'), 'TR_UDP' => tr('udp'), 'TR_TCP' => tr('tcp'), 'TR_ENABLED' => tr('Yes'), 'TR_DISABLED' => tr('No'), 'TR_APPLY_CHANGES' => tr('Apply changes'), 'TR_SERVERPORTS' => tr('Server ports'), 'TR_SERVICE' => tr('Service'), 'TR_IP' => tr('IP'), 'TR_PORT' => tr('Port'), 'TR_PROTOCOL' => tr('Protocol'), 'TR_SHOW' => tr('Show'), 'TR_ACTION' => tr('Action'), 'TR_DELETE' => tr('Delete'), 'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s service port ?', true, '%s'), 'TR_SHOW_UPDATE_SERVICE_PORT' => tr('View / Update service(s) port'), 'TR_ADD_NEW_SERVICE_PORT' => tr('Add new service port'), 'VAL_FOR_SUBMIT_ON_UPDATE' => tr('Update'), 'VAL_FOR_SUBMIT_ON_ADD' => tr('Add'), 'VAL_FOR_SUBMIT_ON_RESET' => tr('Reset'))); gen_admin_mainmenu($tpl, 'admin/main_menu_settings.tpl'); gen_admin_menu($tpl, 'admin/menu_settings.tpl'); gen_page_message($tpl); if ($cfg->DUMP_GUI_DEBUG) { dump_gui_debug($tpl); } $tpl->display($template); unset_messages(); /******************************************************************************* * Functions */ /** * Prepare and put data in session on error(s)