mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2025-06-01 21:52:25 -04: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
|
// Handle telegram
|
||||||
if ($typeID == 1) {
|
if ($typeID == 1) {
|
||||||
$this->submit_telegram($userID, $firstname, $token);
|
$this->submit_telegram($userID, $firstname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle email
|
// Handle email
|
||||||
@ -89,10 +89,9 @@ class Notification
|
|||||||
* Sends Telegram notification message using their web api.
|
* Sends Telegram notification message using their web api.
|
||||||
* @param string $userID The Telegram userid to send to
|
* @param string $userID The Telegram userid to send to
|
||||||
* @param string $firstname The users firstname
|
* @param string $firstname The users firstname
|
||||||
* @param string $uthkey Token used for managing subscription
|
|
||||||
* @return void
|
* @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 Handle limitations (Max 30 different subscribers per second)
|
||||||
// TODO Error handling
|
// TODO Error handling
|
||||||
|
@ -132,7 +132,7 @@ Class Subscriber
|
|||||||
global $mysqli;
|
global $mysqli;
|
||||||
$updateTime = strtotime("now");
|
$updateTime = strtotime("now");
|
||||||
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ? WHERE subscriberID=?");
|
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ? WHERE subscriberID=?");
|
||||||
$stmt->bind_param("ii", $updateTime, $subscriberId);
|
$stmt->bind_param("ii", $updateTime, $subscriberID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -145,24 +145,25 @@ Class Subscriber
|
|||||||
|
|
||||||
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ?, expires = ? WHERE subscriberID = ?");
|
$stmt = $mysqli->prepare("UPDATE subscribers SET update_time = ?, expires = ? WHERE subscriberID = ?");
|
||||||
$tmp = null;
|
$tmp = null;
|
||||||
$stmt->bind_param("iii", $updateTime, $tmp, $subscriberId);
|
$stmt->bind_param("iii", $updateTime, $tmp, $subscriberID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($subscriberID)
|
||||||
{
|
{
|
||||||
global $mysqli;
|
global $mysqli;
|
||||||
|
|
||||||
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ?");
|
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ?");
|
||||||
$stmt->bind_param("i", $this->id);
|
$stmt->bind_param("i", $subscriberID);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$query = $stmt->get_result();
|
//$query = $stmt->get_result();
|
||||||
|
|
||||||
$stmt = $mysqli->prepare("DELETE FROM subscribers WHERE subscriberID = ?");
|
$stmt = $mysqli->prepare("DELETE FROM subscribers WHERE subscriberID = ?");
|
||||||
$stmt->bind_param("i", $this->id);
|
$stmt->bind_param("i", $subscriberID);
|
||||||
$stmt->execute();
|
$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 = $mysqli->prepare("INSERT INTO services_subscriber (subscriberIDFK, serviceIDFK) VALUES (?, ?)");
|
||||||
$stmt->bind_param("ii", $userID, $service);
|
$stmt->bind_param("ii", $userID, $service);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$query = $stmt->get_result();
|
//$query = $stmt->get_result();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove($userID, $service)
|
public function remove($userID, $service)
|
||||||
@ -23,7 +24,8 @@ Class Subscriptions
|
|||||||
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ? AND serviceIDFK = ?");
|
$stmt = $mysqli->prepare("DELETE FROM services_subscriber WHERE subscriberIDFK = ? AND serviceIDFK = ?");
|
||||||
$stmt->bind_param("ii", $userID, $service);
|
$stmt->bind_param("ii", $userID, $service);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$query = $stmt->get_result();
|
//$query = $stmt->get_result();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_subscribed_services($typeID, $subscriberID, $userID, $token)
|
function render_subscribed_services($typeID, $subscriberID, $userID, $token)
|
||||||
@ -38,8 +40,6 @@ Class Subscriptions
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$query = $stmt->get_result();
|
$query = $stmt->get_result();
|
||||||
|
|
||||||
$timestamp = time();
|
|
||||||
|
|
||||||
$strNotifyType = _('E-mail Notification subscription');
|
$strNotifyType = _('E-mail Notification subscription');
|
||||||
if ( $typeID == 1 ) { $strNotifyType = _('Telegram Notification subscription'); }
|
if ( $typeID == 1 ) { $strNotifyType = _('Telegram Notification subscription'); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user