Completed
Push — developer ( 67fdb5...f9e515 )
by Błażej
469:22 queued 431:37
created
libraries/Smarty/libs/sysplugins/smarty_internal_method_createdata.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,34 +11,34 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_CreateData
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * creates a data object
23
-     *
24
-     * @api  Smarty::createData()
25
-     * @link http://www.smarty.net/docs/en/api.create.data.tpl
26
-     *
27
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty      $obj
28
-     * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty
29
-     *                                                                                     variables
30
-     * @param string                                                               $name   optional data block name
31
-     *
32
-     * @returns Smarty_Data data object
33
-     */
34
-    public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null)
35
-    {
36
-        /* @var Smarty $smarty */
37
-        $smarty = isset($this->smarty) ? $this->smarty : $obj;
38
-        $dataObj = new Smarty_Data($parent, $smarty, $name);
39
-        if ($smarty->debugging) {
40
-            Smarty_Internal_Debug::register_data($dataObj);
41
-        }
42
-        return $dataObj;
43
-    }
21
+	/**
22
+	 * creates a data object
23
+	 *
24
+	 * @api  Smarty::createData()
25
+	 * @link http://www.smarty.net/docs/en/api.create.data.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty      $obj
28
+	 * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty
29
+	 *                                                                                     variables
30
+	 * @param string                                                               $name   optional data block name
31
+	 *
32
+	 * @returns Smarty_Data data object
33
+	 */
34
+	public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null)
35
+	{
36
+		/* @var Smarty $smarty */
37
+		$smarty = isset($this->smarty) ? $this->smarty : $obj;
38
+		$dataObj = new Smarty_Data($parent, $smarty, $name);
39
+		if ($smarty->debugging) {
40
+			Smarty_Internal_Debug::register_data($dataObj);
41
+		}
42
+		return $dataObj;
43
+	}
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_text.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,25 +16,25 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_ParseTree_Text extends Smarty_Internal_ParseTree
18 18
 {
19
-    /**
20
-     * Create template text buffer
21
-     *
22
-     * @param string $data text
23
-     */
24
-    public function __construct($data)
25
-    {
26
-        $this->data = $data;
27
-    }
19
+	/**
20
+	 * Create template text buffer
21
+	 *
22
+	 * @param string $data text
23
+	 */
24
+	public function __construct($data)
25
+	{
26
+		$this->data = $data;
27
+	}
28 28
 
29
-    /**
30
-     * Return buffer content
31
-     *
32
-     * @param \Smarty_Internal_Templateparser $parser
33
-     *
34
-     * @return string text
35
-     */
36
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
37
-    {
38
-        return $this->data;
39
-    }
29
+	/**
30
+	 * Return buffer content
31
+	 *
32
+	 * @param \Smarty_Internal_Templateparser $parser
33
+	 *
34
+	 * @return string text
35
+	 */
36
+	public function to_smarty_php(Smarty_Internal_Templateparser $parser)
37
+	{
38
+		return $this->data;
39
+	}
40 40
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_dq.php 3 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -17,79 +17,79 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree
19 19
 {
20
-    /**
21
-     * Create parse tree buffer for double quoted string subtrees
22
-     *
23
-     * @param object                    $parser  parser object
24
-     * @param Smarty_Internal_ParseTree $subtree parse tree buffer
25
-     */
26
-    public function __construct($parser, Smarty_Internal_ParseTree $subtree)
27
-    {
28
-        $this->subtrees[] = $subtree;
29
-        if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
30
-            $parser->block_nesting_level = count($parser->compiler->_tag_stack);
31
-        }
32
-    }
20
+	/**
21
+	 * Create parse tree buffer for double quoted string subtrees
22
+	 *
23
+	 * @param object                    $parser  parser object
24
+	 * @param Smarty_Internal_ParseTree $subtree parse tree buffer
25
+	 */
26
+	public function __construct($parser, Smarty_Internal_ParseTree $subtree)
27
+	{
28
+		$this->subtrees[] = $subtree;
29
+		if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
30
+			$parser->block_nesting_level = count($parser->compiler->_tag_stack);
31
+		}
32
+	}
33 33
 
34
-    /**
35
-     * Append buffer to subtree
36
-     *
37
-     * @param \Smarty_Internal_Templateparser $parser
38
-     * @param Smarty_Internal_ParseTree       $subtree parse tree buffer
39
-     */
40
-    public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
41
-    {
42
-        $last_subtree = count($this->subtrees) - 1;
43
-        if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag &&
44
-            $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
45
-        ) {
46
-            if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
47
-                $this->subtrees[ $last_subtree ]->data =
48
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
49
-                                                  '<?php echo ' . $subtree->data . ';?>');
50
-            } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
51
-                $this->subtrees[ $last_subtree ]->data =
52
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
53
-                                                  '<?php echo "' . $subtree->data . '";?>');
54
-            } else {
55
-                $this->subtrees[ $last_subtree ]->data =
56
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
57
-            }
58
-        } else {
59
-            $this->subtrees[] = $subtree;
60
-        }
61
-        if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
62
-            $parser->block_nesting_level = count($parser->compiler->_tag_stack);
63
-        }
64
-    }
34
+	/**
35
+	 * Append buffer to subtree
36
+	 *
37
+	 * @param \Smarty_Internal_Templateparser $parser
38
+	 * @param Smarty_Internal_ParseTree       $subtree parse tree buffer
39
+	 */
40
+	public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
41
+	{
42
+		$last_subtree = count($this->subtrees) - 1;
43
+		if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag &&
44
+			$this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
45
+		) {
46
+			if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
47
+				$this->subtrees[ $last_subtree ]->data =
48
+					$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
49
+												  '<?php echo ' . $subtree->data . ';?>');
50
+			} elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
51
+				$this->subtrees[ $last_subtree ]->data =
52
+					$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
53
+												  '<?php echo "' . $subtree->data . '";?>');
54
+			} else {
55
+				$this->subtrees[ $last_subtree ]->data =
56
+					$parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
57
+			}
58
+		} else {
59
+			$this->subtrees[] = $subtree;
60
+		}
61
+		if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
62
+			$parser->block_nesting_level = count($parser->compiler->_tag_stack);
63
+		}
64
+	}
65 65
 
