| @@ -25,13 +25,13 @@ discard block | ||
| 25 | 25 |    $message = date('Y-m-d H:i') . ' '; | 
| 26 | 26 | |
| 27 | 27 | // handle the CLI arguments or give a help message | 
| 28 | - if (isset($argv[1]) && ($argv[1] == 0 || $argv[1] == 1) ) | |
| 28 | + if (isset($argv[1]) && ($argv[1] == 0 || $argv[1] == 1)) | |
| 29 | 29 |    { | 
| 30 | 30 | $mode = (int)$argv[1]; | 
| 31 | 31 | } | 
| 32 | 32 | else | 
| 33 | 33 |    { | 
| 34 | -    if ( $fritz->config->getItem('logging') == 'console' ) | |
| 34 | +    if ($fritz->config->getItem('logging') == 'console') | |
| 35 | 35 |      { | 
| 36 | 36 | echo ' | 
| 37 | 37 | Enables or disables an answering machine (TAM) of a Fritz!Box | 
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 | } | 
| 98 | 98 | |
| 99 | 99 | // log the result | 
| 100 | -if ( isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api' ) | |
| 100 | +if (isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api') | |
| 101 | 101 |  { | 
| 102 | 102 | $fritz->logMessage($message); | 
| 103 | 103 | } | 
| @@ -23,11 +23,11 @@ discard block | ||
| 23 | 23 | // init the output message | 
| 24 | 24 |    $message = date('Y-m-d H:i') . ' '; | 
| 25 | 25 | |
| 26 | -  if ( !$fritz->config->getItem('foncallslist_path') ) | |
| 26 | +  if (!$fritz->config->getItem('foncallslist_path')) | |
| 27 | 27 |    { | 
| 28 | 28 |      throw new Exception('Mandatory config Item foncallslist_path not set.'); | 
| 29 | 29 | } | 
| 30 | -  if ( ( file_exists($fritz->config->getItem('foncallslist_path')) && !is_writable($fritz->config->getItem('foncallslist_path')) ) || ( !file_exists($fritz->config->getItem('foncallslist_path')) && !is_writable(dirname($fritz->config->getItem('foncallslist_path'))) ) ) | |
| 30 | +  if ((file_exists($fritz->config->getItem('foncallslist_path')) && !is_writable($fritz->config->getItem('foncallslist_path'))) || (!file_exists($fritz->config->getItem('foncallslist_path')) && !is_writable(dirname($fritz->config->getItem('foncallslist_path'))))) | |
| 31 | 31 |    { | 
| 32 | 32 |      throw new Exception('Config item foncallslist_path (' . $fritz->config->getItem('foncallslist_path') . ') is not writeable.'); | 
| 33 | 33 | } | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | // log the result | 
| 64 | -if ( isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api' ) | |
| 64 | +if (isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api') | |
| 65 | 65 |  { | 
| 66 | 66 | $fritz->logMessage($message); | 
| 67 | 67 | } | 
| @@ -18,7 +18,7 @@ discard block | ||
| 18 | 18 | /** | 
| 19 | 19 | * @var string Current object mode - error, single or multiple (for a single vCard within a file and multiple combined vCards) | 
| 20 | 20 | */ | 
| 21 | - private $Mode; //single, multiple, error | |
| 21 | + private $Mode; //single, multiple, error | |
| 22 | 22 | |
| 23 | 23 | private $Path = ''; | 
| 24 | 24 | private $RawData = ''; | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 |  			{ | 
| 80 | 80 | if (!is_readable($Path)) | 
| 81 | 81 |  				{ | 
| 82 | -					throw new Exception('vCard: Path not accessible ('.$Path.')'); | |
| 82 | +					throw new Exception('vCard: Path not accessible (' . $Path . ')'); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | $this -> Path = $Path; | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 |  				{ | 
| 135 | 135 | // Prepending "BEGIN:VCARD" to the raw string because we exploded on that one. | 
| 136 | 136 | // If there won't be the BEGIN marker in the new object, it will fail. | 
| 137 | - $SinglevCardRawData = 'BEGIN:VCARD'."\n".$SinglevCardRawData; | |
| 137 | + $SinglevCardRawData = 'BEGIN:VCARD' . "\n" . $SinglevCardRawData; | |
| 138 | 138 | |
| 139 | 139 | $ClassName = get_class($this); | 
| 140 | 140 | $this -> Data[] = new $ClassName(false, $SinglevCardRawData); | 
| @@ -377,7 +377,7 @@ discard block | ||
| 377 | 377 | } | 
| 378 | 378 | else | 
| 379 | 379 |  			{ | 
| 380 | -				throw new Exception('vCard: Cannot save file ('.$Key.'), target path not writable ('.$TargetPath.')'); | |
| 380 | +				throw new Exception('vCard: Cannot save file (' . $Key . '), target path not writable (' . $TargetPath . ')'); | |
| 381 | 381 | } | 
| 382 | 382 | return false; | 
| 383 | 383 | } | 
| @@ -458,8 +458,8 @@ discard block | ||
| 458 | 458 | */ | 
| 459 | 459 | public function __toString() | 
| 460 | 460 |  		{ | 
| 461 | - $Text = 'BEGIN:VCARD'.self::endl; | |
| 462 | - $Text .= 'VERSION:3.0'.self::endl; | |
| 461 | + $Text = 'BEGIN:VCARD' . self::endl; | |
| 462 | + $Text .= 'VERSION:3.0' . self::endl; | |
| 463 | 463 | |
| 464 | 464 | foreach ($this -> Data as $Key => $Values) | 
| 465 | 465 |  			{ | 
| @@ -476,7 +476,7 @@ discard block | ||
| 476 | 476 | $Text .= $KeyUC; | 
| 477 | 477 | if (is_array($Value) && isset($Value['type'])) | 
| 478 | 478 |  					{ | 
| 479 | - $Text .= ';TYPE='.self::PrepareTypeStrForOutput($Value['type']); | |
| 479 | + $Text .= ';TYPE=' . self::PrepareTypeStrForOutput($Value['type']); | |
| 480 | 480 | } | 
| 481 | 481 | $Text .= ':'; | 
| 482 | 482 | |
| @@ -502,7 +502,7 @@ discard block | ||
| 502 | 502 | } | 
| 503 | 503 | } | 
| 504 | 504 | |
| 505 | - $Text .= 'END:VCARD'.self::endl; | |
| 505 | + $Text .= 'END:VCARD' . self::endl; | |
| 506 | 506 | return $Text; | 
| 507 | 507 | } | 
| 508 | 508 | |
| @@ -603,7 +603,7 @@ discard block | ||
| 603 | 603 | } | 
| 604 | 604 | elseif (count($Parameter) > 2) | 
| 605 | 605 |  				{ | 
| 606 | -					if(count(explode(',', $RawParams[$Index], -1)) > 0) | |
| 606 | +					if (count(explode(',', $RawParams[$Index], -1)) > 0) | |
| 607 | 607 |  					{ | 
| 608 | 608 |  						$TempTypeParams = self::ParseParameters($Key, explode(',', $RawParams[$Index])); | 
| 609 | 609 | if ($TempTypeParams['type']) | 
| @@ -16,5 +16,5 @@ | ||
| 16 | 16 | |
| 17 | 17 |  	//$vCard = new vCard('Example3.0.vcf'); | 
| 18 | 18 | |
| 19 | - echo '<pre>'.$vCard.'</pre>'; | |
| 19 | + echo '<pre>' . $vCard . '</pre>'; | |
| 20 | 20 | ?> | 
| 21 | 21 | \ No newline at end of file | 
| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 | */ | 
| 35 | 35 | function OutputvCard(vCard $vCard) | 
| 36 | 36 |  	{ | 
| 37 | - echo '<h2>'.$vCard -> FN[0].'</h2>'; | |
| 37 | + echo '<h2>' . $vCard -> FN[0] . '</h2>'; | |
| 38 | 38 | |
| 39 | 39 | if ($vCard -> PHOTO) | 
| 40 | 40 |  		{ | 
| @@ -42,11 +42,11 @@ discard block | ||
| 42 | 42 |  			{ | 
| 43 | 43 | if ($Photo['encoding'] == 'b') | 
| 44 | 44 |  				{ | 
| 45 | - echo '<img src="data:image/'.$Photo['type'][0].';base64,'.$Photo['value'].'" /><br />'; | |
| 45 | + echo '<img src="data:image/' . $Photo['type'][0] . ';base64,' . $Photo['value'] . '" /><br />'; | |
| 46 | 46 | } | 
| 47 | 47 | else | 
| 48 | 48 |  				{ | 
| 49 | - echo '<img src="'.$Photo['value'].'" /><br />'; | |
| 49 | + echo '<img src="' . $Photo['value'] . '" /><br />'; | |
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | 52 | /* | 
| @@ -69,16 +69,15 @@ discard block | ||
| 69 | 69 | |
| 70 | 70 | foreach ($vCard -> N as $Name) | 
| 71 | 71 |  		{ | 
| 72 | - echo '<h3>Name: '.$Name['firstname'].' '.$Name['lastname'].'</h3>'; | |
| 72 | + echo '<h3>Name: ' . $Name['firstname'] . ' ' . $Name['lastname'] . '</h3>'; | |
| 73 | 73 | } | 
| 74 | 74 | |
| 75 | 75 | foreach ($vCard -> ORG as $Organization) | 
| 76 | 76 |  		{ | 
| 77 | - echo '<h3>Organization: '.$Organization['name']. | |
| 77 | + echo '<h3>Organization: ' . $Organization['name'] . | |
| 78 | 78 | ($Organization['unit1'] || $Organization['unit2'] ? | 
| 79 | -					' ('.implode(', ', array($Organization['unit1'], $Organization['unit2'])).')' : | |
| 80 | - '' | |
| 81 | - ).'</h3>'; | |
| 79 | +					' (' . implode(', ', array($Organization['unit1'], $Organization['unit2'])) . ')' : '' | |
| 80 | + ) . '</h3>'; | |
| 82 | 81 | } | 
| 83 | 82 | |
| 84 | 83 | if ($vCard -> TEL) | 
| @@ -88,11 +87,11 @@ discard block | ||
| 88 | 87 |  			{ | 
| 89 | 88 | if (is_scalar($Tel)) | 
| 90 | 89 |  				{ | 
| 91 | - echo $Tel.'<br />'; | |
| 90 | + echo $Tel . '<br />'; | |
| 92 | 91 | } | 
| 93 | 92 | else | 
| 94 | 93 |  				{ | 
| 95 | -					echo $Tel['value'].' ('.implode(', ', $Tel['type']).')<br />'; | |
| 94 | +					echo $Tel['value'] . ' (' . implode(', ', $Tel['type']) . ')<br />'; | |
| 96 | 95 | } | 
| 97 | 96 | } | 
| 98 | 97 | echo '</p>'; | 
| @@ -109,7 +108,7 @@ discard block | ||
| 109 | 108 | } | 
| 110 | 109 | else | 
| 111 | 110 |  				{ | 
| 112 | -					echo $Email['value'].' ('.implode(', ', $Email['type']).')<br />'; | |
| 111 | +					echo $Email['value'] . ' (' . implode(', ', $Email['type']) . ')<br />'; | |
| 113 | 112 | } | 
| 114 | 113 | } | 
| 115 | 114 | echo '</p>'; | 
| @@ -122,11 +121,11 @@ discard block | ||
| 122 | 121 |  			{ | 
| 123 | 122 | if (is_scalar($URL)) | 
| 124 | 123 |  				{ | 
| 125 | - echo $URL.'<br />'; | |
| 124 | + echo $URL . '<br />'; | |
| 126 | 125 | } | 
| 127 | 126 | else | 
| 128 | 127 |  				{ | 
| 129 | - echo $URL['value'].'<br />'; | |
| 128 | + echo $URL['value'] . '<br />'; | |
| 130 | 129 | } | 
| 131 | 130 | } | 
| 132 | 131 | echo '</p>'; | 
| @@ -139,11 +138,11 @@ discard block | ||
| 139 | 138 |  			{ | 
| 140 | 139 | if (is_scalar($IMPP)) | 
| 141 | 140 |  				{ | 
| 142 | - echo $IMPP.'<br />'; | |
| 141 | + echo $IMPP . '<br />'; | |
| 143 | 142 | } | 
| 144 | 143 | else | 
| 145 | 144 |  				{ | 
| 146 | - echo $IMPP['value'].'<br/ >'; | |
| 145 | + echo $IMPP['value'] . '<br/ >'; | |
| 147 | 146 | } | 
| 148 | 147 | } | 
| 149 | 148 | echo '</p>'; | 
| @@ -153,14 +152,14 @@ discard block | ||
| 153 | 152 |  		{ | 
| 154 | 153 | foreach ($vCard -> ADR as $Address) | 
| 155 | 154 |  			{ | 
| 156 | -				echo '<p><h4>Address ('.implode(', ', $Address['type']).')</h4>'; | |
| 157 | - echo 'Street address: <strong>'.($Address['streetaddress'] ? $Address['streetaddress'] : '-').'</strong><br />'. | |
| 158 | - 'PO Box: <strong>'.($Address['pobox'] ? $Address['pobox'] : '-').'</strong><br />'. | |
| 159 | - 'Extended address: <strong>'.($Address['extendedaddress'] ? $Address['extendedaddress'] : '-').'</strong><br />'. | |
| 160 | - 'Locality: <strong>'.($Address['locality'] ? $Address['locality'] : '-').'</strong><br />'. | |
| 161 | - 'Region: <strong>'.($Address['region'] ? $Address['region'] : '-').'</strong><br />'. | |
| 162 | - 'ZIP/Post code: <strong>'.($Address['postalcode'] ? $Address['postalcode'] : '-').'</strong><br />'. | |
| 163 | - 'Country: <strong>'.($Address['country'] ? $Address['country'] : '-').'</strong>'; | |
| 155 | +				echo '<p><h4>Address (' . implode(', ', $Address['type']) . ')</h4>'; | |
| 156 | + echo 'Street address: <strong>' . ($Address['streetaddress'] ? $Address['streetaddress'] : '-') . '</strong><br />' . | |
| 157 | + 'PO Box: <strong>' . ($Address['pobox'] ? $Address['pobox'] : '-') . '</strong><br />' . | |
| 158 | + 'Extended address: <strong>' . ($Address['extendedaddress'] ? $Address['extendedaddress'] : '-') . '</strong><br />' . | |
| 159 | + 'Locality: <strong>' . ($Address['locality'] ? $Address['locality'] : '-') . '</strong><br />' . | |
| 160 | + 'Region: <strong>' . ($Address['region'] ? $Address['region'] : '-') . '</strong><br />' . | |
| 161 | + 'ZIP/Post code: <strong>' . ($Address['postalcode'] ? $Address['postalcode'] : '-') . '</strong><br />' . | |
| 162 | + 'Country: <strong>' . ($Address['country'] ? $Address['country'] : '-') . '</strong>'; | |
| 164 | 163 | } | 
| 165 | 164 | echo '</p>'; | 
| 166 | 165 | } | 
| @@ -172,7 +171,7 @@ discard block | ||
| 172 | 171 |  			{ | 
| 173 | 172 | if (is_scalar($Agent)) | 
| 174 | 173 |  				{ | 
| 175 | - echo '<div class="Agent">'.$Agent.'</div>'; | |
| 174 | + echo '<div class="Agent">' . $Agent . '</div>'; | |
| 176 | 175 | } | 
| 177 | 176 | elseif (is_a($Agent, 'vCard')) | 
| 178 | 177 |  				{ | 
| @@ -208,7 +208,7 @@ discard block | ||
| 208 | 208 | const EXCEPTION_WRONG_HTTP_STATUS_CODE_ADD = 1004; | 
| 209 | 209 | const EXCEPTION_WRONG_HTTP_STATUS_CODE_UPDATE = 1005; | 
| 210 | 210 | const EXCEPTION_MALFORMED_XML_RESPONSE = 1006; | 
| 211 | - const EXCEPTION_COULD_NOT_GENERATE_NEW_VCARD_ID = 1007; | |
| 211 | + const EXCEPTION_COULD_NOT_GENERATE_NEW_VCARD_ID = 1007; | |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | /** | 
| @@ -370,14 +370,14 @@ discard block | ||
| 370 | 370 | switch ($result['http_code']) | 
| 371 | 371 |          { | 
| 372 | 372 | case 404: | 
| 373 | - $altResult = $this->query($this->url . $vcard_id , 'GET'); | |
| 373 | + $altResult = $this->query($this->url . $vcard_id, 'GET'); | |
| 374 | 374 | // DEBUG: print the response of the carddav-server | 
| 375 | 375 | // print_r($altResult); | 
| 376 | 376 | switch ($altResult['http_code']) | 
| 377 | 377 |          	        { | 
| 378 | 378 | case 200: | 
| 379 | 379 | case 207: | 
| 380 | -					print "Ignoring given Vcard Extension (".$this->url_vcard_extension.")" . PHP_EOL. "."; | |
| 380 | +					print "Ignoring given Vcard Extension (" . $this->url_vcard_extension . ")" . PHP_EOL . "."; | |
| 381 | 381 |  					$this->setVcardExtension(""); | 
| 382 | 382 | return $altResult['response']; | 
| 383 | 383 | } | 
| @@ -510,12 +510,12 @@ discard block | ||
| 510 | 510 | public function add($vcard, $vcard_id = null) | 
| 511 | 511 |      { | 
| 512 | 512 |          if ($vcard_id === null) { | 
| 513 | - $vcard_id = $this->generateVcardId(); | |
| 513 | + $vcard_id = $this->generateVcardId(); | |
| 514 | 514 | } | 
| 515 | 515 | $vcard = $this->cleanVcard($vcard); | 
| 516 | 516 | $result = $this->query($this->url . $vcard_id . $this->url_vcard_extension, 'PUT', $vcard, 'text/vcard'); | 
| 517 | 517 | |
| 518 | - switch($result['http_code']) | |
| 518 | + switch ($result['http_code']) | |
| 519 | 519 |          { | 
| 520 | 520 | case 201: | 
| 521 | 521 | return $vcard_id; | 
| @@ -649,7 +649,7 @@ discard block | ||
| 649 | 649 | curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, false); | 
| 650 | 650 | curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false); | 
| 651 | 651 | curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); | 
| 652 | - curl_setopt($this->curl, CURLOPT_USERAGENT, self::USERAGENT.self::VERSION); | |
| 652 | + curl_setopt($this->curl, CURLOPT_USERAGENT, self::USERAGENT . self::VERSION); | |
| 653 | 653 | |
| 654 | 654 |              if ($this->auth !== null) { | 
| 655 | 655 | curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); | 
| @@ -690,7 +690,7 @@ discard block | ||
| 690 | 690 | } | 
| 691 | 691 | |
| 692 | 692 |          if ($content_type !== null) { | 
| 693 | -            curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Content-type: '.$content_type, 'Depth: 1')); | |
| 693 | +            curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Content-type: ' . $content_type, 'Depth: 1')); | |
| 694 | 694 |          } else { | 
| 695 | 695 |              curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Depth: 1')); | 
| 696 | 696 | } | 
| @@ -698,7 +698,7 @@ discard block | ||
| 698 | 698 | $complete_response = curl_exec($this->curl); | 
| 699 | 699 | $header_size = curl_getinfo($this->curl, CURLINFO_HEADER_SIZE); | 
| 700 | 700 | $http_code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE); | 
| 701 | - $header = trim(substr($complete_response, 0, $header_size)); | |
| 701 | + $header = trim(substr($complete_response, 0, $header_size)); | |
| 702 | 702 | $response = substr($complete_response, $header_size); | 
| 703 | 703 | |
| 704 | 704 | $return = array( | 
| @@ -728,7 +728,7 @@ discard block | ||
| 728 | 728 |      { | 
| 729 | 729 | $vcard_id = null; | 
| 730 | 730 | |
| 731 | -        for ($number = 0; $number <= 25; $number ++) { | |
| 731 | +        for ($number = 0; $number <= 25; $number++) { | |
| 732 | 732 |              if ($number == 8 || $number == 17) { | 
| 733 | 733 | $vcard_id .= '-'; | 
| 734 | 734 |              } else { |