Passed
Pull Request — master (#46)
by Neo
33:01
created
api/src/WebDAV/Tools/_parse_proppatch.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param boolean $store_request =false if true whole request data will be made available in $this->request
98 98
      * @access public
99 99
      */
100
-    function __construct($path, $store_request=false)
100
+    function __construct($path, $store_request = false)
101 101
     {
102 102
         $this->success = true;
103 103
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         xml_parser_set_option($xml_parser,
124 124
                               XML_OPTION_CASE_FOLDING, false);
125 125
 
126
-        while($this->success && !feof($f_in)) {
126
+        while ($this->success && !feof($f_in)) {
127 127
             $line = fgets($f_in);
128 128
             if ($store_request) $this->request .= $line;
129 129
             if (is_string($line)) {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             }
133 133
         }
134 134
 
135
-        if($had_input) {
135
+        if ($had_input) {
136 136
             $this->success &= xml_parse($xml_parser, "", true);
137 137
         }
138 138
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $prop = array("name" => $tag);
170 170
             $this->current = array("name" => $tag, "ns" => $ns, "status"=> 200);
171 171
             if ($this->mode == "set") {
172
-                $this->current["val"] = "";     // default set val
172
+                $this->current["val"] = ""; // default set val
173 173
             }
174 174
         }
175 175
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $this->current["val"] .= "<$tag";
178 178
             if (isset($attr)) {
179 179
                 foreach ($attr as $key => $val) {
180
-                    $this->current["val"] .= ' '.$key.'="'.str_replace('"','&quot;', $val).'"';
180
+                    $this->current["val"] .= ' '.$key.'="'.str_replace('"', '&quot;', $val).'"';
181 181
                 }
182 182
             }
183 183
             $this->current["val"] .= ">";
Please login to merge, or discard this patch.
api/src/WebDAV/Server/Filesystem.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     function PROPFIND(&$options, &$files)
152 152
     {
153 153
         // get absolute fs path to requested resource
154
-        $fspath = $this->base . $options["path"];
154
+        $fspath = $this->base.$options["path"];
155 155
 
156 156
         // sanity check
157 157
         if (!file_exists($fspath)) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     function fileinfo($path)
199 199
     {
200 200
         // map URI path to filesystem path
201
-        $fspath = $this->base . $path;
201
+        $fspath = $this->base.$path;
202 202
 
203 203
         // create result array
204 204
         $info = array();
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
         $info["props"][] = $this->mkprop("displayname", strtoupper($path));
211 211
 
212 212
         // creation and modification time
213
-        $info["props"][] = $this->mkprop("creationdate",    filectime($fspath));
213
+        $info["props"][] = $this->mkprop("creationdate", filectime($fspath));
214 214
         $info["props"][] = $this->mkprop("getlastmodified", filemtime($fspath));
215 215
 
216 216
         // Microsoft extensions: last access time and 'hidden' status
217
-        $info["props"][] = $this->mkprop("lastaccessed",    fileatime($fspath));
217
+        $info["props"][] = $this->mkprop("lastaccessed", fileatime($fspath));
218 218
         $info["props"][] = $this->mkprop("ishidden", ('.' === substr(basename($fspath), 0, 1)));
219 219
 
220 220
         // type and size (caller already made sure that path exists)
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
             // so we test the format of the returned string
342 342
 
343 343
             // the reply begins with the requested filename
344
-            if (!strncmp($reply, "$fspath: ", strlen($fspath)+2)) {
345
-                $reply = substr($reply, strlen($fspath)+2);
344
+            if (!strncmp($reply, "$fspath: ", strlen($fspath) + 2)) {
345
+                $reply = substr($reply, strlen($fspath) + 2);
346 346
                 // followed by the mime type (maybe including options)
347 347
                 if (preg_match('|^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*|', $reply, $matches)) {
348 348
                     $mime_type = $matches[0];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     function HEAD(&$options)
393 393
     {
394 394
         // get absolute fs path to requested resource
395
-        $fspath = $this->base . $options["path"];
395
+        $fspath = $this->base.$options["path"];
396 396
 
397 397
         // sanity check
398 398
         if (!file_exists($fspath)) return false;
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     function GET(&$options)
422 422
     {
423 423
         // get absolute fs path to requested resource
424
-        $fspath = $this->base . $options["path"];
424
+        $fspath = $this->base.$options["path"];
425 425
 
426 426
         // is this a collection?
427 427
         if (is_dir($fspath)) {
@@ -504,14 +504,14 @@  discard block
 block discarded – undo
504 504
      */
505 505
     function PUT(&$options)
506 506
     {
507
-        $fspath = $this->base . $options["path"];
507
+        $fspath = $this->base.$options["path"];
508 508
 
509 509
         $dir = dirname($fspath);
510 510
         if (!file_exists($dir) || !is_dir($dir)) {
511 511
             return "409 Conflict"; // TODO right status code for both?
512 512
         }
513 513
 
514
-        $options["new"] = ! file_exists($fspath);
514
+        $options["new"] = !file_exists($fspath);
515 515
 
516 516
         if ($options["new"] && !$this->_is_writable($dir)) {
517 517
             return "403 Forbidden";
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
      */
538 538
     function MKCOL($options)
539 539
     {
540
-        $path   = $this->base .$options["path"];
540
+        $path   = $this->base.$options["path"];
541 541
         $parent = dirname($path);
542 542
         $name   = basename($path);
543 543
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
             return "403 Forbidden";
550 550
         }
551 551
 
552
-        if ( file_exists($parent."/".$name) ) {
552
+        if (file_exists($parent."/".$name)) {
553 553
             return "405 Method not allowed";
554 554
         }
555 555
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
      */
575 575
     function DELETE($options)
576 576
     {
577
-        $path = $this->base . "/" .$options["path"];
577
+        $path = $this->base."/".$options["path"];
578 578
 
579 579
         if (!file_exists($path)) {
580 580
             return "404 Not found";
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      * @param  array  general parameter passing array
614 614
      * @return bool   true on success
615 615
      */
616
-    function COPY($options, $del=false)
616
+    function COPY($options, $del = false)
617 617
     {
618 618
         // TODO Property updates still broken (Litmus should detect this?)
619 619
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
             return "502 bad gateway";
627 627
         }
628 628
 
629
-        $source = $this->base . $options["path"];
629
+        $source = $this->base.$options["path"];
630 630
         if (!file_exists($source)) {
631 631
             return "404 Not found";
632 632
         }
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
             }
647 647
         }
648 648
 
649
-        $dest         = $this->base . $options["dest"];
649
+        $dest         = $this->base.$options["dest"];
650 650
         $destdir      = dirname($dest);
651 651
 
652 652
         if (!file_exists($destdir) || !is_dir($destdir)) {
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
     function LOCK(&$options)
796 796
     {
797 797
         // get absolute fs path to requested resource
798
-        $fspath = $this->base . $options["path"];
798
+        $fspath = $this->base.$options["path"];
799 799
 
800 800
         // TODO recursive locks on directories not supported yet
801 801
         // makes litmus test "32. lock_collection" fail
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
             return "409 Conflict";
804 804
         }
805 805
 
806
-        $options["timeout"] = time()+300; // 5min. hardcoded
806
+        $options["timeout"] = time() + 300; // 5min. hardcoded
807 807
 
808 808
         if (isset($options["update"])) { // Lock Update
809 809
             $where = "WHERE path = '$options[path]' AND token = '$options[update]'";
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 
823 823
                 $options['owner'] = $row['owner'];
824 824
                 $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared";
825
-                $options['type']  = $row["exclusivelock"] ? "write"     : "read";
825
+                $options['type']  = $row["exclusivelock"] ? "write" : "read";
826 826
 
827 827
                 return true;
828 828
             } else {
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
                           , modified = ".time()."
838 838
                           , owner   = '$options[owner]'
839 839
                           , expires = '$options[timeout]'
840
-                          , exclusivelock  = " .($options['scope'] === "exclusive" ? "1" : "0")
840
+                          , exclusivelock  = ".($options['scope'] === "exclusive" ? "1" : "0")
841 841
             ;
842 842
         mysql_query($query);
843 843
 
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
             mysql_free_result($res);
882 882
 
883 883
             if ($row) {
884
-                $result = array( "type"    => "write",
884
+                $result = array("type"    => "write",
885 885
                                  "scope"   => $row["exclusivelock"] ? "exclusive" : "shared",
886 886
                                  "depth"   => 0,
887 887
                                  "owner"   => $row['owner'],
Please login to merge, or discard this patch.
api/src/Header/ContentSecurityPolicy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		'script-src'  => array("'unsafe-eval'"),
34 34
 		'style-src'   => array("'unsafe-inline'"),
35 35
 		'connect-src' => array(),
36
-		'frame-src'   => null,	// NOT array(), to allow setting no default frame-src!
36
+		'frame-src'   => null, // NOT array(), to allow setting no default frame-src!
37 37
 	);
38 38
 
39 39
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				$attrs = array('www.egroupware.org');
56 56
 				if (($app_additional = Api\Hooks::process('csp-frame-src')))
57 57
 				{
58
-					foreach($app_additional as $addtional)
58
+					foreach ($app_additional as $addtional)
59 59
 					{
60 60
 						if ($addtional) $attrs = array_unique(array_merge($attrs, $addtional));
61 61
 					}
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 			}
64 64
 			self::$sources[$source] = array();
65 65
 		}
66
-		foreach((array)$attrs as $attr)
66
+		foreach ((array)$attrs as $attr)
67 67
 		{
68 68
 			if (in_array($attr, array('none', 'self', 'unsafe-eval', 'unsafe-inline')))
69 69
 			{
70
-				$attr = "'$attr'";	// automatic add quotes
70
+				$attr = "'$attr'"; // automatic add quotes
71 71
 			}
72 72
 			if (!in_array($attr, self::$sources[$source]))
73 73
 			{
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @param string|array $set =array() 'unsafe-eval' and/or 'unsafe-inline' (without quotes!) or URL (incl. protocol!)
90 90
 	 */
91
-	public static function add_script_src($set=null)
91
+	public static function add_script_src($set = null)
92 92
 	{
93 93
 		self::add('script-src', $set);
94 94
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param string|array $set =array() 'unsafe-inline' (without quotes!) and/or URL (incl. protocol!)
102 102
 	 */
103
-	public static function add_style_src($set=null)
103
+	public static function add_style_src($set = null)
104 104
 	{
105 105
 		self::add('style-src', $set);
106 106
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param string|array $set =array() URL (incl. protocol!)
112 112
 	 */
113
-	public static function add_connect_src($set=null)
113
+	public static function add_connect_src($set = null)
114 114
 	{
115 115
 		self::add('connect-src', $set);
116 116
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @param string|array $set =array() URL (incl. protocol!)
124 124
 	 * @return string with attributes eg. "'unsafe-inline'"
125 125
 	 */
126
-	public static function add_frame_src($set=null)
126
+	public static function add_frame_src($set = null)
127 127
 	{
128 128
 		self::add('frame-src', $set);
129 129
 	}
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public static function send()
137 137
 	{
138
-		self::add('frame-src', null);	// set defaults for frame-src
138
+		self::add('frame-src', null); // set defaults for frame-src
139 139
 
140 140
 		$policies = array();
141
-		foreach(self::$sources as $source => $urls)
141
+		foreach (self::$sources as $source => $urls)
142 142
 		{
143 143
 			$policies[] = "$source 'self' ".implode(' ', $urls);
144 144
 		}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		// recommendaton ist to not send regular AND deprecated headers together, as they can cause unexpected behavior
153 153
 		if ($user_agent == 'chrome' && $version < 25 || $user_agent == 'safari' && $version < 7)
154 154
 		{
155
-			header("X-Webkit-CSP: $csp");	// Chrome: <= 24, Safari incl. iOS
155
+			header("X-Webkit-CSP: $csp"); // Chrome: <= 24, Safari incl. iOS
156 156
 		}
157 157
 		elseif ($user_agent == 'firefox' && $version < 23 || $user_agent == 'msie')	// Edge is reported as 'edge'!
158 158
 		{
Please login to merge, or discard this patch.
api/src/Header/UserAgent.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		// should be Ok for all HTML 4 compatible browsers
78 78
 		$parts = $all_parts = null;
79
-		if(!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$parts))
79
+		if (!preg_match('/compatible; ([a-z]+)[\/ ]+([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $parts))
80 80
 		{
81
-			preg_match_all('/([a-z]+)\/([0-9.]+)/i',$_SERVER['HTTP_USER_AGENT'],$all_parts,PREG_SET_ORDER);
81
+			preg_match_all('/([a-z]+)\/([0-9.]+)/i', $_SERVER['HTTP_USER_AGENT'], $all_parts, PREG_SET_ORDER);
82 82
 			$parts = array_pop($all_parts);
83
-			foreach($all_parts as $p)
83
+			foreach ($all_parts as $p)
84 84
 			{
85 85
 				if ($p[1] == 'Chrome' && $parts[1] != 'Edge')
86 86
 				{
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 				}
90 90
 			}
91 91
 		}
92
-		list(,self::$user_agent,self::$ua_version) = $parts;
92
+		list(,self::$user_agent, self::$ua_version) = $parts;
93 93
 		if ((self::$user_agent = strtolower(self::$user_agent)) == 'version') self::$user_agent = 'opera';
94 94
 		// IE no longer reports MSIE, but "Trident/7.0; rv:11.0"
95
-		if (self::$user_agent=='trident')
95
+		if (self::$user_agent == 'trident')
96 96
 		{
97
-			self::$user_agent='msie';
97
+			self::$user_agent = 'msie';
98 98
 			$matches = null;
99 99
 			self::$ua_version = preg_match('|Trident/[0-9.]+; rv:([0-9.]+)|i', $_SERVER['HTTP_USER_AGENT'], $matches) ?
100 100
 				$matches[1] : 11.0;
Please login to merge, or discard this patch.
api/src/Header/Referer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @return string
27 27
 	 * @todo get "real" referer for jDots template
28 28
 	 */
29
-	static function get($default='',$referer='')
29
+	static function get($default = '', $referer = '')
30 30
 	{
31 31
 		// HTTP_REFERER seems NOT to get urldecoded
32 32
 		if (!$referer) $referer = urldecode($_SERVER['HTTP_REFERER']);
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 		$webserver_url = $GLOBALS['egw_info']['server']['webserver_url'];
35 35
 		if (empty($webserver_url) || $webserver_url{0} == '/')	// url is just a path
36 36
 		{
37
-			$referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer);	// removing the domain part
37
+			$referer = preg_replace('/^https?:\/\/[^\/]+/', '', $referer); // removing the domain part
38 38
 		}
39 39
 		if (strlen($webserver_url) > 1)
40 40
 		{
41
-			list(,$referer) = explode($webserver_url,$referer,2);
41
+			list(,$referer) = explode($webserver_url, $referer, 2);
42 42
 		}
43 43
 		$ret = str_replace('/etemplate/process_exec.php', '/index.php', $referer);
44 44
 
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Entry.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param string $cname
62 62
 	 */
63
-	public function beforeSendToClient($cname, array $expand=array())
63
+	public function beforeSendToClient($cname, array $expand = array())
64 64
 	{
65 65
 		$attrs = $this->attrs;
66 66
 
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 		$attrs['id'] = $this->id;
69 69
 
70 70
 		$form_name = self::form_name($cname, $this->id);
71
-		$data_id = $attrs['value'] ? self::form_name($cname, $attrs['value']) : self::form_name($cname, self::ID_PREFIX . $this->id);
71
+		$data_id = $attrs['value'] ? self::form_name($cname, $attrs['value']) : self::form_name($cname, self::ID_PREFIX.$this->id);
72 72
 
73 73
 		// No need to proceed
74
-		if(!$data_id) return;
74
+		if (!$data_id) return;
75 75
 
76 76
 		// Find out which record to load
77 77
 		$value = self::get_array(self::$request->content, $form_name, false, true);
78
-		if(!$value)
78
+		if (!$value)
79 79
 		{
80 80
 			// Try here...  legacy / fallback / just make it work
81 81
 			$value = self::get_array(self::$request->content, $data_id, true, false);
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
 		{
86 86
 			// Get the record itself
87 87
 			$data = self::get_array(self::$request->content, $data_id, true, false);
88
-			if(!$data)
88
+			if (!$data)
89 89
 			{
90 90
 				$data = static::get_entry($value, $attrs);
91 91
 			}
92 92
 		}
93 93
 
94 94
 		// Set the new value so transformer can find it.  Use prefix to avoid changing the original value
95
-		$new_value =& self::get_array(self::$request->content, self::ID_PREFIX .$this->id, true, false);
95
+		$new_value = & self::get_array(self::$request->content, self::ID_PREFIX.$this->id, true, false);
96 96
 		if (true) $new_value = $data;
97
-		$this->id = self::ID_PREFIX . $this->id . "[{$attrs['field']}]";
97
+		$this->id = self::ID_PREFIX.$this->id."[{$attrs['field']}]";
98 98
 
99 99
 		$old_type = self::getElementAttribute($this->id, 'type');
100 100
 
101 101
 		parent::beforeSendToClient($cname, $expand);
102 102
 
103 103
 		// Check for conflict - more than one with same id/field and different type
104
-		if($old_type && $old_type != $this->type)
104
+		if ($old_type && $old_type != $this->type)
105 105
 		{
106 106
 			//self::set_validation_error($this->id, lang('%1, duplicate ID', $this));
107 107
 		}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Transformer.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @param string $cname
75 75
 	 */
76
-	public function beforeSendToClient($cname, array $expand=array())
76
+	public function beforeSendToClient($cname, array $expand = array())
77 77
 	{
78 78
 		$attrs = $this->attrs;
79 79
 		$form_name = self::form_name($cname, $this->id);
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 			error_log(__METHOD__."() $this has no id!");
83 83
 			return;
84 84
 		}
85
-		$attrs['value'] = $value =& self::get_array(self::$request->content, $form_name, false, true);
85
+		$attrs['value'] = $value = & self::get_array(self::$request->content, $form_name, false, true);
86 86
 		$attrs['type'] = $this->type;
87 87
 		$attrs['id'] = $this->id;
88 88
 
89 89
 		$unmodified = $attrs;
90 90
 
91 91
 		// run the transformation
92
-		foreach(static::$transformation as $filter => $data)
92
+		foreach (static::$transformation as $filter => $data)
93 93
 		{
94 94
 			$this->action($filter, $data, $attrs);
95 95
 		}
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 		//echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified));
98 98
 		// compute the difference and send it to the client as modifications
99 99
 		$type_changed = false;
100
-		foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val)
100
+		foreach (array_diff_assoc($attrs, $unmodified) as $attr => $val)
101 101
 		{
102
-			switch($attr)
102
+			switch ($attr)
103 103
 			{
104 104
 				case 'value':
105 105
 					if ($val != $value)
106 106
 					{
107
-						$value = $val;	// $value is reference to self::$request->content
107
+						$value = $val; // $value is reference to self::$request->content
108 108
 					}
109 109
 					break;
110 110
 				case 'sel_options':
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 					break;
113 113
 				case 'type':	// not an attribute in etemplate2
114 114
 					$type_changed = true;
115
-					if($val == 'template')
115
+					if ($val == 'template')
116 116
 					{
117 117
 						// If the widget has been transformed into a template, we
118 118
 						// also need to try and instanciate & parse the template too
119 119
 						$transformed_template = Template::instance($attrs['template']);
120
-						if($transformed_template)
120
+						if ($transformed_template)
121 121
 						{
122 122
 							$this->expand_widget($transformed_template, $expand);
123
-							$transformed_template->run('beforeSendToClient',array($cname,$expand));
123
+							$transformed_template->run('beforeSendToClient', array($cname, $expand));
124 124
 						}
125 125
 						$type_changed = false;
126 126
 					}
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 					break;
130 130
 			}
131 131
 		}
132
-		if($type_changed)
132
+		if ($type_changed)
133 133
 		{
134 134
 			// Run the new widget type's beforeSendToClient
135
-			$expanded_child = self::factory($attrs['type'], false,$this->id);
135
+			$expanded_child = self::factory($attrs['type'], false, $this->id);
136 136
 			$expanded_child->id = $this->id;
137 137
 			$expanded_child->type = $attrs['type'];
138 138
 			$expanded_child->attrs = $attrs;
139
-			$expanded_child->run('beforeSendToClient',array($cname,$expand));
139
+			$expanded_child->run('beforeSendToClient', array($cname, $expand));
140 140
 		}
141 141
 	}
142 142
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			if (strpos($action, '@') !== false)
159 159
 			{
160 160
 				$replace = array();
161
-				foreach($attrs as $a => $v)
161
+				foreach ($attrs as $a => $v)
162 162
 				{
163 163
 					if (is_scalar($v) || is_null($v)) $replace['@'.$a] = $v;
164 164
 				}
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 				// now replace with non-scalar value, eg. if values is an array: "@value", "@value[key] or "@value[@key]"
167 167
 				if (($a = strstr($action, '@')))
168 168
 				{
169
-					$action = self::get_array($attrs, substr($a,1));
169
+					$action = self::get_array($attrs, substr($a, 1));
170 170
 				}
171 171
 			}
172 172
 			$attrs[$attr] = $action;
173 173
 			if (self::DEBUG) error_log(__METHOD__."('$attr', ".array2string($action).") attrs['$attr'] = ".array2string($action).', attrs='.array2string($attrs));
174 174
 		}
175 175
 		// action is a serverside callback
176
-		elseif(is_array($action) && isset($action['__callback__']))
176
+		elseif (is_array($action) && isset($action['__callback__']))
177 177
 		{
178 178
 			if (!is_string(($callback = $action['__callback__'])))
179 179
 			{
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			{
184 184
 				$attrs[$attr] = $this->$callback($attrs[$attr], $attrs);
185 185
 			}
186
-			elseif(count(explode('.', $callback)) == 3)
186
+			elseif (count(explode('.', $callback)) == 3)
187 187
 			{
188 188
 				$attrs[$attr] = ExecMethod($callback, $attrs[$attr], $attrs);
189 189
 			}
@@ -197,29 +197,29 @@  discard block
 block discarded – undo
197 197
 			}
198 198
 		}
199 199
 		// action is a clientside callback
200
-		elseif(is_array($action) && isset($action['__js__']))
200
+		elseif (is_array($action) && isset($action['__js__']))
201 201
 		{
202 202
 			// nothing to do here
203 203
 		}
204 204
 		// TODO: Might be a better way to handle when value to be set is an array
205
-		elseif(is_array($action) && $attr == 'sel_options')
205
+		elseif (is_array($action) && $attr == 'sel_options')
206 206
 		{
207 207
 			$attrs[$attr] = $action;
208 208
 		}
209 209
 		// action is a switch --> check cases
210
-		elseif(is_array($action))
210
+		elseif (is_array($action))
211 211
 		{
212 212
 			// case matches --> run all actions
213 213
 			if (isset($action[$attrs[$attr]]) || !isset($action[$attrs[$attr]]) && isset($action['__default__']))
214 214
 			{
215 215
 				$actions = isset($action[$attrs[$attr]]) ? $action[$attrs[$attr]] : $action['__default__'];
216
-				if(!is_array($actions))
216
+				if (!is_array($actions))
217 217
 				{
218 218
 					$attrs[$attr] = $actions;
219 219
 					$actions = array($attr => $actions);
220 220
 				}
221 221
 				if (self::DEBUG) error_log(__METHOD__."(attr='$attr', action=".array2string($action).") attrs['$attr']=='{$attrs[$attr]}' --> running actions");
222
-				foreach($actions as $attr => $action)
222
+				foreach ($actions as $attr => $action)
223 223
 				{
224 224
 					$this->action($attr, $action, $attrs);
225 225
 				}
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Contact.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$this->contacts->__construct();
130 130
 		$options = $this->contacts->contact_fields;
131
-		foreach($this->contacts->customfields as $name => $data)
131
+		foreach ($this->contacts->customfields as $name => $data)
132 132
 		{
133 133
 			$options['#'.$name] = $data['label'];
134 134
 		}
@@ -148,28 +148,28 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function get_contact($value, array $attrs)
150 150
 	{
151
-		if (is_array($value) && !(array_key_exists('app',$value) && array_key_exists('id', $value))) return $value;
151
+		if (is_array($value) && !(array_key_exists('app', $value) && array_key_exists('id', $value))) return $value;
152 152
 
153
-		if(is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id'];
154
-		switch($attrs['type'])
153
+		if (is_array($value) && array_key_exists('app', $value) && array_key_exists('id', $value)) $value = $value['id'];
154
+		switch ($attrs['type'])
155 155
 		{
156 156
 			case 'contact-account':
157 157
 			case 'contact-template':
158
-				if (substr($value,0,8) != 'account:')
158
+				if (substr($value, 0, 8) != 'account:')
159 159
 				{
160 160
 					$value = 'account:'.($attrs['name'] != 'account:' ? $value : $GLOBALS['egw_info']['user']['account_id']);
161 161
 				}
162 162
 				// fall-through
163 163
 			case 'contact-value':
164 164
 			default:
165
-				if (substr($value,0,12) == 'addressbook:') $value = substr($value,12);	// link-entry syntax
165
+				if (substr($value, 0, 12) == 'addressbook:') $value = substr($value, 12); // link-entry syntax
166 166
 				if (!($contact = $this->contacts->read($value)))
167 167
 				{
168 168
 					$contact = array();
169 169
 				}
170 170
 				break;
171 171
 		}
172
-		unset($contact['jpegphoto']);	// makes no sense to return binary image
172
+		unset($contact['jpegphoto']); // makes no sense to return binary image
173 173
 
174 174
 		//error_log(__METHOD__."('$value') returning ".array2string($contact));
175 175
 		return $contact;
Please login to merge, or discard this patch.
api/src/Etemplate/Widget/Box.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 	 * @param array $params =array('') parameter(s) first parameter has to be cname!
43 43
 	 * @param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children
44 44
 	 */
45
-	public function run($method_name, $params=array(''), $respect_disabled=false)
45
+	public function run($method_name, $params = array(''), $respect_disabled = false)
46 46
 	{
47
-		$cname =& $params[0];
48
-		$expand =& $params[1];
47
+		$cname = & $params[0];
48
+		$expand = & $params[1];
49 49
 		$old_cname = $params[0];
50 50
 		$old_expand = $params[1];
51 51
 
52 52
 		if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]);
53 53
 		if ($expand['cname'] !== $cname && $cname)
54 54
 		{
55
-			$expand['cont'] =& self::get_array(self::$request->content, $cname);
55
+			$expand['cont'] = & self::get_array(self::$request->content, $cname);
56 56
 			$expand['cname'] = $cname;
57 57
 		}
58 58
 		if ($respect_disabled && ($disabled = $this->attrs['disabled'] && self::check_disabled($this->attrs['disabled'], $expand)))
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 
68 68
 		// Expand children
69 69
 		$columns_disabled = null;
70
-		for($n = 0; ; ++$n)
70
+		for ($n = 0; ; ++$n)
71 71
 		{
72 72
 			if (isset($this->children[$n]))
73 73
 			{
74
-				$child =& $this->children[$n];
74
+				$child = & $this->children[$n];
75 75
 				// If type has something that can be expanded, we need to expand it so the correct method is run
76 76
 				$this->expand_widget($child, $expand);
77 77
 			}
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	private function need_autorepeat(Etemplate\Widget $widget, $cname, array $expand)
109 109
 	{
110
-		foreach(array($widget) + $widget->children as $check_widget)
110
+		foreach (array($widget) + $widget->children as $check_widget)
111 111
 		{
112 112
 			$pat = $check_widget->id;
113
-			while(($pattern = strstr($pat, '$')))
113
+			while (($pattern = strstr($pat, '$')))
114 114
 			{
115
-				$pat = substr($pattern,$pattern[1] == '{' ? 2 : 1);
115
+				$pat = substr($pattern, $pattern[1] == '{' ? 2 : 1);
116 116
 
117
-				$Ok = $pat[0] == 'r' && !(substr($pat,0,2) == 'r_' ||
118
-					substr($pat,0,4) == 'row_' && substr($pat,0,8) != 'row_cont');
117
+				$Ok = $pat[0] == 'r' && !(substr($pat, 0, 2) == 'r_' ||
118
+					substr($pat, 0, 4) == 'row_' && substr($pat, 0, 8) != 'row_cont');
119 119
 
120
-				if ($Ok && ($fname=self::form_name($cname, $check_widget->id, $expand)) &&
120
+				if ($Ok && ($fname = self::form_name($cname, $check_widget->id, $expand)) &&
121 121
 					// need to break if fname ends in [] as get_array() will ignore it and returns whole array
122 122
 					// for an id like "run[$row_cont[appname]]"
123 123
 					substr($fname, -2) != '[]' &&
Please login to merge, or discard this patch.