66
-    /**
67
-     * Merge subtree buffer content together
68
-     *
69
-     * @param \Smarty_Internal_Templateparser $parser
70
-     *
71
-     * @return string compiled template code
72
-     */
73
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
74
-    {
75
-        $code = '';
76
-        foreach ($this->subtrees as $subtree) {
77
-            if ($code !== "") {
78
-                $code .= ".";
79
-            }
80
-            if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
81
-                $more_php = $subtree->assign_to_var($parser);
82
-            } else {
83
-                $more_php = $subtree->to_smarty_php($parser);
84
-            }
66
+	/**
67
+	 * Merge subtree buffer content together
68
+	 *
69
+	 * @param \Smarty_Internal_Templateparser $parser
70
+	 *
71
+	 * @return string compiled template code
72
+	 */
73
+	public function to_smarty_php(Smarty_Internal_Templateparser $parser)
74
+	{
75
+		$code = '';
76
+		foreach ($this->subtrees as $subtree) {
77
+			if ($code !== "") {
78
+				$code .= ".";
79
+			}
80
+			if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
81
+				$more_php = $subtree->assign_to_var($parser);
82
+			} else {
83
+				$more_php = $subtree->to_smarty_php($parser);
84
+			}
85 85
 
86
-            $code .= $more_php;
86
+			$code .= $more_php;
87 87
 
88
-            if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) {
89
-                $parser->compiler->has_variable_string = true;
90
-            }
91
-        }
88
+			if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) {
89
+				$parser->compiler->has_variable_string = true;
90
+			}
91
+		}
92 92
 
93
-        return $code;
94
-    }
93
+		return $code;
94
+	}
95 95
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,20 +40,20 @@
 block discarded – undo
40 40
     public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree)
41 41
     {
42 42
         $last_subtree = count($this->subtrees) - 1;
43
-        if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag &&
44
-            $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level
43
+        if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof Smarty_Internal_ParseTree_Tag &&
44
+            $this->subtrees[$last_subtree]->saved_block_nesting < $parser->block_nesting_level
45 45
         ) {
46 46
             if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
47
-                $this->subtrees[ $last_subtree ]->data =
48
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
47
+                $this->subtrees[$last_subtree]->data =
48
+                    $parser->compiler->appendCode($this->subtrees[$last_subtree]->data,
49 49
                                                   '<?php echo ' . $subtree->data . ';?>');
50 50
             } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
51
-                $this->subtrees[ $last_subtree ]->data =
52
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data,
51
+                $this->subtrees[$last_subtree]->data =
52
+                    $parser->compiler->appendCode($this->subtrees[$last_subtree]->data,
53 53
                                                   '<?php echo "' . $subtree->data . '";?>');
54 54
             } else {
55
-                $this->subtrees[ $last_subtree ]->data =
56
-                    $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data);
55
+                $this->subtrees[$last_subtree]->data =
56
+                    $parser->compiler->appendCode($this->subtrees[$last_subtree]->data, $subtree->data);
57 57
             }
58 58
         } else {
59 59
             $this->subtrees[] = $subtree;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     /**
21 21
      * Create parse tree buffer for double quoted string subtrees
22 22
      *
23
-     * @param object                    $parser  parser object
23
+     * @param Smarty_Internal_Templateparser                    $parser  parser object
24 24
      * @param Smarty_Internal_ParseTree $subtree parse tree buffer
25 25
      */
26 26
     public function __construct($parser, Smarty_Internal_ParseTree $subtree)
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                         $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
93 93
                     if ($_tpl->mustCompile()) {
94 94
                         $_tpl->compileTemplateSource();
95
-                        $_count ++;
95
+                        $_count++;
96 96
                         echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';
97 97
                         flush();
98 98
                     } else {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 }
103 103
                 catch (Exception $e) {
104 104
                     echo "\n<br>        ------>Error: ", $e->getMessage(), "<br><br>\n";
105
-                    $_error_count ++;
105
+                    $_error_count++;
106 106
                 }
107 107
                 // free memory
108 108
                 unset($_tpl);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@
 block discarded – undo
99 99
                         echo ' is up to date';
100 100
                         flush();
101 101
                     }
102
-                }
103
-                catch (Exception $e) {
102
+                } catch (Exception $e) {
104 103
                     echo "\n<br>        ------>Error: ", $e->getMessage(), "<br><br>\n";
105 104
                     $_error_count ++;
106 105
                 }
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -11,108 +11,108 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_CompileAllTemplates
13 13
 {
14
-    /**
15
-     * Valid for Smarty object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 1;
14
+	/**
15
+	 * Valid for Smarty object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 1;
20 20
 
21
-    /**
22
-     * Compile all template files
23
-     *
24
-     * @api  Smarty::compileAllTemplates()
25
-     *
26
-     * @param \Smarty $smarty        passed smarty object
27
-     * @param  string $extension     file extension
28
-     * @param  bool   $force_compile force all to recompile
29
-     * @param  int    $time_limit
30
-     * @param  int    $max_errors
31
-     *
32
-     * @return integer number of template files recompiled
33
-     */
34
-    public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0,
35
-                                        $max_errors = null)
36
-    {
37
-        return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
38
-    }
21
+	/**
22
+	 * Compile all template files
23
+	 *
24
+	 * @api  Smarty::compileAllTemplates()
25
+	 *
26
+	 * @param \Smarty $smarty        passed smarty object
27
+	 * @param  string $extension     file extension
28
+	 * @param  bool   $force_compile force all to recompile
29
+	 * @param  int    $time_limit
30
+	 * @param  int    $max_errors
31
+	 *
32
+	 * @return integer number of template files recompiled
33
+	 */
34
+	public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0,
35
+										$max_errors = null)
36
+	{
37
+		return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
38
+	}
39 39
 
