Minor code cleanup suggested by codacy service

This commit is contained in:
Thomas Nilsen 2018-11-25 21:33:18 +01:00
parent b90fab434c
commit c08264f4f7
3 changed files with 15 additions and 15 deletions

View File

@ -74,7 +74,7 @@ class Notification
// Handle telegram
if ($typeID == 1) {
$this->submit_telegram($userID, $firstname, $token);
$this->submit_telegram($userID, $firstname);
}
// Handle email
@ -89,10 +89,9 @@ class Notification
* Sends Telegram notification message using their web api.
* @param string $userID The Telegram userid to send to
* @param string $firstname The users firstname
* @param string $uthkey Token used for managing subscription
* @return void
*/
public function submit_telegram($userID, $firstname, $token)
public function submit_telegram($userID, $firstname)
{
// TODO Handle limitations (Max 30 different subscribers per second)
// TODO Error handling

View File

@ -132,7 +132,7 @@ Class Subscriber
global $mysqli;
$updateTime = strtotime("now");
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ? WHERE subscriberID=?");
$stmt->bind_param("ii", $updateTime, $subscriberId);
$stmt->bind_param("ii", $updateTime, $subscriberID);
$stmt->execute();
return true;
@ -145,24 +145,25 @@ Class Subscriber
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ?, expires = ? WHERE subscriberID = ?");
$tmp = null;
$stmt->bind_param("iii", $updateTime, $tmp, $subscriberId);
$stmt->bind_param("iii", $updateTime, $tmp, $subscriberID);
$stmt->execute();
return true;
}
public function delete($id)
public function delete($subscriberID)
{
global $mysqli;
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ?");
$stmt->bind_param("i", $this->id);
$stmt->bind_param("i", $subscriberID);
$stmt->execute();
$query = $stmt->get_result();
//$query = $stmt->get_result();
$stmt = $mysqli->prepare("DELETE FROM subscribers WHERE subscriberID = ?");
$stmt->bind_param("i", $this->id);
$stmt->bind_param("i", $subscriberID);
$stmt->execute();
$query = $stmt->get_result();
//$query = $stmt->get_result();
return true;
}

View File

@ -13,7 +13,8 @@ Class Subscriptions
$stmt = $mysqli->prepare("INSERT INTO services_subscriber (subscriberIDFK, serviceIDFK) VALUES (?, ?)");
$stmt->bind_param("ii", $userID, $service);
$stmt->execute();
$query = $stmt->get_result();
//$query = $stmt->get_result();
return true;
}
public function remove($userID, $service)
@ -23,7 +24,8 @@ Class Subscriptions
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ? AND serviceIDFK = ?");
$stmt->bind_param("ii", $userID, $service);
$stmt->execute();
$query = $stmt->get_result();
//$query = $stmt->get_result();
return true;
}
function render_subscribed_services($typeID, $subscriberID, $userID, $token)
@ -38,8 +40,6 @@ Class Subscriptions
$stmt->execute();
$query = $stmt->get_result();
$timestamp = time();
$strNotifyType = _('E-mail Notification subscription');
if ( $typeID == 1 ) { $strNotifyType = _('Telegram Notification subscription'); }