mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2024-11-23 20:58:46 -05:00
Minor code cleanup suggested by codacy service
This commit is contained in:
parent
b90fab434c
commit
c08264f4f7
@ -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
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
@ -37,9 +39,7 @@ Class Subscriptions
|
||||
$stmt->bind_param("ii", $typeID, $subscriberID);
|
||||
$stmt->execute();
|
||||
$query = $stmt->get_result();
|
||||
|
||||
$timestamp = time();
|
||||
|
||||
|
||||
$strNotifyType = _('E-mail Notification subscription');
|
||||
if ( $typeID == 1 ) { $strNotifyType = _('Telegram Notification subscription'); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user