]> git.ipfire.org Git - ipfire.org.git/commitdiff
Drop advertisement code
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Jul 2018 17:50:18 +0000 (18:50 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Jul 2018 17:50:18 +0000 (18:50 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/ads.py [deleted file]
src/backend/base.py
src/templates/modules/ads/download-splash.html [deleted file]

index 05e5dc1b472483f81d1866123e7098f94e96b8dd..e16a9d2a26028e332167927c24877aaac4896ff9 100644 (file)
@@ -49,7 +49,6 @@ CLEANFILES += \
 backend_PYTHON = \
        src/backend/__init__.py \
        src/backend/accounts.py \
-       src/backend/ads.py \
        src/backend/base.py \
        src/backend/blog.py \
        src/backend/countries.py \
diff --git a/src/backend/ads.py b/src/backend/ads.py
deleted file mode 100644 (file)
index f7abe58..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-
-from __future__ import division
-
-import datetime
-import textile
-
-from misc import Object
-
-class Advertisements(Object):
-       def get(self, where=None):
-               query = "SELECT * FROM advertisements \
-                       WHERE NOW() BETWEEN date_start AND date_end AND published = %s"
-               args = [True]
-
-               if where:
-                       query += " AND location = %s"
-                       args.append(where)
-
-               query += " ORDER BY RANDOM() LIMIT 1"
-
-               ad = self.db.get(query, *args)
-               if ad:
-                       return Advert(self.backend, ad.id, ad)
-
-
-class Advert(Object):
-       def __init__(self, backend, id, data=None):
-               Object.__init__(self, backend)
-
-               self.id = id
-               self.__data = data
-
-       @property
-       def data(self):
-               if self.__data is None:
-                       self.__data = self.db.get("SELECT * FROM advertisements WHERE id = %s", self.id)
-                       assert self.__data
-
-               return self.__data
-
-       @property
-       def company(self):
-               return self.data.company
-
-       @property
-       def text(self):
-               return self.data.text
-
-       @property
-       def url(self):
-               return self.data.url
-
-       @property
-       def who(self):
-               return """<a href="%s" target="_blank">%s</a>""" % (self.url, self.text or self.company)
-
-       def update_impressions(self):
-               self.db.execute("UPDATE advertisements SET impressions = impressions + 1 WHERE id = %s", self.id)
index 19e6384fc3daf96c89a753e03455848d47e225d3..94d7d49d4743047999fa3b8dc8e571c1ad26d618 100644 (file)
@@ -4,7 +4,6 @@ import ConfigParser as configparser
 import StringIO
 
 import accounts
-import ads
 import database
 import geoip
 import fireinfo
@@ -46,7 +45,6 @@ class Backend(object):
 
                # Initialize backend modules.
                self.accounts = accounts.Accounts(self)
-               self.advertisements = ads.Advertisements(self)
                self.downloads = mirrors.Downloads(self)
                self.geoip = geoip.GeoIP(self)
                self.fireinfo = fireinfo.Fireinfo(self)
diff --git a/src/templates/modules/ads/download-splash.html b/src/templates/modules/ads/download-splash.html
deleted file mode 100644 (file)
index 7659621..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="alert alert-info ac">
-       {{ _("This download is sponsored by") }}
-       {% raw ad.who %}
-</div>