diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php
index 42af02de..2960bfe7 100644
--- a/public/include/classes/worker.class.php
+++ b/public/include/classes/worker.class.php
@@ -176,6 +176,40 @@ class Worker {
return false;
}
+ /**
+ * Fetch all workers for admin panel
+ * @param limit int
+ * @return mixed array Workers and their settings or false
+ **/
+ public function getAllWorkers($iLimit=0) {
+ $this->debug->append("STA " . __METHOD__, 4);
+ $stmt = $this->mysqli->prepare("
+ SELECT id, username, password, monitor, difficulty,
+ (
+ SELECT
+ IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
+ FROM " . $this->share->getTableName() . "
+ WHERE
+ username = w.username
+ AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ ) + (
+ SELECT
+ IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
+ FROM " . $this->share->getArchiveTableName() . "
+ WHERE
+ username = w.username
+ AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ ) AS hashrate
+ FROM $this->table AS w
+ ORDER BY hashrate DESC LIMIT ?");
+ if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iLimit) && $stmt->execute() && $result = $stmt->get_result())
+ return $result->fetch_all(MYSQLI_ASSOC);
+ // Catchall
+ $this->setErrorMessage('Failed to fetch workers');
+ $this->debug->append('Fetching workers failed: ' . $this->mysqli->error);
+ return false;
+ }
+
/**
* Get all currently active workers in the past 10 minutes
* @param none
diff --git a/public/include/pages/admin/poolworkers.inc.php b/public/include/pages/admin/poolworkers.inc.php
new file mode 100644
index 00000000..54ea4e3c
--- /dev/null
+++ b/public/include/pages/admin/poolworkers.inc.php
@@ -0,0 +1,18 @@
+isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
+ header("HTTP/1.1 404 Page not found");
+ die("404 Page not found");
+}
+
+ $iActiveWorkers = $worker->getCountAllActiveWorkers();
+ $aWorkers = $worker->getAllWorkers($iActiveWorkers);
+
+ $smarty->assign('WORKERS', $aWorkers);
+
+$smarty->assign('CONTENT', 'default.tpl');
+
+?>
diff --git a/public/templates/mmcFE/admin/poolworkers/default.tpl b/public/templates/mmcFE/admin/poolworkers/default.tpl
new file mode 100644
index 00000000..f7afe308
--- /dev/null
+++ b/public/templates/mmcFE/admin/poolworkers/default.tpl
@@ -0,0 +1,34 @@
+{include file="global/block_header.tpl" BLOCK_HEADER="{count($WORKERS)} Current Active Pool Workers"}
+
+
+
+
+ | Worker Name |
+ Password |
+ Active |
+ {if $GLOBAL.config.disable_notifications != 1}Monitor | {/if}
+ Khash/s |
+ Difficulty |
+
+
+ {nocache}
+ {section worker $WORKERS}
+
+
+ | {$WORKERS[worker].username|escape} |
+ {$WORKERS[worker].password|escape} |
+  |
+ {if $GLOBAL.config.disable_notifications != 1}
+
+
+ |
+ {/if}
+ {$WORKERS[worker].hashrate|number_format|default:"0"} |
+ {if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if} |
+
+ {/section}
+ {/nocache}
+
+
+
+{include file="global/block_footer.tpl"}
diff --git a/public/templates/mmcFE/global/navigation.tpl b/public/templates/mmcFE/global/navigation.tpl
index 978a31b4..8d9e2fa6 100644
--- a/public/templates/mmcFE/global/navigation.tpl
+++ b/public/templates/mmcFE/global/navigation.tpl
@@ -22,6 +22,7 @@
Settings
News
Reports
+ Pool Workers
{/if}
diff --git a/public/templates/mpos/admin/poolworkers/default.tpl b/public/templates/mpos/admin/poolworkers/default.tpl
new file mode 100644
index 00000000..5d721421
--- /dev/null
+++ b/public/templates/mpos/admin/poolworkers/default.tpl
@@ -0,0 +1,31 @@
+
+ {count($WORKERS)} Current Active Pool Workers
+
+
+
+ | Worker Name |
+ Password |
+ Active |
+ {if $GLOBAL.config.disable_notifications != 1}Monitor | {/if}
+ Khash/s |
+ Difficulty |
+
+
+ {nocache}
+ {section worker $WORKERS}
+
+
+ | {$WORKERS[worker].username|escape} |
+ {$WORKERS[worker].password|escape} |
+ |
+ {if $GLOBAL.config.disable_notifications != 1}
+ |
+ {/if}
+ {$WORKERS[worker].hashrate|number_format|default:"0"} |
+ {if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if} |
+
+ {/section}
+ {/nocache}
+
+
+
diff --git a/public/templates/mpos/global/navigation.tpl b/public/templates/mpos/global/navigation.tpl
index ae4a024f..6f2552ed 100644
--- a/public/templates/mpos/global/navigation.tpl
+++ b/public/templates/mpos/global/navigation.tpl
@@ -23,6 +23,7 @@
Settings
News
Reports
+ Pool Workers
{/if}
{if $smarty.session.AUTHENTICATED|default}