40
-    /**
41
-     * Compile all template or config files
42
-     *
43
-     * @param \Smarty $smarty
44
-     * @param  string $extension     template file name extension
45
-     * @param  bool   $force_compile force all to recompile
46
-     * @param  int    $time_limit    set maximum execution time
47
-     * @param  int    $max_errors    set maximum allowed errors
48
-     * @param bool    $isConfig      flag true if called for config files
49
-     *
50
-     * @return int number of template files compiled
51
-     */
52
-    protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors,
53
-                                  $isConfig = false)
54
-    {
55
-        // switch off time limit
56
-        if (function_exists('set_time_limit')) {
57
-            @set_time_limit($time_limit);
58
-        }
59
-        $_count = 0;
60
-        $_error_count = 0;
61
-        $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
62
-        // loop over array of source directories
63
-        foreach ($sourceDir as $_dir) {
64
-            $_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
65
-                FilesystemIterator::FOLLOW_SYMLINKS : 0);
66
-            $_dir_2 = new RecursiveIteratorIterator($_dir_1);
67
-            foreach ($_dir_2 as $_fileinfo) {
68
-                $_file = $_fileinfo->getFilename();
69
-                if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
70
-                    continue;
71
-                }
72
-                if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
73
-                    continue;
74
-                }
75
-                if ($_fileinfo->getPath() !== substr($_dir, 0, - 1)) {
76
-                    $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
77
-                }
78
-                echo "\n<br>", $_dir, '---', $_file;
79
-                flush();
80
-                $_start_time = microtime(true);
81
-                $_smarty = clone $smarty;
82
-                // 
83
-                $_smarty->_cache = array();
84
-                $_smarty->ext = new Smarty_Internal_Extension_Handler();
85
-                $_smarty->ext->objType = $_smarty->_objType;
86
-                $_smarty->force_compile = $force_compile;
87
-                try {
88
-                    /* @var Smarty_Internal_Template $_tpl */
89
-                    $_tpl = new $smarty->template_class($_file, $_smarty);
90
-                    $_tpl->caching = Smarty::CACHING_OFF;
91
-                    $_tpl->source =
92
-                        $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
93
-                    if ($_tpl->mustCompile()) {
94
-                        $_tpl->compileTemplateSource();
95
-                        $_count ++;
96
-                        echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';
97
-                        flush();
98
-                    } else {
99
-                        echo ' is up to date';
100
-                        flush();
101
-                    }
102
-                }
103
-                catch (Exception $e) {
104
-                    echo "\n<br>        ------>Error: ", $e->getMessage(), "<br><br>\n";
105
-                    $_error_count ++;
106
-                }
107
-                // free memory
108
-                unset($_tpl);
109
-                $_smarty->_clearTemplateCache();
110
-                if ($max_errors !== null && $_error_count == $max_errors) {
111
-                    throw new \Exception\AppException('Too many errors');
112
-                }
113
-            }
114
-        }
115
-        echo "\n<br>";
116
-        return $_count;
117
-    }
40
+	/**
41
+	 * Compile all template or config files
42
+	 *
43
+	 * @param \Smarty $smarty
44
+	 * @param  string $extension     template file name extension
45
+	 * @param  bool   $force_compile force all to recompile
46
+	 * @param  int    $time_limit    set maximum execution time
47
+	 * @param  int    $max_errors    set maximum allowed errors
48
+	 * @param bool    $isConfig      flag true if called for config files
49
+	 *
50
+	 * @return int number of template files compiled
51
+	 */
52
+	protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors,
53
+								  $isConfig = false)
54
+	{
55
+		// switch off time limit
56
+		if (function_exists('set_time_limit')) {
57
+			@set_time_limit($time_limit);
58
+		}
59
+		$_count = 0;
60
+		$_error_count = 0;
61
+		$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
62
+		// loop over array of source directories
63
+		foreach ($sourceDir as $_dir) {
64
+			$_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
65
+				FilesystemIterator::FOLLOW_SYMLINKS : 0);
66
+			$_dir_2 = new RecursiveIteratorIterator($_dir_1);
67
+			foreach ($_dir_2 as $_fileinfo) {
68
+				$_file = $_fileinfo->getFilename();
69
+				if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
70
+					continue;
71
+				}
72
+				if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
73
+					continue;
74
+				}
75
+				if ($_fileinfo->getPath() !== substr($_dir, 0, - 1)) {
76
+					$_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
77
+				}
78
+				echo "\n<br>", $_dir, '---', $_file;
79
+				flush();
80
+				$_start_time = microtime(true);
81
+				$_smarty = clone $smarty;
82
+				// 
83
+				$_smarty->_cache = array();
84
+				$_smarty->ext = new Smarty_Internal_Extension_Handler();
85
+				$_smarty->ext->objType = $_smarty->_objType;
86
+				$_smarty->force_compile = $force_compile;
87
+				try {
88
+					/* @var Smarty_Internal_Template $_tpl */
89
+					$_tpl = new $smarty->template_class($_file, $_smarty);
90
+					$_tpl->caching = Smarty::CACHING_OFF;
91
+					$_tpl->source =
92
+						$isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
93
+					if ($_tpl->mustCompile()) {
94
+						$_tpl->compileTemplateSource();
95
+						$_count ++;
96
+						echo ' compiled in  ', microtime(true) - $_start_time, ' seconds';
97
+						flush();
98
+					} else {
99
+						echo ' is up to date';
100
+						flush();
101
+					}
102
+				}
103
+				catch (Exception $e) {
104
+					echo "\n<br>        ------>Error: ", $e->getMessage(), "<br><br>\n";
105
+					$_error_count ++;
106
+				}
107
+				// free memory
108
+				unset($_tpl);
109
+				$_smarty->_clearTemplateCache();
110
+				if ($max_errors !== null && $_error_count == $max_errors) {
111
+					throw new \Exception\AppException('Too many errors');
112
+				}
113
+			}
114
+		}
115
+		echo "\n<br>";
116
+		return $_count;
117
+	}
118 118
 }
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php 2 patches
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -17,205 +17,205 @@
 block discarded – undo
17 17
 class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_CompileBase
