#!/bin/sh

. /lib/parentalcontrol/parentalcontrol.sh

enabled="$(uci -q get parentalcontrol.globals.enable)"
urlfilter="$(uci -q get parentalcontrol.globals.urlfilter)"

# if parentalcontrol is enabled, add the rules, else remove them
if [ "${enabled}" -eq "1" ]; then
	# this is for internet_access and profile_bedtime_schedule sections
	add_internet_schedule_rules
	# this is for urlfilter daemon
	if [ "${urlfilter}" -eq "1" ]; then
		add_iptables_nfqueue_rules
	fi
else
	# remove internet_access and profile_bedtime_schedule rules
	remove_internet_schedule_rules
	remove_iptables_nfqueue_rules
fi
