| Server IP : 195.114.193.97 / Your IP : 216.73.216.140 Web Server : LiteSpeed System : Linux host 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64 User : sembi4241 ( 1126) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/local/CyberCP/plogical/ |
Upload File : |
#!/usr/local/CyberCP/bin/python
import os
import os.path
import sys
import django
sys.path.append('/usr/local/CyberCP')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
django.setup()
from websiteFunctions.models import Websites
import json
class ChildDomainManager:
def __init__(self, masterDomain = None, childDomain = None):
self.masterDomain = masterDomain
self.childDomain = childDomain
def findChildDomainsJson(self, alias=0):
master = Websites.objects.get(domain=self.masterDomain)
childDomains = master.childdomains_set.filter(alais=alias)
json_data = "["
checker = 0
for items in childDomains:
if items.domain == f'mail.{master.domain}':
pass
else:
dic = {
'childDomain': items.domain,
'path': items.path,
'childLunch': '/websites/' + self.masterDomain + '/' + items.domain
}
if checker == 0:
json_data = json_data + json.dumps(dic)
checker = 1
else:
json_data = json_data + ',' + json.dumps(dic)
json_data = json_data + ']'
return json_data