mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
Remove some events
This commit is contained in:
@@ -16,7 +16,7 @@ class secMiddleware:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
if key == 'configData' or key == 'rewriteRules' or key == 'modSecRules' or key == 'recordContentTXT' or key == 'SecAuditLogRelevantStatus':
|
||||
if key == 'emailMessage' or key == 'configData' or key == 'rewriteRules' or key == 'modSecRules' or key == 'recordContentTXT' or key == 'SecAuditLogRelevantStatus':
|
||||
continue
|
||||
if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1:
|
||||
logging.writeToFile(request.body)
|
||||
|
||||
@@ -192,26 +192,25 @@ class emailMarketing(multi.Thread):
|
||||
if (items.verificationStatus == 'Verified' or self.extraArgs['verificationCheck']) and not items.verificationStatus == 'REMOVED':
|
||||
try:
|
||||
|
||||
if re.search('<html>', emailMessage.emailMessage, re.IGNORECASE):
|
||||
html = MIMEText(emailMessage.emailMessage, 'html')
|
||||
message.attach(html)
|
||||
removalLink = "https://" + ipAddress + ":8090/emailMarketing/remove/" + self.extraArgs['listName'] + "/" + items.email
|
||||
|
||||
if re.search('<html', emailMessage.emailMessage, re.IGNORECASE) and re.search('<body', emailMessage.emailMessage, re.IGNORECASE):
|
||||
finalMessage = emailMessage.emailMessage
|
||||
|
||||
if self.extraArgs['unsubscribeCheck']:
|
||||
removalMessage = '<br><br><a href="https://' + ipAddress + ':8090/emailMarketing/remove/' + \
|
||||
self.extraArgs[
|
||||
'listName'] + "/" + items.email + '">Unsubscribe from future emails.</a>'
|
||||
additionalCheck = MIMEText(removalMessage, 'html')
|
||||
message.attach(additionalCheck)
|
||||
finalMessage = finalMessage.replace('{{ unsubscribeCheck }}', removalLink)
|
||||
|
||||
html = MIMEText(finalMessage, 'html')
|
||||
message.attach(html)
|
||||
|
||||
else:
|
||||
html = MIMEText(emailMessage.emailMessage, 'plain')
|
||||
message.attach(html)
|
||||
if self.extraArgs['unsubscribeCheck']:
|
||||
finalMessage = '\n\n Unsubscribe by visiting https://' + ipAddress + ':8090/emailMarketing/remove/' + \
|
||||
self.extraArgs[
|
||||
'listName'] + "/" + items.email
|
||||
finalMessage = emailMessage.emailMessage
|
||||
|
||||
html = MIMEText(finalMessage, 'plain')
|
||||
message.attach(html)
|
||||
if self.extraArgs['unsubscribeCheck']:
|
||||
finalMessage = finalMessage.replace('{{ unsubscribeCheck }}', removalLink)
|
||||
|
||||
html = MIMEText(finalMessage, 'plain')
|
||||
message.attach(html)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
from django.dispatch import receiver
|
||||
from django.shortcuts import render
|
||||
from websiteFunctions.signals import preDomain
|
||||
from emACL import emACL
|
||||
|
||||
|
||||
|
||||
@receiver(preDomain)
|
||||
def loadDomainHome(sender, **kwargs):
|
||||
from websiteFunctions.models import Websites
|
||||
from loginSystem.models import Administrator
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import subprocess, shlex
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
request = kwargs['request']
|
||||
domain = request.GET['domain']
|
||||
userID = request.session['userID']
|
||||
|
||||
if Websites.objects.filter(domain=domain).exists():
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
website = Websites.objects.get(domain=domain)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if ACLManager.checkOwnership(domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
marketingStatus = emACL.checkIfEMEnabled(admin.userName)
|
||||
|
||||
Data = {}
|
||||
|
||||
Data['ftpTotal'] = website.package.ftpAccounts
|
||||
Data['ftpUsed'] = website.users_set.all().count()
|
||||
|
||||
Data['databasesUsed'] = website.databases_set.all().count()
|
||||
Data['databasesTotal'] = website.package.dataBases
|
||||
Data['marketingStatus'] = marketingStatus
|
||||
|
||||
Data['domain'] = domain
|
||||
|
||||
diskUsageDetails = virtualHostUtilities.getDiskUsage("/home/" + domain, website.package.diskSpace)
|
||||
|
||||
try:
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
execPath = execPath + " findDomainBW --virtualHostName " + domain + " --bandwidth " + str(
|
||||
website.package.bandwidth)
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
bwData = output.split(",")
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
bwData = [0, 0]
|
||||
|
||||
## bw usage calculations
|
||||
|
||||
Data['bwInMBTotal'] = website.package.bandwidth
|
||||
Data['bwInMB'] = bwData[0]
|
||||
Data['bwUsage'] = bwData[1]
|
||||
|
||||
if diskUsageDetails != None:
|
||||
if diskUsageDetails[1] > 100:
|
||||
diskUsageDetails[1] = 100
|
||||
|
||||
Data['diskUsage'] = diskUsageDetails[1]
|
||||
Data['diskInMB'] = diskUsageDetails[0]
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
else:
|
||||
Data['diskUsage'] = 0
|
||||
Data['diskInMB'] = 0
|
||||
Data['diskInMBTotal'] = website.package.diskSpace
|
||||
|
||||
return render(request, 'emailMarketing/website.html', Data)
|
||||
else:
|
||||
return render(request, 'emailMarketing/website.html',
|
||||
{"error": 1, "domain": "This domain does not exists."})
|
||||
@@ -454,6 +454,23 @@ WantedBy=multi-user.target"""
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def emailMarketingMigrationsa():
|
||||
try:
|
||||
os.chdir('/usr/local/CyberCP')
|
||||
try:
|
||||
command = "python manage.py makemigrations emailMarketing"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
command = "python manage.py migrate emailMarketing"
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def enableServices():
|
||||
try:
|
||||
@@ -530,6 +547,11 @@ WantedBy=multi-user.target"""
|
||||
if items.find('pluginHolder') > -1:
|
||||
pluginCheck = 0
|
||||
|
||||
emailMarketing = 1
|
||||
for items in data:
|
||||
if items.find('emailMarketing') > -1:
|
||||
emailMarketing = 0
|
||||
|
||||
|
||||
Upgrade.stdOut('Restoring settings file!')
|
||||
|
||||
@@ -541,6 +563,8 @@ WantedBy=multi-user.target"""
|
||||
writeToFile.writelines(items)
|
||||
if pluginCheck == 1:
|
||||
writeToFile.writelines(" 'pluginHolder',\n")
|
||||
if emailMarketing == 1:
|
||||
writeToFile.writelines(" 'emailMarketing',\n")
|
||||
if Version.currentVersion == '1.6':
|
||||
writeToFile.writelines(" 'emailPremium',\n")
|
||||
else:
|
||||
@@ -560,6 +584,16 @@ WantedBy=multi-user.target"""
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
@staticmethod
|
||||
def installPYDNS():
|
||||
try:
|
||||
command = "pip install pydns"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
except OSError, msg:
|
||||
Upgrade.stdOut(str(msg) + " [installPYDNS]")
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def installTLDExtract():
|
||||
try:
|
||||
@@ -726,7 +760,7 @@ WantedBy=multi-user.target"""
|
||||
os._exit(0)
|
||||
|
||||
##
|
||||
|
||||
Upgrade.installPYDNS()
|
||||
Upgrade.downloadAndUpgrade(Version, versionNumbring)
|
||||
|
||||
|
||||
@@ -737,6 +771,7 @@ WantedBy=multi-user.target"""
|
||||
##
|
||||
|
||||
Upgrade.mailServerMigrations()
|
||||
Upgrade.emailMarketingMigrationsa()
|
||||
|
||||
##
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import randomPassword as randomPassword
|
||||
import hashlib
|
||||
from mysqlUtilities import mysqlUtilities
|
||||
from plogical import hashPassword
|
||||
from emailMarketing.emACL import emACL
|
||||
|
||||
class WebsiteManager:
|
||||
def __init__(self, domain = None, childDomain = None):
|
||||
@@ -483,7 +484,9 @@ class WebsiteManager:
|
||||
return ACLManager.loadError()
|
||||
|
||||
Data = {}
|
||||
marketingStatus = emACL.checkIfEMEnabled(admin.userName)
|
||||
|
||||
Data['marketingStatus'] = marketingStatus
|
||||
Data['ftpTotal'] = website.package.ftpAccounts
|
||||
Data['ftpUsed'] = website.users_set.all().count()
|
||||
|
||||
|
||||
@@ -819,8 +819,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="example-box-wrapper">
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Files" %}
|
||||
@@ -940,6 +939,78 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if marketingStatus %}
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div style="border-radius: 25px;border-color:#3498db" class="content-box">
|
||||
<h3 class="content-box-header bg-blue">
|
||||
{% trans "Email Marketing" %}
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a id="emailLists" target="_blank" title="{% trans 'Create Lists' %}">
|
||||
<img src="{% static 'emailMarketing/mailing.png' %}">
|
||||
</a>
|
||||
<a id="emailListsChild" target="_blank" title="{% trans 'Create Lists' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Create Lists" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a id="manageLists" target="_blank" title="{% trans 'Manage Lists' %}">
|
||||
<img src="{% static 'emailMarketing/checklist.png' %}">
|
||||
</a>
|
||||
<a id="manageListsChild" target="_blank" title="{% trans 'Manage Lists' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Manage Lists" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a id="manageSMTPHosts" target="_blank" title="{% trans 'SMTP Hosts' %}">
|
||||
<img src="{% static 'emailMarketing/post-office.png' %}">
|
||||
</a>
|
||||
<a id="manageSMTPHostsChild" target="_blank" title="{% trans 'SMTP Hosts' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "SMTP Hosts" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a id="composeEmails" target="_blank" title="{% trans 'Compose Message' %}">
|
||||
<img src="{% static 'emailMarketing/compose.png' %}">
|
||||
</a>
|
||||
<a id="composeEmailsChild" target="_blank" title="{% trans 'Compose Message' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Compose" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3" style="margin-bottom: 2%;">
|
||||
|
||||
<a id="sendEmailsPage" target="_blank" title="{% trans 'Send Emails' %}">
|
||||
<img src="{% static 'emailMarketing/paper-plane.png' %}">
|
||||
</a>
|
||||
<a id="sendEmailsPageChild" target="_blank" title="{% trans 'Send Emails' %}">
|
||||
<span style='font-size: 21px;font-family: "Times New Roman", Times, serif; padding-left: 2%'>{% trans "Send Emails" %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user