diff --git a/wiki/patches/moin-changes-show-hostname.patch b/wiki/patches/moin-changes-show-hostname.patch new file mode 100644 index 00000000..822474f7 --- /dev/null +++ b/wiki/patches/moin-changes-show-hostname.patch @@ -0,0 +1,32 @@ +diff -urN MoinMoin/user.py b/MoinMoin/user.py +--- a/MoinMoin/user.py 2008-07-14 21:11:24.000000000 +0200 ++++ b/MoinMoin/user.py 2009-10-11 01:11:52.000000000 +0200 +@@ -27,7 +27,9 @@ + from MoinMoin import config, caching, wikiutil, i18n, events + from MoinMoin.util import timefuncs, filesys, random_string + from MoinMoin.wikiutil import url_quote_plus +- ++### HACK SAUVAGE 1/2 ++import socket ++### FIN HACK 1/2 + + def getUserList(request): + """ Get a list of all (numerical) user IDs. +@@ -1023,7 +1025,16 @@ + if self.name: + return self.wikiHomeLink() + else: +- return self.host() ++ ### HACK SAUVAGE 2/2 ++ # return self.host() ++ try: ++ hostname = socket.gethostbyaddr(self.host())[0] ++ except socket.herror: ++ hostname = self.host() ++ if (hostname+'.').split('.', 1)[1] in ['crans.org.', 'wifi.crans.org.']: ++ hostname = hostname.split('.',1)[0] ++ return hostname ++ ### FIN HACK 2/2 + + def generate_recovery_token(self): + key = random_string(64, "abcdefghijklmnopqrstuvwxyz0123456789") diff --git a/wiki/patches/moin-more-icons.patch b/wiki/patches/moin-more-icons.patch new file mode 100644 index 00000000..45fe951e --- /dev/null +++ b/wiki/patches/moin-more-icons.patch @@ -0,0 +1,88 @@ +diff -urN MoinMoin/config/__init__.py b/MoinMoin/config/__init__.py +--- a/MoinMoin/config/__init__.py 2008-05-19 20:50:17.000000000 +0200 ++++ b/MoinMoin/config/__init__.py 2009-11-14 13:39:29.000000000 +0100 +@@ -1,4 +1,4 @@ +-# -*- coding: iso-8859-1 -*- ++# -*- coding: utf-8 -*- + """ + MoinMoin - site-wide configuration defaults (NOT per single wiki!) + +@@ -79,5 +79,7 @@ + 'notes', + ] + +-smileys = (r"X-( :D <:( :o :( :) B) :)) ;) /!\ (!) :-? :\ >:> |) " + +- r":-( :-) B-) :-)) ;-) |-) (./) {OK} {X} {i} {1} {2} {3} {*} {o}").split() ++smileys = (ur"X-( :D <:( :o :( :) B) :)) ;) /!\ (!) :-? :\ >:> |) " + ++ ur":-( :-) B-) :-)) ;-) |-) (./) {OK} {X} {i} {1} {2} {3} {*} {o} "+ ++ u"{~} {8} {A} {á¹½} " + ++ u"{da} {de} {en} {es} {fi} {fr} {it} {ja} {ko} {nl} {pt} {sv} {us} {zh}").split() +diff -urN MoinMoin/theme/__init__.py b/MoinMoin/theme/__init__.py +--- a/MoinMoin/theme/__init__.py 2008-07-05 22:21:26.000000000 +0200 ++++ b/MoinMoin/theme/__init__.py 2009-11-14 13:41:01.000000000 +0100 +@@ -1,4 +1,4 @@ +-# -*- coding: iso-8859-1 -*- ++# -*- coding: utf-8 -*- + """ + MoinMoin - Theme Package + +@@ -117,6 +117,29 @@ + # try {*}{*}{o} + '{*}': ("{*}", 'star_on.png', 15, 15), + '{o}': ("{o}", 'star_off.png', 15, 15), ++ ++ ### HACK SAUVAGE 1/2 ++ '{8}': ("{8}", 'tux16.png', 16, 16), ++ '{~}': ("{~}", 'win16.png', 16, 16), ++ u'{á¹½}': (u'{á¹½}', 'vista16.png', 16, 16), ++ '{A}': ('{A}', 'apple.png', 16, 16), ++ ++ '{da}': ('{da}', 'flag-da.png', 18, 12), ++ '{de}': ('{de}', 'flag-de.png', 18, 12), ++ '{en}': ('{en}', 'flag-en.png', 18, 12), ++ '{es}': ('{es}', 'flag-es.png', 18, 12), ++ '{fi}': ('{fi}', 'flag-fi.png', 18, 12), ++ '{fr}': ('{fr}', 'flag-fr.png', 18, 12), ++ '{it}': ('{it}', 'flag-it.png', 18, 12), ++ '{ja}': ('{ja}', 'flag-ja.png', 18, 12), ++ '{ko}': ('{ko}', 'flag-ko.png', 18, 12), ++ '{nl}': ('{nl}', 'flag-nl.png', 18, 12), ++ '{pt}': ('{pt}', 'flag-pt.png', 18, 12), ++ '{sv}': ('{sv}', 'flag-sv.png', 18, 12), ++ '{us}': ('{us}', 'flag-us.png', 18, 12), ++ '{zh}': ('{zh}', 'flag-zh.png', 18, 12) ++ ### FIN HACK 1/2 ++ + } + del _ + +@@ -532,7 +555,9 @@ + except KeyError, err: + alt = 'KeyError: %s' % str(err) + alt = self.request.getText(alt) +- tag = self.request.formatter.image(src=img, alt=alt, width=w, height=h, **kw) ++ #### HACK SAUVAGE 2/2 ++ tag = self.request.formatter.image(src=img, alt=alt, **kw) ++ #### FIN HACK 2/2 + return tag + + def make_iconlink(self, which, d): +@@ -1577,10 +1602,18 @@ + + meta_keywords = request.getPragma('keywords') + meta_desc = request.getPragma('description') ++ meta_scripts = request.getPragma('scripts') ++ meta_stylesheets = request.getPragma('stylesheets') + if meta_keywords: + user_head.append('\n' % wikiutil.escape(meta_keywords, 1)) + if meta_desc: + user_head.append('\n' % wikiutil.escape(meta_desc, 1)) ++ if meta_scripts: ++ for meta_script in meta_scripts.split(): ++ user_head.append('\n' % wikiutil.escape(meta_script, 1)) ++ if meta_stylesheets: ++ for meta_stylesheet in meta_stylesheets.split(): ++ user_head.append('' % wikiutil.escape(meta_stylesheet, 1)) + + # search engine precautions / optimization: + # if it is an action or edit/search, send query headers (noindex,nofollow): diff --git a/wiki/patches/moin1.9.2-categoriepagepublique.patch b/wiki/patches/moin1.9.2-categoriepagepublique.patch new file mode 100644 index 00000000..c4cddd35 --- /dev/null +++ b/wiki/patches/moin1.9.2-categoriepagepublique.patch @@ -0,0 +1,104 @@ +--- a/MoinMoin/security/__init__.py 2010-02-28 16:28:46.000000000 +0100 ++++ b/MoinMoin/security/__init__.py 2010-06-03 18:10:16.000000000 +0200 +@@ -24,6 +24,12 @@ + from MoinMoin import wikiutil, user + from MoinMoin.Page import Page + ++### HACK SAUVAGE 1/5 ++import sys ++sys.path.append('/usr/scripts/gestion/') ++from iptools import is_crans ++### FIN HACK 1/5 ++ + ############################################################################# + ### Basic Permissions Interface -- most features enabled by default + ############################################################################# +@@ -251,7 +257,10 @@ + Default: ["read", "write", "delete", "admin"] + ''' + +- special_users = ["All", "Known", "Trusted"] # order is important ++ #special_users = ["All", "Known", "Trusted"] # order is important ++ ### HACK SAUVAGE 2/5 ++ special_users = ["All", "Known", "Trusted", "Crans", "NoCrans"] # order is important ++ ### FIN HACK 2/5 + + def __init__(self, cfg, lines=[]): + """Initialize an ACL, starting from . +@@ -343,6 +352,10 @@ + return acl_lines + + def _special_All(self, request, name, dowhat, rightsdict): ++ ### HACK SAUVAGE 3/5 ++ if dowhat == "read" and is_page_public(request): ++ return True ++ ### FIN HACK 3/5 + return rightsdict.get(dowhat) + + def _special_Known(self, request, name, dowhat, rightsdict): +@@ -365,6 +378,29 @@ + return rightsdict.get(dowhat) + return None + ++ ### HACK SAUVAGE 4/5 ++ def _requete_interne(self, request): ++ try: ++ if is_crans(request.remote_addr): ++ return True ++ except: ++ pass ++ ++ return False ++ ++ def _special_Crans(self, request, name, dowhat, rightsdict): ++ if self._requete_interne(request): ++ return rightsdict.get(dowhat) ++ return None ++ ++ def _special_NoCrans(self, request, name, dowhat, rightsdict): ++ if dowhat == "read" and is_page_public(request): ++ return True ++ if not self._requete_interne(request): ++ return rightsdict.get(dowhat) ++ return None ++ ### FIN HACK 4/5 ++ + def __eq__(self, other): + return self.acl_lines == other.acl_lines + +@@ -456,3 +492,9 @@ + pi, dummy = wikiutil.get_processing_instructions(text) + acl_lines = [args for verb, args in pi if verb == 'acl'] + return AccessControlList(request.cfg, acl_lines) ++ ++### HACK SAUVAGE 5/5 ++def is_page_public(request): ++ ## On recherche si la page est publique ++ return u'CatégoriePagePublique' in request.page.getCategories(request) ++### FIN HACK 5/5 +--- a/MoinMoin/Page.py 2010-02-28 16:28:45.000000000 +0100 ++++ b/MoinMoin/Page.py 2010-06-03 18:07:14.000000000 +0200 +@@ -1082,8 +1082,10 @@ + if emit_headers: + request.content_type = "%s; charset=%s" % (self.output_mimetype, self.output_charset) + if page_exists: +- if not request.user.may.read(self.page_name): ++ ### HACK SAUVAGE 1/2 ++ if not request.user.may.read(self.page_name) and not request.mode_getpagelinks: + request.status_code = 403 ++ ### FIN HACK 1/2 + else: + request.status_code = 200 + if not request.cacheable: +@@ -1177,8 +1179,10 @@ + if not send_special: + if not page_exists and not body: + special = 'missing' +- elif not request.user.may.read(self.page_name): ++ ### HACK SAUVAGE 2/2 ++ elif not request.user.may.read(self.page_name) and not request.mode_getpagelinks: + special = 'denied' ++ ### FIN HACK 2/2 + + # if we have a special page, output it, unless + # - we should only output content (this is for say the pagelinks formatter) diff --git a/wiki/patches/moin1.9.2-theme-vhost.patch b/wiki/patches/moin1.9.2-theme-vhost.patch new file mode 100644 index 00000000..dc8efeb6 --- /dev/null +++ b/wiki/patches/moin1.9.2-theme-vhost.patch @@ -0,0 +1,31 @@ +--- a/MoinMoin/config/multiconfig.py 2010-04-03 16:28:21.000000000 +0200 ++++ b/MoinMoin/config/multiconfig.py 2010-06-03 18:27:43.000000000 +0200 +@@ -855,6 +855,7 @@ + + ('theme_default', 'modernized', + "the name of the theme that is used by default (see HelpOnThemes)"), ++ ('theme_vhost', {}, "If a key matches the vhost, forces its value as the theme."), + ('theme_force', False, + "if True, do not allow to change the theme"), + +--- a/MoinMoin/web/contexts.py 2010-06-03 18:29:00.000000000 +0200 ++++ b/MoinMoin/web/contexts.py 2010-06-03 18:42:47.000000000 +0200 +@@ -10,7 +10,7 @@ + + import time, inspect, StringIO, sys, warnings + +-from werkzeug import Headers, http_date, create_environ, redirect, abort ++from werkzeug import Headers, http_date, create_environ, redirect, abort, get_host + from werkzeug.exceptions import Unauthorized, NotFound + + from MoinMoin import i18n, error, user, config, wikiutil +@@ -184,6 +184,9 @@ + theme_name = self.cfg.theme_default + else: + theme_name = self.user.theme_name ++ ### HACK SAUVAGE 1/1 ++ theme_name = self.cfg.theme_vhost.get(get_host(self.environ), theme_name) ++ ### FIN HACK 1/1 + load_theme_fallback(self, theme_name) + +