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