18 18
 {
19 19
 
20
-    /**
21
-     * Preg search pattern
22
-     *
23
-     * @var string
24
-     */
25
-    private $propertyPreg = '';
26
-
27
-    /**
28
-     * Offsets in preg match result
29
-     *
30
-     * @var array
31
-     */
32
-    private $resultOffsets = array();
33
-
34
-    /**
35
-     * Start offset
36
-     *
37
-     * @var int
38
-     */
39
-    private $startOffset = 0;
40
-
41
-    /**
42
-     * Name of this tag
43
-     *
44
-     * @var string
45
-     */
46
-    public $tagName = '';
47
-
48
-    /**
49
-     * Valid properties of $smarty.xxx variable
50
-     *
51
-     * @var array
52
-     */
53
-    public $nameProperties = array();
54
-
55
-    /**
56
-     * {section} tag has no item properties
57
-     *
58
-     * @var array
59
-     */
60
-    public $itemProperties = null;
61
-
62
-    /**
63
-     * {section} tag has always name attribute
64
-     *
65
-     * @var bool
66
-     */
67
-    public $isNamed = true;
68
-
69
-    /**
70
-     * @var array
71
-     */
72
-    public $matchResults = array();
73
-
74
-    /**
75
-     * Scan sources for used tag attributes
76
-     *
77
-     * @param  array                                $attributes
78
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
79
-     */
80
-    public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler)
81
-    {
82
-        $this->propertyPreg = '~(';
83
-        $this->startOffset = 0;
84
-        $this->resultOffsets = array();
85
-        $this->matchResults = array('named' => array(), 'item' => array());
86
-        if ($this->isNamed) {
87
-            $this->buildPropertyPreg(true, $attributes);
88
-        }
89
-        if (isset($this->itemProperties)) {
90
-            if ($this->isNamed) {
91
-                $this->propertyPreg .= '|';
92
-            }
93
-            $this->buildPropertyPreg(false, $attributes);
94
-        }
95
-        $this->propertyPreg .= ')\W~i';
96
-        // Template source
97
-        $this->matchTemplateSource($compiler);
98
-        // Parent template source
99
-        $this->matchParentTemplateSource($compiler);
100
-        // {block} source
101
-        $this->matchBlockSource($compiler);
102
-    }
103
-
104
-    /**
105
-     * Build property preg string
106
-     *
107
-     * @param bool  $named
108
-     * @param array $attributes
109
-     */
110
-    public function buildPropertyPreg($named, $attributes)
111
-    {
112
-        if ($named) {
113
-            $this->resultOffsets[ 'named' ] = $this->startOffset + 3;
114
-            $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.](";
115
-            $properties = $this->nameProperties;
116
-        } else {
117
-            $this->resultOffsets[ 'item' ] = $this->startOffset + 3;
118
-            $this->propertyPreg .= "([\$]{$attributes['item']}[@](";
119
-            $properties = $this->itemProperties;
120
-        }
121
-        $this->startOffset += count($properties) + 2;
122
-        $propName = reset($properties);
123
-        while ($propName) {
124
-            $this->propertyPreg .= "({$propName})";
125
-            $propName = next($properties);
126
-            if ($propName) {
127
-                $this->propertyPreg .= '|';
128
-            }
129
-        }
130
-        $this->propertyPreg .= '))';
131
-    }
132
-
133
-    /**
134
-     * Find matches in source string
135
-     *
136
-     * @param string $source
137
-     */
138
-    public function matchProperty($source)
139
-    {
140
-        preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER);
141
-        foreach ($this->resultOffsets as $key => $offset) {
142
-            foreach ($match as $m) {
143
-                if (isset($m[ $offset ]) && !empty($m[ $offset ])) {
144
-                    $this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true;
145
-                }
146
-            }
147
-        }
148
-    }
149
-
150
-    /**
151
-     * Find matches in template source
152
-     *
153
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
154
-     */
155
-    public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
156
-    {
157
-        $this->matchProperty($compiler->parser->lex->data);
158
-    }
159
-
160
-    /**
161
-     * Find matches in all parent template source
162
-     *
163
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
164
-     */
165
-    public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
166
-    {
167
-        // search parent compiler template source
168
-        $nextCompiler = $compiler;
169
-        while ($nextCompiler !== $nextCompiler->parent_compiler) {
170
-            $nextCompiler = $nextCompiler->parent_compiler;
171
-            if ($compiler !== $nextCompiler) {
172
-                // get template source
173
-                $_content = $nextCompiler->template->source->getContent();
174
-                if ($_content != '') {
175
-                    // run pre filter if required
176
-                    if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
177
-                         isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
178
-                    ) {
179
-                        $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content,
180
-                                                                                          $nextCompiler->template);
181
-                    }
182
-                    $this->matchProperty($_content);
183
-                }
184
-            }
185
-        }
186
-    }
187
-
188
-    /**
189
-     * Find matches in {block} tag source
190
-     *
191
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
192
-     */
193
-    public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler)
194
-    {
195
-    }
196
-
197
-    /**
198
-     * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag
199
-     *
200
-     * @param  array                                $args      array with attributes from parser
201
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
202
-     * @param  array                                $parameter array with compilation parameter
203
-     *
204
-     * @return string compiled code
205
-     * @throws \SmartyCompilerException
206
-     */
207
-    public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
208
-    {
209
-        $tag = strtolower(trim($parameter[ 0 ], '"\''));
210
-        $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
211
-        if (!$name) {
212
-            $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
213
-        }
214
-        $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false;
215
-        if (!$property || !in_array($property, $this->nameProperties)) {
216
-            $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
217
-        }
218
-        $tagVar = "'__smarty_{$tag}_{$name}'";
219
-        return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)";
220
-    }
20
+	/**
21
+	 * Preg search pattern
22
+	 *
23
+	 * @var string
24
+	 */
25
+	private $propertyPreg = '';
26
+
27
+	/**
28
+	 * Offsets in preg match result
29
+	 *
30
+	 * @var array
31
+	 */
32
+	private $resultOffsets = array();
33
+
34
+	/**
35
+	 * Start offset
36
+	 *
37
+	 * @var int
38
+	 */
39
+	private $startOffset = 0;
40
+
41
+	/**
42
+	 * Name of this tag
43
+	 *
44
+	 * @var string
45
+	 */
46
+	public $tagName = '';
47
+
48
+	/**
49
+	 * Valid properties of $smarty.xxx variable
50
+	 *
51
+	 * @var array
52
+	 */
53
+	public $nameProperties = array();
54
+
55
+	/**
56
+	 * {section} tag has no item properties
57
+	 *
58
+	 * @var array
59
+	 */
60
+	public $itemProperties = null;
61
+
62
+	/**
63
+	 * {section} tag has always name attribute
64
+	 *
65
+	 * @var bool
66
+	 */
67
+	public $isNamed = true;
68
+
69
+	/**
70
+	 * @var array
71
+	 */
72
+	public $matchResults = array();
73
+
74
+	/**
75
+	 * Scan sources for used tag attributes
76
+	 *
77
+	 * @param  array                                $attributes
78
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
79
+	 */
80
+	public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler)
81
+	{
82
+		$this->propertyPreg = '~(';
83
+		$this->startOffset = 0;
84
+		$this->resultOffsets = array();
85
+		$this->matchResults = array('named' => array(), 'item' => array());
86
+		if ($this->isNamed) {
87
+			$this->buildPropertyPreg(true, $attributes);
88
+		}
89
+		if (isset($this->itemProperties)) {
90
+			if ($this->isNamed) {
91
+				$this->propertyPreg .= '|';
92
+			}
93
+			$this->buildPropertyPreg(false, $attributes);
94
+		}
95
+		$this->propertyPreg .= ')\W~i';
96
+		// Template source
97
+		$this->matchTemplateSource($compiler);
98
+		// Parent template source
99
+		$this->matchParentTemplateSource($compiler);
100
+		// {block} source
101
+		$this->matchBlockSource($compiler);
102
+	}
103
+
104
+	/**
105
+	 * Build property preg string
106
+	 *
107
+	 * @param bool  $named
108
+	 * @param array $attributes
109
+	 */
110
+	public function buildPropertyPreg($named, $attributes)
111
+	{
112
+		if ($named) {
113
+			$this->resultOffsets[ 'named' ] = $this->startOffset + 3;
114
+			$this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.](";
115
+			$properties = $this->nameProperties;
116
+		} else {
117
+			$this->resultOffsets[ 'item' ] = $this->startOffset + 3;
118
+			$this->propertyPreg .= "([\$]{$attributes['item']}[@](";
119
+			$properties = $this->itemProperties;
120
+		}
121
+		$this->startOffset += count($properties) + 2;
122
+		$propName = reset($properties);
123
+		while ($propName) {
124
+			$this->propertyPreg .= "({$propName})";
125
+			$propName = next($properties);
126
+			if ($propName) {
127
+				$this->propertyPreg .= '|';
128
+			}
129
+		}
130
+		$this->propertyPreg .= '))';
131
+	}
132
+
133
+	/**
134
+	 * Find matches in source string
135
+	 *
136
+	 * @param string $source
137
+	 */
138
+	public function matchProperty($source)
139
+	{
140
+		preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER);
141
+		foreach ($this->resultOffsets as $key => $offset) {
142
+			foreach ($match as $m) {
143
+				if (isset($m[ $offset ]) && !empty($m[ $offset ])) {
144
+					$this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true;
145
+				}
146
+			}
147
+		}
148
+	}
149
+
150
+	/**
151
+	 * Find matches in template source
152
+	 *
153
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
154
+	 */
155
+	public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
156
+	{
157
+		$this->matchProperty($compiler->parser->lex->data);
158
+	}
159
+
160
+	/**
161
+	 * Find matches in all parent template source
162
+	 *
163
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
164
+	 */
165
+	public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
166
+	{
167
+		// search parent compiler template source
168
+		$nextCompiler = $compiler;
169
+		while ($nextCompiler !== $nextCompiler->parent_compiler) {
170
+			$nextCompiler = $nextCompiler->parent_compiler;
171
+			if ($compiler !== $nextCompiler) {
172
+				// get template source
173
+				$_content = $nextCompiler->template->source->getContent();
174
+				if ($_content != '') {
175
+					// run pre filter if required
176
+					if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
177
+						 isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
178
+					) {
179
+						$_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content,
180
+																						  $nextCompiler->template);
181
+					}
182
+					$this->matchProperty($_content);
183
+				}
184
+			}
185
+		}
186
+	}
187
+
188
+	/**
189
+	 * Find matches in {block} tag source
190
+	 *
191
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
192
+	 */
193
+	public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler)
194
+	{
195
+	}
196
+
197
+	/**
198
+	 * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag
199
+	 *
200
+	 * @param  array                                $args      array with attributes from parser
201
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
202
+	 * @param  array                                $parameter array with compilation parameter
203
+	 *
204
+	 * @return string compiled code
205
+	 * @throws \SmartyCompilerException
206
+	 */
207
+	public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
208
+	{
209
+		$tag = strtolower(trim($parameter[ 0 ], '"\''));
210
+		$name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
211
+		if (!$name) {
212
+			$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
213
+		}
214
+		$property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false;
215
+		if (!$property || !in_array($property, $this->nameProperties)) {
216
+			$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
217
+		}
218
+		$tagVar = "'__smarty_{$tag}_{$name}'";
219
+		return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)";
220
+	}
221 221
 }
