Revert "Use the BSTemplate::$preParseHook for global templates"
[bugdar.git] / includes / functions.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 // ###################################################################
23 /**
24 * Constructs HTML code <select>s from an array. You use they keys when
25 * you need to access a multi-dimensional array of data.
26 *
27 * @access public
28 *
29 * @param string HTML name of the select
30 * @param array Array of <option>s
31 * @param integer ID of the selected item, 0 for none
32 * @param string Name of the index where values are stored in the $array
33 * @param string Name of the iddex where the labels are stored in $array
34 * @param bool Value of the blank option, FALSE turns it off
35 * @param bool Construct a multiple-selection <select> menu and append "[]" to the end of the name
36 *
37 * @return string Constructed HTML output
38 */
39 function construct_option_select($name, $array, $selected = 0, $valuekey = '', $labelkey = '', $includenil = false, $multiple = false)
40 {
41 global $bugsys;
42
43 if ($multiple)
44 {
45 $selected = explode(',', $selected);
46 }
47
48 // if we're not working on a boolean false, we use it for the value (allows -1 and 0)
49 if ($includenil !== false)
50 {
51 $opts[] = '<option value="' . $includenil . '"' . ((!$selected OR (is_array($selected) AND in_array($includenil, $selected))) ? ' selected="selected"' : '') . '> ---------</option>';
52 }
53 foreach ($array AS $value => $label)
54 {
55 $newval = ($valuekey ? $label["$valuekey"] : $value);
56 $newlab = ($labelkey ? $label["$labelkey"] : $label);
57 $opts[] = '<option value="' . $newval . '"' . (($selected == $newval OR (is_array($selected) AND in_array($newval, $selected))) ? ' selected="selected"' : '') . '>' . $newlab . '</option>';
58 }
59 return '<select class="input" name="' . $name . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" size="' . (sizeof($array) < 8 ? sizeof($array) + 1 : 8) . '"' : '') . '>' . implode("\n\t", $opts) . "\r</select>";
60 }
61
62 // ################### Start construct_user_display ##################
63 // $userinfo needs userid, email, displayname, and showemail
64 function construct_user_display($userinfo, $html = true)
65 {
66 global $bugsys;
67
68 if (!$userinfo['userid'])
69 {
70 $userinfo['displayname'] = T('Guest');
71 $userinfo['showemail'] = false;
72 }
73
74 if ($html)
75 {
76 $tpl = new BSTemplate('username_display');
77 $tpl->vars = array('userinfo' => $userinfo);
78 $username = $tpl->evaluate()->getTemplate();
79 }
80 else
81 {
82 if ($userinfo['showemail'])
83 {
84 $username = sprintf(T('%1$s &lt;%2$s&gt;'), $userinfo['displayname'], $userinfo['email']);
85 }
86 else
87 {
88 $username = $userinfo['displayname'];
89 }
90 }
91
92 return $username;
93 }
94
95 // ######################## Start can_perform ########################
96 // short-hand for bitwise &
97 function can_perform($bitmask, $productid = 0, $userinfo = null)
98 {
99 global $bugsys;
100
101 // masks that aren't product-specific
102 static $inspecific = array(
103 'cansearch',
104 'canbeassignedto',
105 'canadminpanel',
106 'canadminbugs',
107 'canadminfields',
108 'canadminversions',
109 'canadminusers',
110 'canadmingroups',
111 'canadmintools'
112 );
113
114 if ($userinfo == null)
115 {
116 $userinfo =& bugdar::$userinfo;
117 }
118
119 $permissions =& bugdar::$datastore['permission'];
120
121 if (!isset($bugsys->permissions["$bitmask"]))
122 {
123 trigger_error('Invalid bitmask "' . $bitmask . '" specified for can_perform() [includes/functions.php]', E_USER_WARNING);
124 }
125
126 if (!$userinfo['permissions'])
127 {
128 $userinfo['permissions'] = FetchUserPermissions($userinfo);
129 }
130
131 if ($productid AND !in_array($bitmask, $inspecific))
132 {
133 $verdict = (isset($permissions["$userinfo[usergroupid]"]["$productid"]) ? ($permissions["$userinfo[usergroupid]"]["$productid"] & $bugsys->permissions["$bitmask"]) : ($userinfo['permissions'] & $bugsys->permissions["$bitmask"]));
134
135 foreach ($userinfo['groupids'] AS $group)
136 {
137 if (isset($permissions["$group"]["$productid"]))
138 {
139 $verdict |= ($permissions["$group"]["$productid"] & $bugsys->permissions["$bitmask"]);
140 }
141 }
142 $bugsys->debug("verdict* on can_perform($bitmask, $productid, $userinfo[userid]) = $verdict");
143 return $verdict;
144 }
145
146 BSApp::debug("verdict on can_perform($bitmask, $productid, $userinfo[userid]) = " . ($userinfo['permissions'] & $bugsys->permissions["$bitmask"]));
147 return ($userinfo['permissions'] & $bugsys->permissions["$bitmask"]);
148 }
149
150 // ###################################################################
151 /**
152 * Runs through a given datastore item and creates a series of <select>
153 * options.
154 *
155 * @access public
156 *
157 * @param string Datastore name
158 * @param string Array index for the label
159 * @param string Array index for the value
160 * @param mixed The selected value(s)
161 * @param bool Include a blank option? TRUE will set a null value, FALSE turns it off, anything else is used as the value for the blank option
162 * @param bool Generate it using admin printers?
163 *
164 * @return string Unelss in admin mode, returns the constructed options
165 */
166 function construct_datastore_select($datastore, $labelname, $valuename, $selectedvalue = 0, $includeblank = false, $adminmode = false)
167 {
168 global $bugsys;
169
170 if ($adminmode)
171 {
172 global $admin;
173 }
174
175 $select = '';
176
177 if ($includeblank === true OR $includeblank !== false)
178 {
179 $newval = ($inclueblank === true ? '' : $includeblank);
180 if ($adminmode)
181 {
182 $admin->list_item('', '', ((!$selectedvalue OR (is_array($selectedvalue) AND in_array($newval, $selectedvalue))) ? true : false));
183 }
184 else
185 {
186 $label = '';
187 $value = $newval;
188 $selected = ((!$selectedvalue OR (is_array($selectedvalue) AND in_array($newval, $selectedvalue))) ? true : false);
189 eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";');
190 }
191 }
192
193 foreach (bugdar::$datastore["$datastore"] AS $item)
194 {
195 $label = $item["$labelname"];
196 $value = $item["$valuename"];
197 $selected = (($value == $selectedvalue OR (is_array($selectedvalue) AND in_array($value, $selectedvalue))) ? true : false);
198
199 if ($adminmode)
200 {
201 $admin->list_item($label, $value, $selected);
202 }
203 else
204 {
205 eval('$select .= "' . $bugsys->template->fetch('selectoption') . '";');
206 }
207 }
208
209 if (!$adminmode)
210 {
211 return $select;
212 }
213 }
214
215 // ################## Start construct_custom_fields ##################
216 function construct_custom_fields($bug = array(), $ignore21mask = false, $nodefault = false, $searchMode = false)
217 {
218 global $bugsys;
219 static $fields;
220
221 if (!is_array($fields))
222 {
223 $fields = array();
224 $fields_fetch = $bugsys->db->query("
225 SELECT bugfield.*, MAX(permission.mask) AS mask
226 FROM " . TABLE_PREFIX . "bugfield AS bugfield
227 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
228 ON (bugfield.fieldid = permission.fieldid)
229 WHERE (permission.mask = 2 OR permission.mask = 1)
230 AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
231 GROUP BY (bugfield.fieldid)
232 ");
233 foreach ($fields_fetch as $field)
234 {
235 $fields["$field[fieldid]"] = $field;
236 }
237 }
238
239 $fieldbits = array();
240
241 foreach ($fields AS $field)
242 {
243 if ($nodefault)
244 {
245 $field['defaultvalue'] = '';
246 }
247
248 if (!is_null($bug["custom$field[fieldid]"]))
249 {
250 $bugsys->debug("not null: $field[fieldid]");
251 $value = $bug["custom$field[fieldid]"];
252 }
253 else
254 {
255 $value = $field['defaultvalue'];
256 }
257
258 if ($ignore21mask AND $field['mask'] != 0)
259 {
260 $field['mask'] = 2;
261 }
262
263 if ($field['mask'] == 2)
264 {
265 switch ($field['type'])
266 {
267 case 'input_text':
268 eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_text') . '";');
269 break;
270
271 case 'input_checkbox':
272 $selected = ($value ? ' checked="checked"' : '');
273 eval('$tempfield = "' . $bugsys->template->fetch('bugfield_input_checkbox') . '";');
274 break;
275
276 case 'select_single':
277 $selects = unserialize($field['selects']);
278 $value = trim($value);
279
280 $options = '';
281
282 $id = -1;
283 $select = '';
284 if (!$field['usedefault'] AND !trim($value))
285 {
286 $selected = ' selected="selected"';
287 }
288 else
289 {
290 $selected = '';
291 }
292 eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";');
293
294 foreach ($selects AS $id => $select)
295 {
296 $selected = '';
297 $select = stripslashes(trim($select));
298 if ($select == $value)
299 {
300 $selected = ' selected="selected"';
301 }
302 else if ($field['usedefault'] AND $id == 0)
303 {
304 $selected = ' selected="selected"';
305 }
306 eval('$options .= "' . $bugsys->template->fetch('bugfield_select_single_option') . '";');
307 }
308 eval('$tempfield = "' . $bugsys->template->fetch('bugfield_select_single') . '";');
309 break;
310 }
311 }
312 else
313 {
314 $bugsys->debug('mask 1 processing');
315 if (is_null($bug["custom$field[fieldid]"]))
316 {
317 $bugsys->debug("is null: $field[fieldid]");
318 if ($field['type'] == 'select_single')
319 {
320 if ($field['usedefault'])
321 {
322 $temp = unserialize($field['selects']);
323 $value = trim($temp[0]);
324 }
325 else
326 {
327 $value = $bug["custom$field[fieldid]"];
328 }
329 }
330 else
331 {
332 $value = $field['defaultvalue'];
333 }
334 }
335 else
336 {
337 $value = $bug["custom$field[fieldid]"];
338 }
339
340 if ($field['type'] == 'input_checkbox')
341 {
342 $value = ($value ? 'True' : 'False');
343 }
344 $field['value'] = $value;
345 eval('$tempfield = "' . $bugsys->template->fetch('bugfield_static_text') . '";');
346 }
347 $fieldbits[] = $tempfield;
348 }
349
350 return $fieldbits;
351 }
352
353 // ###################################################################
354 /**
355 * This takes the bug API object and input data and then sanitizes, verifies,
356 * and processes the data for custom fields. If there are any errors,
357 * they are passed to the message reporter.
358 *
359 * @param object A BugAPI object
360 * @param object MessageReporter object
361 * @param bool If there are errors, add them to an errorbox format? If not, then display-on-encounter
362 * @param bool Search mode: don't change certain fields when they're 0 or empty
363 *
364 * @return mixed NULL if an ID is passed, string if bugid is NULL
365 */
366 function process_custom_fields(&$bugapi, &$msg, $errorbox = false, $searchMode = false)
367 {
368 global $bugsys;
369
370 if (!$inputdata)
371 {
372 $inputdata =& $bugsys->in;
373 }
374
375 $fields = $bugsys->db->query("
376 SELECT bugfield.*, MAX(permission.mask) AS mask
377 FROM " . TABLE_PREFIX . "bugfield AS bugfield
378 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
379 ON (bugfield.fieldid = permission.fieldid)
380 WHERE permission.mask = 2
381 AND permission.usergroupid IN (" . bugdar::$userinfo['usergroupid'] . (sizeof(bugdar::$userinfo['groupids']) != 0 ? ',' . implode(',', bugdar::$userinfo['groupids']) : '') . ")
382 GROUP BY (bugfield.fieldid)
383 ");
384 foreach ($fields as $field)
385 {
386 $fieldname = "custom$field[fieldid]";
387
388 if ($field['type'] == 'input_checkbox')
389 {
390 if ($searchMode AND intval($inputdata["$fieldname"]) == 0)
391 {
392 continue;
393 }
394 $bugapi->set($fieldname, intval($inputdata["$fieldname"]));
395 continue;
396 }
397 else if ($field['type'] == 'select_single')
398 {
399 $temp = unserialize($field['selects']);
400 $inputdata[$fieldname] = $temp[intval($inputdata["$fieldname"])] . ''; // make it a string so isset() doesn't catch
401 }
402
403 // field data wasn't passed, so skip it
404 if (!isset($inputdata["$fieldname"]))
405 {
406 continue;
407 }
408
409 if ($field['required'] AND empty($inputdata["$fieldname"]) AND !$searchMode)
410 {
411 $errorlist[] = sprintf(T('The field "%1$s" is a required.'), $field['name']);
412 continue;
413 }
414
415 if (!empty($field['regexmatch']))
416 {
417 if (!preg_match('#' . str_replace('#', '\#', $field['regexmatch']) . '#si', $inputdata["$fieldname"]))
418 {
419 $errorlist[] = sprintf(T('%1$s does not match the specified format'), $field['name']);
420 continue;
421 }
422 }
423
424 if (isset($inputdata["$fieldname"]))
425 {
426 if ($field['type'] == 'input_text')
427 {
428 if (empty($inputdata["$fieldname"]) AND $searchMode)
429 {
430 continue;
431 }
432 $bugapi->set($fieldname, $inputdata["$fieldname"]);
433 }
434 else
435 {
436 if (empty($inputdata["$fieldname"]))
437 {
438 if (!$searchMode)
439 {
440 $bugapi->set($fieldname, '');
441 }
442 continue;
443 }
444
445 $bugapi->set($fieldname, trim($inputdata["$fieldname"]));
446 }
447 }
448 }
449
450 if ($errorlist)
451 {
452 if ($errorbox)
453 {
454 foreach ($errorlist AS $err)
455 {
456 $msg->addError($err);
457 }
458 }
459 else
460 {
461 $msg->error($errorlist[0]);
462 }
463 }
464 }
465
466 // ####################### Start fetch_on_bits #######################
467 function fetch_on_bits($mask, $userinfo = null)
468 {
469 global $bugsys;
470
471 if ($userinfo == null)
472 {
473 $userinfo =& bugdar::$userinfo;
474 }
475
476 $onbits = array();
477
478 $usergroupid = $userinfo['usergroupid'];
479 FetchUserPermissions($userinfo); // get the groups
480 $groups = $userinfo['groupids'];
481 $groups[] = $usergroupid;
482
483 // product-inspecific work
484 if (is_array(bugdar::$datastore['product']))
485 {
486 foreach ($groups AS $groupid)
487 {
488 // we only need to do this so long as there's no onbits array because this isn't product specific
489 if (sizeof($onbits) == 0 AND bugdar::$datastore['usergroup']["$groupid"]['permissions'] & $bugsys->permissions["$mask"])
490 {
491 foreach (bugdar::$datastore['product'] AS $id => $product)
492 {
493 $onbits["$id"] = $id;
494 }
495 }
496 }
497 }
498
499 // bits set explicitly by products
500 $explicit = array();
501
502 // product specific work
503 foreach ($groups AS $groupid)
504 {
505 if (is_array(bugdar::$datastore['permission']["$groupid"]))
506 {
507 foreach (bugdar::$datastore['permission']["$groupid"] AS $productid => $bit)
508 {
509 if ($bit & $bugsys->permissions["$mask"])
510 {
511 $explicit["$productid"] = $productid;
512 $onbits["$productid"] = $productid;
513 }
514 else
515 {
516 // only unset if the bit was set in the first place by blanket and not product-specific permissions
517 // if it was set by product permissions then the highest level takes precedence
518 if ($onbits["$productid"] AND !isset($explicit["$productid"]))
519 {
520 unset($onbits["$productid"]);
521 }
522 }
523 }
524 }
525 }
526
527 // SQL queries would become very unhappy if we didn't do this
528 if (sizeof($onbits) < 1)
529 {
530 $onbits = array(0);
531 }
532
533 return implode(',', $onbits);
534 }
535
536 // #################### Start isso_pre_parse_hook ####################
537 // the pre-parse hook for ISSO's template engine
538 function isso_pre_parse_hook($template)
539 {
540 $template = preg_replace('#\$help\[(.*)\]#', '" . fetch_help_link("\1") . "', $template);
541 return $template;
542 }
543
544 // ###################### Start fetch_help_link ######################
545 // returns a prepared link to insert into templates that opens up a
546 // help popup in the user-end
547 function fetch_help_link($topic)
548 {
549 global $bugsys;
550
551 if (isset(bugdar::$datastore['help']["$topic"]))
552 {
553 eval('$temp = "' . $bugsys->template->fetch('help_link') . '";');
554 return $temp;
555 }
556 else
557 {
558 if ($bugsys->debug)
559 {
560 return "[[INVALID TOPIC: $topic]]";
561 }
562 // do we want this?
563 else if (null == 1)
564 {
565 return eval('$temp = "' . $bugsys->template->fetch('help_link') . '";');
566 }
567 }
568 }
569
570 // ###################################################################
571 /**
572 * Returns a user array of information that is specific to all visiting
573 * users (guests). This can then be passed to any function that requires
574 * user information.
575 *
576 * @access public
577 *
578 * @return array User information array
579 */
580 function fetch_guest_user()
581 {
582 global $bugsys;
583
584 return array(
585 'usergroupid' => 1,
586 'groupids' => array(),
587 'userid' => 0,
588 'email' => '',
589 'displayname' => '',
590 'showcolors' => 1,
591 'permissions' => bugdar::$datastore['usergroup'][1]['permissions'],
592 'displaytitle' => bugdar::$datastore['usergroup'][1]['displaytitle'],
593 'timezone' => bugdar::$options['defaulttimezone']
594 );
595 }
596
597 // ###################################################################
598 /**
599 * Does an exhaustive permissions check on the bug. It checks for hidden
600 * bug status and ability to view hidden bugs. This normally was done
601 * at the top of each page, but it got so big, it was moved to a function.
602 *
603 * @access public
604 *
605 * @param array Bug array
606 * @param array Alternate user array
607 *
608 * @return bool Does the user have permission
609 */
610 function check_bug_permissions($bug, $userinfo = null)
611 {
612 global $bugsys;
613 if ($userinfo == null)
614 {
615 $userinfo = bugdar::$userinfo;
616 }
617
618 $bugsys->debug("checking permissions for $userinfo[userid] on bug $bug[bugid]");
619
620 $bugsys->debug('*** START VERBOSE CHECK ***');
621
622 $bugsys->debug('* !can_perform(canviewbugs, $bug[product], $userinfo) = ' . (int)(!can_perform('canviewbugs', $bug['product'], $userinfo)));
623 $bugsys->debug('* $bug[hidden] = ' . (int)$bug['hidden']);
624 $bugsys->debug('* $userinfo[userid] (' . $userinfo['userid'] . ') == $bug[userid] (' . $bug['userid'] . ') = ' . (int)($userinfo['userid'] == $bug['userid']));
625 $bugsys->debug('* can_perform(canviewownhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewownhidden', $bug['product'], $userinfo)));
626 $bugsys->debug('* can_perform(canviewhidden, $bug[product], $userinfo) = ' . (int)(!!can_perform('canviewhidden', $bug['product'], $userinfo)));
627 $bugsys->debug('* !$bug[hidden] = ' . (int)(!$bug['hidden']));
628
629 $bugsys->debug('*** END PERMISSIONS CHECK ***');
630
631 if
632 (
633 !can_perform('canviewbugs', $bug['product'], $userinfo)
634 OR
635 !(
636 (
637 $bug['hidden']
638 AND
639 (
640 ($userinfo['userid'] == $bug['userid'] AND can_perform('canviewownhidden', $bug['product'], $userinfo))
641 OR
642 can_perform('canviewhidden', $bug['product'], $userinfo)
643 )
644 )
645 OR
646 !$bug['hidden']
647 )
648 )
649 {
650 $bugsys->debug('*** DONE WITH REAL CALLS ***');
651 return false;
652 }
653
654 $bugsys->debug('*** DONE WITH REAL CALLS ***');
655
656 return true;
657 }
658
659 // ###################################################################
660 /**
661 * Takes an array of bug information and returns another array with
662 * information that is suitable for display as all the IDs have been
663 * replaced by their string equivalents
664 *
665 * @param array Unprocessed bug data
666 * @param string Color to display if the user has opted to not show status colours
667 *
668 * @param array Bug array with data fit for display
669 */
670 function ProcessBugDataForDisplay($bug, $color = '')
671 {
672 global $bugsys;
673
674 $bug['hiddendisplay'] = ($bug['hidden'] AND (can_perform('canviewhidden', $bug['product']) OR (can_perform('canviewownhidden') AND $bug['userid'] == bugdar::$userinfo['userid'])));
675
676 $bug['bgcolor'] = (bugdar::$userinfo['showcolors'] ? bugdar::$datastore['status']["$bug[status]"]['color'] : $color);
677 $bug['product'] = bugdar::$datastore['product']["$bug[product]"]['title'];
678 $bug['version'] = bugdar::$datastore['version']["$bug[version]"]['version'];
679 $bug['component'] = bugdar::$datastore['component']["$bug[component]"]['title'];
680 $bug['status'] = bugdar::$datastore['status']["$bug[status]"]['status'];
681 $bug['resolution'] = bugdar::$datastore['resolution']["$bug[resolution]"]['resolution'];
682 $bug['priority'] = bugdar::$datastore['priority']["$bug[priority]"]['priority'];
683 $bug['severity'] = bugdar::$datastore['severity']["$bug[severity]"]['severity'];
684 $bug['assignedto'] = ((empty($bug['assignedto']) OR !isset(bugdar::$datastore['assignto']["$bug[assignedto]"])) ? '' : construct_user_display(bugdar::$datastore['assignto']["$bug[assignedto]"]));
685
686 $bug['lastposttime'] = ($bug['hiddendisplay'] ? $bug['hiddenlastposttime'] : $bug['lastposttime']);
687 $bug['lastpost'] = ($bug['hiddendisplay'] ? $bug['hiddenlastpostbyname'] : $bug['lastpostbyname']);
688
689 $bug['lastposttime'] = BSApp::$date->format(bugdar::$options['dateformat'], $bug['lastposttime']);
690
691 return $bug;
692 }
693
694 // ###################################################################
695 /**
696 * Determines the correct permissions of the user. This is especially
697 * important for working with multiple-usergroup permission schemes.
698 * If a user is assigned to more than one usergroup, the highest level
699 * will always override (so a YES will always override a NO); this is
700 * because permissions are calculated with bitwise OR.
701 *
702 * @param array The user array with usergroups already exploded
703 *
704 * @return integer Permissions value
705 */
706 function FetchUserPermissions(&$user)
707 {
708 global $bugsys;
709
710 $perms = (int)bugdar::$datastore['usergroup']["$user[usergroupid]"]['permissions'];
711 if (!is_array($user['groupids']))
712 {
713 $user['groupids'] = explode(',', bugdar::$userinfo['groupids']);
714 }
715 $user['groupids'] = BSFunctions::array_strip_empty($user['groupids']);
716
717 foreach ($user['groupids'] AS $group)
718 {
719 $perms |= (int)bugdar::$datastore['usergroup']["$group"]['permissions'];
720 }
721
722 return $perms;
723 }
724
725 // ###################################################################
726 /**
727 * Fetches the path for an email template, given the name of the
728 * template and the locale to use
729 *
730 * @param string The template name
731 * @param string Language locale code
732 *
733 * @return string Template path
734 */
735 function FetchEmailPath($name, $locale)
736 {
737 return '../locale/' . $locale . '/emails/' . $name;
738 }
739
740 /*=====================================================================*\
741 || ###################################################################
742 || # $HeadURL$
743 || # $Id$
744 || ###################################################################
745 \*=====================================================================*/
746 ?>