-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* project overwatch * Update subsystem.dm * wahoo * Update admin_verbs.dm * Update _base.dm * Revert "Update _base.dm" This reverts commit 4f13057. * age and ban checker * Update subsystem.dm
- Loading branch information
Showing
12 changed files
with
902 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
/proc/new_sql_sanitize_text(text) | ||
text = replacetext(text, "'", "") | ||
text = replacetext(text, ";", "") | ||
text = replacetext(text, "&", "") | ||
text = replacetext(text, "`", "") | ||
return text | ||
|
||
/proc/remove_all_spaces(text) | ||
text = replacetext(text, " ", "") | ||
return text | ||
|
||
/proc/sql_sanitize_text(text) | ||
text = replacetext(text, "'", "''") | ||
text = replacetext(text, ";", "") | ||
text = replacetext(text, "&", "") | ||
return text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/datum/ip_info | ||
var/is_loaded = FALSE | ||
var/is_whitelisted = FALSE | ||
|
||
var/ip | ||
var/ip_as | ||
var/ip_mobile | ||
var/ip_proxy | ||
var/ip_hosting | ||
|
||
/client | ||
var/datum/ip_info/ip_info = new | ||
|
||
/client/proc/Overwatch_ASN_panel() | ||
set category = "Server" | ||
set name = "Overwatch ASN Panel" | ||
|
||
if(!SSdbcore.Connect()) | ||
to_chat(usr, span_warning("Failed to establish database connection")) | ||
return | ||
|
||
if(!check_rights(R_SERVER)) | ||
return | ||
|
||
new /datum/overwatch_asn_panel(src) | ||
|
||
|
||
/client/proc/Overwatch_WhitelistPanel() | ||
set category = "Server" | ||
set name = "Overwatch WL Panel" | ||
|
||
if(!SSdbcore.Connect()) | ||
to_chat(usr, span_warning("Failed to establish database connection")) | ||
return | ||
|
||
if(!check_rights(R_BAN)) | ||
return | ||
|
||
new /datum/overwatch_wl_panel(src) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/datum/overwatch_asn_panel | ||
var/client/holder // client of who is holding this | ||
|
||
/datum/overwatch_asn_panel/New(user) | ||
if(user) | ||
setup(user) | ||
else | ||
qdel(src) | ||
return | ||
|
||
/datum/overwatch_asn_panel/proc/setup(user) // client or mob | ||
if(!SSdbcore.Connect()) | ||
to_chat(holder, span_warning("Failed to establish database connection")) | ||
qdel(src) | ||
return | ||
|
||
if(istype(user, /client)) | ||
var/client/user_client = user | ||
holder = user_client | ||
else | ||
var/mob/user_mob = user | ||
holder = user_mob.client | ||
|
||
if(!check_rights(R_SERVER, TRUE, holder)) | ||
qdel(src) | ||
return | ||
|
||
ui_interact(holder.mob) | ||
|
||
/datum/overwatch_asn_panel/ui_state(mob/user) | ||
return GLOB.admin_state // admin only | ||
|
||
/datum/overwatch_asn_panel/ui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "OverwatchASNManager") | ||
ui.open() | ||
|
||
/datum/overwatch_asn_panel/ui_data(mob/user, ui_key) | ||
. = SSoverwatch.tgui_panel_asn_data | ||
|
||
/datum/overwatch_asn_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
if(..()) | ||
return | ||
switch(action) | ||
if("asn_remove_entry") | ||
if(!params["asn"]) | ||
return TRUE | ||
if(SSoverwatch.RemoveASNban(params["asn"], holder)) | ||
SStgui.update_uis(src) | ||
else | ||
return TRUE | ||
if("asn_add_entry") | ||
if(!params["ip"]) | ||
return TRUE | ||
if(SSoverwatch.AddASNban(params["ip"], holder)) | ||
SStgui.update_uis(src) | ||
else | ||
return TRUE | ||
|
||
if(!length(SSoverwatch.tgui_panel_asn_data)) | ||
qdel(src) //For some unknown reason it refuses to update UI when it goes from 1 to 0 entries, so last item gets stuck. I can't fix it now, maybe later. ~Tsuru | ||
return | ||
|
||
SStgui.update_user_uis(holder.mob) | ||
return TRUE | ||
|
||
/datum/overwatch_asn_panel/ui_close(mob/user) | ||
qdel(src) |
69 changes: 69 additions & 0 deletions
69
monkestation/code/modules/overwatch/panels/whitelist_panel.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/datum/overwatch_wl_panel | ||
var/client/holder // client of who is holding this | ||
|
||
/datum/overwatch_wl_panel/New(user) | ||
if(user) | ||
setup(user) | ||
else | ||
qdel(src) | ||
return | ||
|
||
/datum/overwatch_wl_panel/proc/setup(user) // client or mob | ||
if(!SSdbcore.Connect()) | ||
to_chat(holder, span_warning("Failed to establish database connection")) | ||
qdel(src) | ||
return | ||
|
||
if(istype(user, /client)) | ||
var/client/user_client = user | ||
holder = user_client | ||
else | ||
var/mob/user_mob = user | ||
holder = user_mob.client | ||
|
||
if(!check_rights(R_BAN, TRUE, holder)) | ||
qdel(src) | ||
return | ||
|
||
ui_interact(holder.mob) | ||
|
||
/datum/overwatch_wl_panel/ui_state(mob/user) | ||
return GLOB.admin_state // admin only | ||
|
||
/datum/overwatch_wl_panel/ui_interact(mob/user, datum/tgui/ui) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "OverwatchWhitelistPanel") | ||
ui.open() | ||
|
||
/datum/overwatch_wl_panel/ui_data(mob/user) | ||
. = SSoverwatch.tgui_panel_wl_data | ||
|
||
/datum/overwatch_wl_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) | ||
if(..()) | ||
return | ||
switch(action) | ||
if("wl_remove_entry") | ||
if(!params["ckey"]) | ||
return TRUE | ||
if(SSoverwatch.RemoveFromWhitelist(params["ckey"], holder)) | ||
SStgui.update_uis(src) | ||
else | ||
return TRUE | ||
if("wl_add_ckey") | ||
if(!params["ckey"]) | ||
return TRUE | ||
if(SSoverwatch.AddToWhitelist(params["ckey"], holder)) | ||
SStgui.update_uis(src) | ||
else | ||
return TRUE | ||
|
||
if(!length(SSoverwatch.tgui_panel_wl_data)) | ||
qdel(src) //Same as ASN. ~Tsuru | ||
return | ||
|
||
SStgui.update_user_uis(holder.mob) | ||
return TRUE | ||
|
||
/datum/overwatch_wl_panel/ui_close(mob/user) | ||
qdel(src) |
Oops, something went wrong.