222 222
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
     public function buildPropertyPreg($named, $attributes)
111 111
     {
112 112
         if ($named) {
113
-            $this->resultOffsets[ 'named' ] = $this->startOffset + 3;
113
+            $this->resultOffsets['named'] = $this->startOffset + 3;
114 114
             $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.](";
115 115
             $properties = $this->nameProperties;
116 116
         } else {
117
-            $this->resultOffsets[ 'item' ] = $this->startOffset + 3;
117
+            $this->resultOffsets['item'] = $this->startOffset + 3;
118 118
             $this->propertyPreg .= "([\$]{$attributes['item']}[@](";
119 119
             $properties = $this->itemProperties;
120 120
         }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
         preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER);
141 141
         foreach ($this->resultOffsets as $key => $offset) {
142 142
             foreach ($match as $m) {
143
-                if (isset($m[ $offset ]) && !empty($m[ $offset ])) {
144
-                    $this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true;
143
+                if (isset($m[$offset]) && !empty($m[$offset])) {
144
+                    $this->matchResults[$key][strtolower($m[$offset])] = true;
145 145
                 }
146 146
             }
147 147
         }
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
                 $_content = $nextCompiler->template->source->getContent();
174 174
                 if ($_content != '') {
175 175
                     // run pre filter if required
176
-                    if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) ||
177
-                         isset($nextCompiler->smarty->registered_filters[ 'pre' ]))
176
+                    if ((isset($nextCompiler->smarty->autoload_filters['pre']) ||
177
+                         isset($nextCompiler->smarty->registered_filters['pre']))
178 178
                     ) {
179 179
                         $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content,
180 180
                                                                                           $nextCompiler->template);
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
208 208
     {
209
-        $tag = strtolower(trim($parameter[ 0 ], '"\''));
210
-        $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false;
209
+        $tag = strtolower(trim($parameter[0], '"\''));
210
+        $name = isset($parameter[1]) ? $compiler->getId($parameter[1]) : false;
211 211
         if (!$name) {
212 212
             $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
213 213
         }
214
-        $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false;
214
+        $property = isset($parameter[2]) ? strtolower($compiler->getId($parameter[2])) : false;
215 215
         if (!$property || !in_array($property, $this->nameProperties)) {
216 216
             $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
217 217
         }
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,32 +11,32 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_AddDefaultModifiers
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Add default modifiers
23
-     *
24
-     * @api Smarty::addDefaultModifiers()
25
-     *
26
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
-     * @param  array|string                                                   $modifiers modifier or list of modifiers
28
-     *                                                                                   to add
29
-     *
30
-     * @return \Smarty|\Smarty_Internal_Template
31
-     */
32
-    public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
33
-    {
34
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
-        if (is_array($modifiers)) {
36
-            $smarty->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
37
-        } else {
38
-            $smarty->default_modifiers[] = $modifiers;
39
-        }
40
-        return $obj;
41
-    }
21
+	/**
22
+	 * Add default modifiers
23
+	 *
24
+	 * @api Smarty::addDefaultModifiers()
25
+	 *
26
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
+	 * @param  array|string                                                   $modifiers modifier or list of modifiers
28
+	 *                                                                                   to add
29
+	 *
30
+	 * @return \Smarty|\Smarty_Internal_Template
31
+	 */
32
+	public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
33
+	{
34
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
35
+		if (is_array($modifiers)) {
36
+			$smarty->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
37
+		} else {
38
+			$smarty->default_modifiers[] = $modifiers;
39
+		}
40
+		return $obj;
41
+	}
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -11,25 +11,25 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_GetDefaultModifiers
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Get default modifiers
23
-     *
24
-     * @api Smarty::getDefaultModifiers()
25
-     *
26
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
-     *
28
-     * @return array list of default modifiers
29
-     */
30
-    public function getDefaultModifiers(Smarty_Internal_TemplateBase $obj)
31
-    {
32
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
33
-        return $smarty->default_modifiers;
34
-    }
21
+	/**
22
+	 * Get default modifiers
23
+	 *
24
+	 * @api Smarty::getDefaultModifiers()
25
+	 *
26
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
27
+	 *
28
+	 * @return array list of default modifiers
29
+	 */
30
+	public function getDefaultModifiers(Smarty_Internal_TemplateBase $obj)
31
+	{
32
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
33
+		return $smarty->default_modifiers;
34
+	}
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/SabreDAV/DAVACL/AbstractPrincipalCollection.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@  discard block
 block discarded – undo
91 91
      */
92 92
     function getChildren() {
93 93
 
94
-        if ($this->disableListing)
95
-            throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
94
+        if ($this->disableListing) {
95
+                    throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
96
+        }
96 97
 
97 98
         $children = [];
98 99
         foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
@@ -115,7 +116,9 @@  discard block
 block discarded – undo
115 116
     function getChild($name) {
116 117
 
117 118
         $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
118
-        if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
119
+        if (!$principalInfo) {
120
+        	throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
121
+        }
119 122
         return $this->getChildForPrincipal($principalInfo);
120 123
 
121 124
     }
Please login to merge, or discard this patch.
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -19,163 +19,163 @@
 block discarded – undo
19 19
  */
20 20
 abstract class AbstractPrincipalCollection extends DAV\Collection implements IPrincipalCollection {
21 21
 
22
-    /**
23
-     * Principal backend
24
-     *
25
-     * @var PrincipalBackend\BackendInterface
26
-     */
27
-    protected $principalBackend;
28
-
29
-    /**
30
-     * The path to the principals we're listing from.
31
-     *
32
-     * @var string
33
-     */
34
-    protected $principalPrefix;
35
-
36
-    /**
37
-     * If this value is set to true, it effectively disables listing of users
38
-     * it still allows user to find other users if they have an exact url.
39
-     *
40
-     * @var bool
41
-     */
42
-    public $disableListing = false;
43
-
44
-    /**
45
-     * Creates the object
46
-     *
47
-     * This object must be passed the principal backend. This object will
48
-     * filter all principals from a specified prefix ($principalPrefix). The
49
-     * default is 'principals', if your principals are stored in a different
50
-     * collection, override $principalPrefix
51
-     *
52
-     *
53
-     * @param PrincipalBackend\BackendInterface $principalBackend
54
-     * @param string $principalPrefix
55
-     */
56
-    public function __construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix = 'principals') {
57
-
58
-        $this->principalPrefix = $principalPrefix;
59
-        $this->principalBackend = $principalBackend;
60
-
61
-    }
62
-
63
-    /**
64
-     * This method returns a node for a principal.
65
-     *
66
-     * The passed array contains principal information, and is guaranteed to
67
-     * at least contain a uri item. Other properties may or may not be
68
-     * supplied by the authentication backend.
69
-     *
70
-     * @param array $principalInfo
71
-     * @return IPrincipal
72
-     */
73
-    abstract function getChildForPrincipal(array $principalInfo);
74
-
75
-    /**
76
-     * Returns the name of this collection.
77
-     *
78
-     * @return string
79
-     */
80
-    public function getName() {
81
-
82
-        list(, $name) = URLUtil::splitPath($this->principalPrefix);
83
-        return $name;
84
-
85
-    }
86
-
87
-    /**
88
-     * Return the list of users
89
-     *
90
-     * @return array
91
-     */
92
-    public function getChildren() {
93
-
94
-        if ($this->disableListing)
95
-            throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
96
-
97
-        $children = [];
98
-        foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
99
-
100
-            $children[] = $this->getChildForPrincipal($principalInfo);
101
-
102
-
103
-        }
104
-        return $children;
105
-
106
-    }
107
-
108
-    /**
109
-     * Returns a child object, by its name.
110
-     *
111
-     * @param string $name
112
-     * @throws DAV\Exception\NotFound
113
-     * @return IPrincipal
114
-     */
115
-    public function getChild($name) {
116
-
117
-        $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
118
-        if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
119
-        return $this->getChildForPrincipal($principalInfo);
120
-
121
-    }
122
-
123
-    /**
124
-     * This method is used to search for principals matching a set of
125
-     * properties.
126
-     *
127
-     * This search is specifically used by RFC3744's principal-property-search
128
-     * REPORT. You should at least allow searching on
129
-     * http://sabredav.org/ns}email-address.
130
-     *
131
-     * The actual search should be a unicode-non-case-sensitive search. The
132
-     * keys in searchProperties are the WebDAV property names, while the values
133
-     * are the property values to search on.
134
-     *
135
-     * By default, if multiple properties are submitted to this method, the
136
-     * various properties should be combined with 'AND'. If $test is set to
137
-     * 'anyof', it should be combined using 'OR'.
138
-     *
139
-     * This method should simply return a list of 'child names', which may be
140
-     * used to call $this->getChild in the future.
141
-     *
142
-     * @param array $searchProperties
143
-     * @param string $test
144
-     * @return array
145
-     */
146
-    public function searchPrincipals(array $searchProperties, $test = 'allof') {
147
-
148
-        $result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties, $test);
149
-        $r = [];
150
-
151
-        foreach ($result as $row) {
152
-            list(, $r[]) = URLUtil::splitPath($row);
153
-        }
154
-
155
-        return $r;
156
-
157
-    }
158
-
159
-    /**
160
-     * Finds a principal by its URI.
161
-     *
162
-     * This method may receive any type of uri, but mailto: addresses will be
163
-     * the most common.
164
-     *
165
-     * Implementation of this API is optional. It is currently used by the
166
-     * CalDAV system to find principals based on their email addresses. If this
167
-     * API is not implemented, some features may not work correctly.
168
-     *
169
-     * This method must return a relative principal path, or null, if the
170
-     * principal was not found or you refuse to find it.
171
-     *
172
-     * @param string $uri
173
-     * @return string
174
-     */
175
-    public function findByUri($uri) {
176
-
177
-        return $this->principalBackend->findByUri($uri, $this->principalPrefix);
178
-
179
-    }
22
+	/**
23
+	 * Principal backend
24
+	 *
25
+	 * @var PrincipalBackend\BackendInterface
26
+	 */
27
+	protected $principalBackend;
28
+
29
+	/**
30
+	 * The path to the principals we're listing from.
31
+	 *
32
+	 * @var string
33
+	 */
34
+	protected $principalPrefix;
35
+
36
+	/**
37
+	 * If this value is set to true, it effectively disables listing of users
38
+	 * it still allows user to find other users if they have an exact url.
39
+	 *
40
+	 * @var bool
41
+	 */
42
+	public $disableListing = false;
43
+
44
+	/**
45
+	 * Creates the object
46
+	 *
47
+	 * This object must be passed the principal backend. This object will
48
+	 * filter all principals from a specified prefix ($principalPrefix). The
49
+	 * default is 'principals', if your principals are stored in a different
50
+	 * collection, override $principalPrefix
51
+	 *
52
+	 *
53
+	 * @param PrincipalBackend\BackendInterface $principalBackend
54
+	 * @param string $principalPrefix
55
+	 */
56
+	public function __construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix = 'principals') {
57
+
58
+		$this->principalPrefix = $principalPrefix;
59
+		$this->principalBackend = $principalBackend;
60
+
61
+	}
62
+
63
+	/**
64
+	 * This method returns a node for a principal.
65
+	 *
66
+	 * The passed array contains principal information, and is guaranteed to
67
+	 * at least contain a uri item. Other properties may or may not be
68
+	 * supplied by the authentication backend.
69
+	 *
70
+	 * @param array $principalInfo
71
+	 * @return IPrincipal
72
+	 */
73
+	abstract function getChildForPrincipal(array $principalInfo);
74
+
75
+	/**
76
+	 * Returns the name of this collection.
77
+	 *
78
+	 * @return string
79
+	 */
80
+	public function getName() {
81
+
82
+		list(, $name) = URLUtil::splitPath($this->principalPrefix);
83
+		return $name;
84
+
85
+	}
86
+
87
+	/**
88
+	 * Return the list of users
89
+	 *
90
+	 * @return array
91
+	 */
92
+	public function getChildren() {
93
+
94
+		if ($this->disableListing)
95
+			throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
96
+
97
+		$children = [];
98
+		foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
99
+
100
+			$children[] = $this->getChildForPrincipal($principalInfo);
101
+
102
+
103
+		}
104
+		return $children;
105
+
106
+	}
107
+
108
+	/**
109
+	 * Returns a child object, by its name.
110
+	 *
111
+	 * @param string $name
112
+	 * @throws DAV\Exception\NotFound
113
+	 * @return IPrincipal
114
+	 */
115
+	public function getChild($name) {
116
+
117
+		$principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
118
+		if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
119
+		return $this->getChildForPrincipal($principalInfo);
120
+
121
+	}
122
+
123
+	/**
124
+	 * This method is used to search for principals matching a set of
125
+	 * properties.
126
+	 *
127
+	 * This search is specifically used by RFC3744's principal-property-search
128
+	 * REPORT. You should at least allow searching on
129
+	 * http://sabredav.org/ns}email-address.
130
+	 *
131
+	 * The actual search should be a unicode-non-case-sensitive search. The
132
+	 * keys in searchProperties are the WebDAV property names, while the values
133
+	 * are the property values to search on.
134
+	 *
135
+	 * By default, if multiple properties are submitted to this method, the
136
+	 * various properties should be combined with 'AND'. If $test is set to
137
+	 * 'anyof', it should be combined using 'OR'.
138
+	 *
139
+	 * This method should simply return a list of 'child names', which may be
140
+	 * used to call $this->getChild in the future.
141
+	 *
142
+	 * @param array $searchProperties
143
+	 * @param string $test
144
+	 * @return array
145
+	 */
146
+	public function searchPrincipals(array $searchProperties, $test = 'allof') {
147
+
148
+		$result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties, $test);
149
+		$r = [];
150
+
151
+		foreach ($result as $row) {
152
+			list(, $r[]) = URLUtil::splitPath($row);
153
+		}
154
+
155
+		return $r;
156
+
157
+	}
158
+
159
+	/**
160
+	 * Finds a principal by its URI.
161
+	 *
162
+	 * This method may receive any type of uri, but mailto: addresses will be
163
+	 * the most common.
164
+	 *
165
+	 * Implementation of this API is optional. It is currently used by the
166
+	 * CalDAV system to find principals based on their email addresses. If this
167
+	 * API is not implemented, some features may not work correctly.
168
+	 *
169
+	 * This method must return a relative principal path, or null, if the
170
+	 * principal was not found or you refuse to find it.
171
+	 *
172
+	 * @param string $uri
173
+	 * @return string
174
+	 */
175
+	public function findByUri($uri) {
176
+
177
+		return $this->principalBackend->findByUri($uri, $this->principalPrefix);
178
+
179
+	}
180 180
 
