1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Private mode, a plugin for Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2008-2010 Osku and contributors |
---|
7 | # |
---|
8 | # Licensed under the GPL version 2.0 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
11 | # |
---|
12 | # -- END LICENSE BLOCK ------------------------------------ |
---|
13 | |
---|
14 | if (!defined('DC_RC_PATH')) { return; } |
---|
15 | |
---|
16 | if (version_compare(DC_VERSION,'2.2-beta','<')) { return; } |
---|
17 | |
---|
18 | require dirname(__FILE__).'/_widgets.php'; |
---|
19 | |
---|
20 | $core->blog->settings->addNamespace('private'); |
---|
21 | |
---|
22 | #Rewrite Feeds with new URL and representation |
---|
23 | $feeds_url = new ArrayObject(array('feed','tag_feed')); |
---|
24 | $core->callBehavior('initFeedsPrivateMode',$feeds_url); |
---|
25 | |
---|
26 | if ($core->blog->settings->private->private_flag) |
---|
27 | { |
---|
28 | $privatefeed = md5($core->blog->settings->private->blog_private_pwd); |
---|
29 | |
---|
30 | #Obfuscate all feeds URL |
---|
31 | foreach ($core->url->getTypes() as $k => $v) { |
---|
32 | if (in_array($k,(array)$feeds_url)) { |
---|
33 | $core->url->register( |
---|
34 | $k, |
---|
35 | sprintf('%s/%s',$privatefeed,$v['url']), |
---|
36 | sprintf('^%s/%s/(.+)$',$privatefeed,$v['url']), |
---|
37 | $v['handler'] |
---|
38 | ); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | $core->url->register('pubfeed', |
---|
43 | 'feed', |
---|
44 | '^feed/(.+)$', |
---|
45 | array('urlPrivate','publicFeed') |
---|
46 | ); |
---|
47 | |
---|
48 | #Trick.. |
---|
49 | $core->url->register('xslt','feed/rss2/xslt','^feed/rss2/xslt$',array('urlPrivate','feedXslt')); |
---|
50 | |
---|
51 | } |
---|
52 | ?> |
---|