From 382fddb5283612f595a858d006f6c06d09ce4bc0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 3 Jul 2013 14:21:05 +0200 Subject: [PATCH] Remove PHP Warnings from worker page * Added HTML5 required flags for username/passwords * Added empty string check in addWorker method Fixes #347 --- public/include/classes/worker.class.php | 5 ++++- public/templates/mmcFE/account/workers/default.tpl | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index 0aff7a62..716a2c15 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -154,6 +154,10 @@ class Worker { **/ public function addWorker($account_id, $workerName, $workerPassword) { $this->debug->append("STA " . __METHOD__, 4); + if (empty($workerName) || empty($workerPassword)) { + $this->setErrorMessage('Worker and password may not be empty'); + return false; + } $username = $this->user->getUserName($account_id); $workerName = "$username.$workerName"; $stmt = $this->mysqli->prepare("INSERT INTO $this->table (account_id, username, password) VALUES(?, ?, ?)"); @@ -181,7 +185,6 @@ class Worker { if ($this->checkStmt($stmt)) { $stmt->bind_param('ii', $account_id, $id); if ($stmt->execute() && $stmt->affected_rows == 1) { - $stmt->close; return true; } else { $this->setErrorMessage( 'Unable to delete worker' ); diff --git a/public/templates/mmcFE/account/workers/default.tpl b/public/templates/mmcFE/account/workers/default.tpl index 8c127400..c69d1139 100644 --- a/public/templates/mmcFE/account/workers/default.tpl +++ b/public/templates/mmcFE/account/workers/default.tpl @@ -18,8 +18,8 @@ {section worker $WORKERS} {assign var="username" value="."|escape|explode:$WORKERS[worker].username:2} - {$username.0|escape}. - + {$username.0|escape}. + @@ -43,7 +43,7 @@ - {$smarty.session.USERDATA.username}. ·   + {$smarty.session.USERDATA.username}. ·   {include file="global/block_footer.tpl"}