181 181
 }
Please login to merge, or discard this patch.
libraries/SabreDAV/DAVACL/FS/Collection.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,12 @@
 block discarded – undo
59 59
 
60 60
         $path = $this->path . '/' . $name;
61 61
 
62
-        if (!file_exists($path)) throw new NotFound('File could not be located');
63
-        if ($name == '.' || $name == '..') throw new Forbidden('Permission denied to . and ..');
62
+        if (!file_exists($path)) {
63
+        	throw new NotFound('File could not be located');
64
+        }
65
+        if ($name == '.' || $name == '..') {
66
+        	throw new Forbidden('Permission denied to . and ..');
67
+        }
64 68
 
65 69
         if (is_dir($path)) {
66 70
 
Please login to merge, or discard this patch.
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Sabre\DAVACL\FS;
4 4
 
5
-use Sabre\DAV\FSExt\Directory as BaseCollection;
6 5
 use Sabre\DAVACL\IACL;
7 6
 use Sabre\DAV\Exception\Forbidden;
8 7
 use Sabre\DAV\Exception\NotFound;
8
+use Sabre\DAV\FSExt\Directory as BaseCollection;
9 9
 
10 10
 /**
11 11
  * This is an ACL-enabled collection.
Please login to merge, or discard this patch.
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -16,138 +16,138 @@
 block discarded – undo
16 16
  */
17 17
 class Collection extends BaseCollection implements IACL {
18 18
 
19
-    /**
20
-     * A list of ACL rules.
21
-     *
22
-     * @var array
23
-     */
24
-    protected $acl;
25
-
26
-    /**
27
-     * Owner uri, or null for no owner.
28
-     *
29
-     * @var string|null
30
-     */
31
-    protected $owner;
32
-
33
-    /**
34
-     * Constructor
35
-     *
36
-     * @param string $path on-disk path.
37
-     * @param array $acl ACL rules.
38
-     * @param string|null $owner principal owner string.
39
-     */
40
-    public function __construct($path, array $acl, $owner = null) {
41
-
42
-        parent::__construct($path);
43
-        $this->acl = $acl;
44
-        $this->owner = $owner;
45
-
46
-    }
47
-
48
-    /**
49
-     * Returns a specific child node, referenced by its name
50
-     *
51
-     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
52
-     * exist.
53
-     *
54
-     * @param string $name
55
-     * @throws DAV\Exception\NotFound
56
-     * @return DAV\INode
57
-     */
58
-    public function getChild($name) {
59
-
60
-        $path = $this->path . '/' . $name;
61
-
62
-        if (!file_exists($path)) throw new NotFound('File could not be located');
63
-        if ($name == '.' || $name == '..') throw new Forbidden('Permission denied to . and ..');
64
-
65
-        if (is_dir($path)) {
66
-
67
-            return new self($path, $this->acl, $this->owner);
68
-
69
-        } else {
70
-
71
-            return new File($path, $this->acl, $this->owner);
72
-
73
-        }
74
-
75
-    }
76
-
77
-    /**
78
-     * Returns the owner principal
79
-     *
80
-     * This must be a url to a principal, or null if there's no owner
81
-     *
82
-     * @return string|null
83
-     */
84
-    public function getOwner() {
85
-
86
-        return $this->owner;
87
-
88
-    }
89
-
90
-    /**
91
-     * Returns a group principal
92
-     *
93
-     * This must be a url to a principal, or null if there's no owner
94
-     *
95
-     * @return string|null
96
-     */
97
-    public function getGroup() {
98
-
99
-        return null;
100
-
101
-    }
102
-
103
-    /**
104
-     * Returns a list of ACE's for this node.
105
-     *
106
-     * Each ACE has the following properties:
107
-     *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
108
-     *     currently the only supported privileges
109
-     *   * 'principal', a url to the principal who owns the node
110
-     *   * 'protected' (optional), indicating that this ACE is not allowed to
111
-     *      be updated.
112
-     *
113
-     * @return array
114
-     */
115
-    public function getACL() {
116
-
117
-        return $this->acl;
118
-
119
-    }
120
-
121
-    /**
122
-     * Updates the ACL
123
-     *
124
-     * This method will receive a list of new ACE's as an array argument.
125
-     *
126
-     * @param array $acl
127
-     * @return void
128
-     */
129
-    public function setACL(array $acl) {
130
-
131
-        throw new Forbidden('Setting ACL is not allowed here');
132
-
133
-    }
134
-
135
-    /**
136
-     * Returns the list of supported privileges for this node.
137
-     *
138
-     * The returned data structure is a list of nested privileges.
139
-     * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple
140
-     * standard structure.
141
-     *
142
-     * If null is returned from this method, the default privilege set is used,
143
-     * which is fine for most common usecases.
144
-     *
145
-     * @return array|null
146
-     */
147
-    public function getSupportedPrivilegeSet() {
148
-
149
-        return null;
150
-
151
-    }
19
+	/**
20
+	 * A list of ACL rules.
21
+	 *
22
+	 * @var array
23
+	 */
24
+	protected $acl;
25
+
26
+	/**
27
+	 * Owner uri, or null for no owner.
28
+	 *
29
+	 * @var string|null
30
+	 */
31
+	protected $owner;
32
+
33
+	/**
34
+	 * Constructor
35
+	 *
36
+	 * @param string $path on-disk path.
37
+	 * @param array $acl ACL rules.
38
+	 * @param string|null $owner principal owner string.
39
+	 */
40
+	public function __construct($path, array $acl, $owner = null) {
41
+
42
+		parent::__construct($path);
43
+		$this->acl = $acl;
44
+		$this->owner = $owner;
45
+
46
+	}
47
+
48
+	/**
49
+	 * Returns a specific child node, referenced by its name
50
+	 *
51
+	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
52
+	 * exist.
53
+	 *
54
+	 * @param string $name
55
+	 * @throws DAV\Exception\NotFound
56
+	 * @return DAV\INode
57
+	 */
58
+	public function getChild($name) {
59
+
60
+		$path = $this->path . '/' . $name;
61
+
62
+		if (!file_exists($path)) throw new NotFound('File could not be located');
63
+		if ($name == '.' || $name == '..') throw new Forbidden('Permission denied to . and ..');
64
+
65
+		if (is_dir($path)) {
66
+
67
+			return new self($path, $this->acl, $this->owner);
68
+
69
+		} else {
70
+
71
+			return new File($path, $this->acl, $this->owner);
72
+
73
+		}
74
+
75
+	}
76
+
77
+	/**
78
+	 * Returns the owner principal
79
+	 *
80
+	 * This must be a url to a principal, or null if there's no owner
81
+	 *
82
+	 * @return string|null
83
+	 */
84
+	public function getOwner() {
85
+
86
+		return $this->owner;
87
+
88
+	}
89
+
90
+	/**
91
+	 * Returns a group principal
92
+	 *
93
+	 * This must be a url to a principal, or null if there's no owner
94
+	 *
95
+	 * @return string|null
96
+	 */
97
+	public function getGroup() {
98
+
99
+		return null;
100
+
101
+	}
102
+
103
+	/**
104
+	 * Returns a list of ACE's for this node.
105
+	 *
106
+	 * Each ACE has the following properties:
107
+	 *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
108
+	 *     currently the only supported privileges
109
+	 *   * 'principal', a url to the principal who owns the node
110
+	 *   * 'protected' (optional), indicating that this ACE is not allowed to
111
+	 *      be updated.
112
+	 *
113
+	 * @return array
114
+	 */
115
+	public function getACL() {
116
+
117
+		return $this->acl;
118
+
119
+	}
120
+
121
+	/**
122
+	 * Updates the ACL
123
+	 *
124
+	 * This method will receive a list of new ACE's as an array argument.
125
+	 *
126
+	 * @param array $acl
127
+	 * @return void
128
+	 */
129
+	public function setACL(array $acl) {
130
+
131
+		throw new Forbidden('Setting ACL is not allowed here');
132
+
133
+	}
134
+
135
+	/**
136
+	 * Returns the list of supported privileges for this node.
137
+	 *
138
+	 * The returned data structure is a list of nested privileges.
139
+	 * See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple
140
+	 * standard structure.
141
+	 *
142
+	 * If null is returned from this method, the default privilege set is used,
143
+	 * which is fine for most common usecases.
144
+	 *
145
+	 * @return array|null
146
+	 */
147
+	public function getSupportedPrivilegeSet() {
148
+
149
+		return null;
150
+
151
+	}
152 152
 
153 153
 }
Please login to merge, or discard this patch.