]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/fusionforge/themeinfo.php
No <h1>
[SourceForge/phpwiki.git] / themes / fusionforge / themeinfo.php
1 <?php
2 // Avoid direct call to this file.
3 // PHPWIKI_VERSION is defined in lib/prepend.php
4 if (!defined('PHPWIKI_VERSION')) {
5     header("Location: /");
6     exit;
7 }
8
9 // $Id$;
10
11 require_once('lib/WikiTheme.php');
12 require_once('themes/wikilens/themeinfo.php');
13
14 class WikiTheme_fusionforge extends WikiTheme_Wikilens {
15
16     function header() {
17         global $HTML, $group_id, $group_public_name, $request, $project;
18
19         $pagename = $request->getArg('pagename');
20
21         $submenu = Template('navbar');
22
23         $domain = textdomain(NULL);
24         textdomain('fusionforge');
25
26         //group is private
27         if (!$project->isPublic()) {
28             //if it's a private group, you must be a member of that group
29             if (RBAC) {
30                 session_require_perm('project_read', $group_id);
31             } else {
32                 session_require(array('group'=>$group_id));
33             }
34         }
35
36         //for dead projects must be member of admin project
37         if (!$project->isActive()) {
38             //only SF group can view non-active, non-holding groups
39             session_require_global_perm('forge_admin');
40         }
41
42         $HTML->header(array('h1' => '',
43                             'title'=> $group_public_name._(": ").htmlspecialchars($pagename),
44                             'group' => $group_id,
45                             'toptab' => 'wiki',
46                             'submenu' => $submenu->asXML()
47                            )
48                      );
49
50         // Display a warning banner for internal users when the wiki is opened
51         // to external users.
52         if (method_exists($project, 'getIsExternal') && $project->getIsExternal()) {
53             $external_user = false;
54             if (session_loggedin()) {
55                $user = session_get_user();
56                $external_user = $user->getIsExternal();
57             }
58             if (!$external_user) {
59                 $page = $request->getPage();
60                 if ($page->get('external')) {
61                     $external_msg = _("This page is external.");
62                 }
63                 echo $HTML->warning_msg(_("This project is shared with third-party users (non Alcatel-Lucent users).") .
64                                         (isset($external_msg) ? ' ' . $external_msg : ''));
65             }
66         }
67         textdomain($domain);
68     }
69
70     function footer() {
71         global $HTML;
72
73         $domain = textdomain(NULL);
74         textdomain('fusionforge');
75
76         $HTML->footer(array());
77
78         textdomain($domain);
79     }
80
81     function initGlobals() {
82         global $request;
83         static $already = 0;
84         if (!$already) {
85             $script_url = deduce_script_name();
86             $script_url .= '/'. $GLOBALS['group_name'] ;
87             if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug']))
88                 $script_url .= ("?start_debug=".$_GET['start_debug']);
89             $folderArrowPath = dirname($this->_findData('images/folderArrowLoading.gif'));
90             $pagename = $request->getArg('pagename');
91             $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikilens.js"))));
92             $js = "var data_path = '". javascript_quote_string(DATA_PATH) ."';\n"
93             // Temp remove pagename because of XSS warning
94             //  ."var pagename  = '". javascript_quote_string($pagename) ."';\n"
95                 ."var script_url= '". javascript_quote_string($script_url) ."';\n"
96                 ."var stylepath = data_path+'/".javascript_quote_string($this->_theme)."/';\n"
97                 ."var folderArrowPath = '".javascript_quote_string($folderArrowPath)."';\n"
98                 ."var use_path_info = " . (USE_PATH_INFO ? "true" : "false") .";\n";
99             $this->addMoreHeaders(JavaScript($js));
100             $already = 1;
101         }
102     }
103     function load() {
104
105         $this->initGlobals();
106
107         /**
108          * The Signature image is shown after saving an edited page. If this
109          * is set to false then the "Thank you for editing..." screen will
110          * be omitted.
111          */
112
113         $this->addImageAlias('signature', WIKI_NAME . "Signature.png");
114         // Uncomment this next line to disable the signature.
115         $this->addImageAlias('signature', false);
116
117         /*
118          * Link icons.
119          */
120         $this->setLinkIcon('http');
121         $this->setLinkIcon('https');
122         $this->setLinkIcon('ftp');
123         $this->setLinkIcon('mailto');
124
125         $this->setButtonSeparator("");
126
127         /**
128          * WikiWords can automatically be split by inserting spaces between
129          * the words. The default is to leave WordsSmashedTogetherLikeSo.
130          */
131         $this->setAutosplitWikiWords(false);
132
133         /**
134          * Layout improvement with dangling links for mostly closed wiki's:
135          * If false, only users with edit permissions will be presented the
136          * special wikiunknown class with "?" and Tooltip.
137          * If true (default), any user will see the ?, but will be presented
138          * the PrintLoginForm on a click.
139          */
140         $this->setAnonEditUnknownLinks(false);
141
142         /*
143          * You may adjust the formats used for formatting dates and times
144          * below.  (These examples give the default formats.)
145          * Formats are given as format strings to PHP strftime() function See
146          * http://www.php.net/manual/en/function.strftime.php for details.
147          * Do not include the server's zone (%Z), times are converted to the
148          * user's time zone.
149          */
150         $this->setDateFormat("%d %B %Y");
151         $this->setTimeFormat("%H:%M");
152     }
153
154     /* Callback when a new user creates or edits a page */
155     function CbNewUserEdit (&$request, $userid) {
156         $content = "{{Template/UserPage}}\n\n----\n[[CategoryWiki user]]";
157         $dbi =& $request->_dbi;
158         $page = $dbi->getPage($userid);
159         $page->save($content, WIKIDB_FORCE_CREATE, array('author' => $userid));
160         $dbi->touch();
161     }
162 }
163
164 $WikiTheme = new WikiTheme_fusionforge('fusionforge');
165
166 // Local Variables:
167 // mode: php
168 // tab-width: 8
169 // c-basic-offset: 4
170 // c-hanging-comment-ender-p: nil
171 // indent-tabs-mode: nil
172 // End:
173 ?>