diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 7b1c21a37..b5c4726d2 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -60,7 +60,6 @@ } - {% block title %}Page Title{% endblock %} @@ -73,20 +72,7 @@ - - - - - - - - - - - - - - + @@ -877,6 +863,9 @@
  • {% trans "Email Marketing" %}
  • +
  • {% trans "MailScanner" %} +
  • diff --git a/baseTemplate/urls.py b/baseTemplate/urls.py index 31a0ed8c5..b904ed09b 100755 --- a/baseTemplate/urls.py +++ b/baseTemplate/urls.py @@ -13,6 +13,4 @@ urlpatterns = [ url(r'^UpgradeStatus',views.upgradeStatus, name='UpgradeStatus'), url(r'^upgradeVersion',views.upgradeVersion, name='upgradeVersion'), - - ] \ No newline at end of file diff --git a/emailPremium/templates/emailPremium/MailScanner.html b/emailPremium/templates/emailPremium/MailScanner.html new file mode 100755 index 000000000..5812b68e9 --- /dev/null +++ b/emailPremium/templates/emailPremium/MailScanner.html @@ -0,0 +1,106 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "MailScanner - CyberPanel" %}{% endblock %} +{% block content %} + + {% load static %} + {% get_current_language as LANGUAGE_CODE %} + + + +
    +
    +

    {% trans "MailScanner" %}

    +

    {% trans "Install/Access MailScanner" %}

    +
    + +
    +
    +

    + {% trans "SpamAssassin" %} +

    + +
    +
    + + {% if checkIfMailScannerInstalled == 0 %} + +
    +

    {% trans "MailScanner is not installed " %} +

    + +
    + + + +
    + +
    + +
    +

    {% trans "Failed to start installation, Error message: " %} {$ errorMessage + $}

    +
    + +
    +

    {% trans "Could not connect. Please refresh this page." %}

    +
    + +
    +

    {% trans "Installation failed." %} {$ errorMessage $}

    +
    + +
    +

    {% trans "SpamAssassin successfully installed, refreshing page in 3 seconds.." %}

    +
    +
    +
    + + +
    + +
    +
    +
    +

    {% trans "Winter is coming, but so is SpamAssassin." %} + +

    +
    +
    + +
    +
    +
    +
    + + + + {% else %} + +
    +

    {% trans "MailScanner is not installed " %} +

    + +
    + + {% endif %} + + +
    +
    +
    +
    + + +
    + + +{% endblock %} diff --git a/emailPremium/urls.py b/emailPremium/urls.py index 50bff1050..f7d511b59 100755 --- a/emailPremium/urls.py +++ b/emailPremium/urls.py @@ -38,6 +38,7 @@ urlpatterns = [ url(r'^fetchMessage$', views.fetchMessage, name='fetchMessage'), url(r'^flushQueue$', views.flushQueue, name='flushQueue'), url(r'^delete$', views.delete, name='delete'), + url(r'^MailScanner$', views.MailScanner, name='MailScanner'), url(r'^(?P(.*))$', views.emailLimits, name='emailLimits'), diff --git a/emailPremium/views.py b/emailPremium/views.py index 54478c894..8a05c968c 100755 --- a/emailPremium/views.py +++ b/emailPremium/views.py @@ -1166,4 +1166,26 @@ def delete(request): except KeyError as msg: dic = {'status': 0, 'error_message': str(msg)} json_data = json.dumps(dic) - return HttpResponse(json_data) \ No newline at end of file + return HttpResponse(json_data) + +## MailScanner + +def MailScanner(request): + try: + userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadError() + + checkIfMailScannerInstalled = 0 + + if mailUtilities.checkIfMailScannerInstalled() == 1: + checkIfMailScannerInstalled = 1 + + return render(request, 'emailPremium/MailScanner.html',{'checkIfMailScannerInstalled': checkIfMailScannerInstalled}) + + except KeyError: + return redirect(loadLoginPage) \ No newline at end of file diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 812b5317a..a635c71ba 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -666,6 +666,22 @@ milter_default_action = accept str(msg) + " [savePolicyServerStatus]") print("0," + str(msg)) + @staticmethod + def checkIfMailScannerInstalled(): + try: + + path = "/usr/local/CyberCP/public/mailscanner" + + if os .path.exists(path): + return 1 + else: + return 0 + + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile( + str(msg) + " [checkIfMailScannerInstalled]") + return 0 + def main():