File: 1143_smarty-add-on-function-param-types.patch

package info (click to toggle)
gosa 2.8~git20230203.10abe45%2Bdfsg-19
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,108 kB
  • sloc: php: 32,102; javascript: 10,836; pascal: 3,776; xml: 3,135; sh: 852; python: 162; makefile: 45; perl: 2
file content (91 lines) | stat: -rw-r--r-- 2,838 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Description: Use correct smarty3 API.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Forwarded: https://github.com/gosa-project/gosa-core/pull/25
Abstract.
 For the {render} add-on block, drop the &$smarty reference parameter
 entirely.
 .
 Drop the complete {tr} add-on block. Not registered as a plugin, not
 used.
 .
 For the add-on image and add-on factory functions, switch from
 reference &$smarty to value $smarty.

--- a/include/smartyAddons/block.render.php
+++ b/include/smartyAddons/block.render.php
@@ -1,6 +1,6 @@
 <?php
 
-function smarty_block_render($params, $text, &$smarty)
+function smarty_block_render($params, $text)
 {
 	/* Skip closing tag </render> */	
 	if(empty($text)) {
--- a/include/smartyAddons/block.tr.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-function smarty_block_tr($params, $text, &$smarty)
-{
-    $plugin = "";
-    if(!isset($params['domain'])){
-        if(strlen($text) != 0){
-            $trace = debug_backtrace();
-            $base = preg_replace("/\/html/","",getcwd());
-            foreach($trace as $t_entry){
-                if(preg_match("/^".preg_quote($base,'/')."\/plugins\//", $t_entry['file'])){
-                    $plugin = preg_replace("/^".preg_quote($base,'/')."\/plugins\/([^\/]*).*$/", "\\1", $t_entry['file']);
-                    break;
-                }
-            }
-        }
-    }
-  
- 
-    if($plugin != ""){ 
-        return(dgettext($plugin, $text));
-    }
-    return(gettext($text));
-}
-
-?>
--- a/include/smartyAddons/function.factory.php
+++ b/include/smartyAddons/function.factory.php
@@ -1,6 +1,6 @@
 <?php
 
-function smarty_function_factory($params, &$smarty)
+function smarty_function_factory($params, $smarty)
 {
 
     // Capture params
--- a/include/smartyAddons/function.image.php
+++ b/include/smartyAddons/function.image.php
@@ -1,6 +1,6 @@
 <?php
 
-function smarty_function_image($params, &$smarty)
+function smarty_function_image($params, $smarty)
 {
   $path = (isset($params['path']))? $params['path'] :"";
   $action = (isset($params['action']))? $params['action'] :"";
--- a/include/smartyAddons/function.msgPool.php
+++ b/include/smartyAddons/function.msgPool.php
@@ -1,6 +1,6 @@
 <?php
 
-function smarty_function_msgPool($params, &$smarty)
+function smarty_function_msgPool($params, $smarty)
 {
 	if(class_available("msgPool") && isset($params['type'])){
 		$parameter = array();
--- a/include/php_setup.inc
+++ b/include/php_setup.inc
@@ -323,7 +323,6 @@
     if(preg_match("/\.php$/", $file)) require_once("$BASE_DIR/include/smartyAddons/{$file}");
 }
 
-#$smarty->registerPlugin("block", "tr", "smarty_block_tr");
 $smarty->registerPlugin("block", "t", "smarty_block_t");
 $smarty->registerPlugin("block", "render", "smarty_block_render");
 $smarty->registerPlugin("function", "msgPool", "smarty_function_msgPool");