| @@ -38,9 +38,12 @@ discard block | ||
| 38 | 38 |  require_once('lib/fritzbox_api_php/fritzbox_api.class.php'); | 
| 39 | 39 | |
| 40 | 40 | if($argc == 2) | 
| 41 | +{ | |
| 41 | 42 | $config_file_name = $argv[1]; | 
| 42 | -else | |
| 43 | +} | |
| 44 | +else { | |
| 43 | 45 | $config_file_name = __DIR__ . '/config.php'; | 
| 46 | +} | |
| 44 | 47 | |
| 45 | 48 | // default/fallback config options | 
| 46 | 49 | $config['tmp_dir'] = sys_get_temp_dir(); | 
| @@ -60,7 +63,9 @@ discard block | ||
| 60 | 63 | $config['quickdial_keyword'] = 'Quickdial:'; | 
| 61 | 64 | |
| 62 | 65 | if(is_file($config_file_name)) | 
| 66 | +{ | |
| 63 | 67 | require($config_file_name); | 
| 68 | +} | |
| 64 | 69 | else | 
| 65 | 70 |  { | 
| 66 | 71 | print 'ERROR: No ' . $config_file_name . ' found, please take a look at config.example.php and create a ' . $config_file_name . ' file!' . PHP_EOL; | 
| @@ -122,7 +127,9 @@ discard block | ||
| 122 | 127 | public function mktemp($dir, $prefix = '', $mode = 0700) | 
| 123 | 128 |    { | 
| 124 | 129 | if(substr($dir, -1) != '/') | 
| 125 | - $dir .= '/'; | |
| 130 | +    { | |
| 131 | + $dir .= '/'; | |
| 132 | + } | |
| 126 | 133 | |
| 127 | 134 | do | 
| 128 | 135 |      { | 
| @@ -143,7 +150,12 @@ discard block | ||
| 143 | 150 | if($object != "." && $object != "..") | 
| 144 | 151 |          { | 
| 145 | 152 | if(filetype($dir . "/" . $object) == "dir") | 
| 146 | - rrmdir($dir . "/" . $object); else unlink($dir . "/" . $object); | |
| 153 | +          { | |
| 154 | + rrmdir($dir . "/" . $object); | |
| 155 | + } | |
| 156 | +          else { | |
| 157 | + unlink($dir . "/" . $object); | |
| 158 | + } | |
| 147 | 159 | } | 
| 148 | 160 | } | 
| 149 | 161 | reset($objects); | 
| @@ -157,18 +169,25 @@ discard block | ||
| 157 | 169 |      { | 
| 158 | 170 | // Check if there are valid base64 characters | 
| 159 | 171 |        if(!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $str)) | 
| 160 | - return false; | |
| 172 | +      { | |
| 173 | + return false; | |
| 174 | + } | |
| 161 | 175 | |
| 162 | 176 | // Decode the string in strict mode and check the results | 
| 163 | 177 | $decoded = base64_decode($str, true); | 
| 164 | 178 | if($decoded === false) | 
| 165 | - return false; | |
| 179 | +      { | |
| 180 | + return false; | |
| 181 | + } | |
| 166 | 182 | |
| 167 | 183 | // Encode the string again | 
| 168 | 184 | if(base64_encode($decoded) === $str) | 
| 169 | - return true; | |
| 170 | - else | |
| 171 | - return false; | |
| 185 | +      { | |
| 186 | + return true; | |
| 187 | + } | |
| 188 | +      else { | |
| 189 | + return false; | |
| 190 | + } | |
| 172 | 191 | } | 
| 173 | 192 | catch(Exception $e) | 
| 174 | 193 |      { | 
| @@ -209,7 +228,9 @@ discard block | ||
| 209 | 228 | // set the vcard extension in case the user | 
| 210 | 229 | // defined it in the config | 
| 211 | 230 | if(isset($conf['extension'])) | 
| 212 | - $carddav->setVcardExtension($conf['extension']); | |
| 231 | +        { | |
| 232 | + $carddav->setVcardExtension($conf['extension']); | |
| 233 | + } | |
| 213 | 234 | |
| 214 | 235 | // retrieve data from the CardDAV server now | 
| 215 | 236 | $xmldata = $carddav->get(); | 
| @@ -218,7 +239,9 @@ discard block | ||
| 218 | 239 | // CardDAV server and if not reencode it since the FRITZ!Box | 
| 219 | 240 | // requires UTF-8 encoded data | 
| 220 | 241 |          if(iconv('utf-8', 'utf-8//IGNORE', $xmldata) != $xmldata) | 
| 221 | - $xmldata = utf8_encode($xmldata); | |
| 242 | +        { | |
| 243 | + $xmldata = utf8_encode($xmldata); | |
| 244 | + } | |
| 222 | 245 | |
| 223 | 246 | // read raw_vcard data from xml response | 
| 224 | 247 | $raw_vcards = array(); | 
| @@ -240,10 +263,14 @@ discard block | ||
| 240 | 263 | $vcard_obj = new vCard(false, $v); | 
| 241 | 264 | $name_arr = null; | 
| 242 | 265 | if(isset($vcard_obj->n[0])) | 
| 243 | - $name_arr = $vcard_obj->n[0]; | |
| 266 | +          { | |
| 267 | + $name_arr = $vcard_obj->n[0]; | |
| 268 | + } | |
| 244 | 269 | $org_arr = null; | 
| 245 | 270 | if(isset($vcard_obj->org[0])) | 
| 246 | - $org_arr = $vcard_obj->org[0]; | |
| 271 | +          { | |
| 272 | + $org_arr = $vcard_obj->org[0]; | |
| 273 | + } | |
| 247 | 274 | $addnames = ''; | 
| 248 | 275 | $prefix = ''; | 
| 249 | 276 | $suffix = ''; | 
| @@ -251,16 +278,24 @@ discard block | ||
| 251 | 278 | |
| 252 | 279 | // Build name Parts if existing ans switch to true in config | 
| 253 | 280 | if(isset($name_arr['prefixes']) and $this->config['prefix']) | 
| 254 | - $prefix = trim($name_arr['prefixes']); | |
| 281 | +          { | |
| 282 | + $prefix = trim($name_arr['prefixes']); | |
| 283 | + } | |
| 255 | 284 | |
| 256 | 285 | if(isset($name_arr['suffixes']) and $this->config['suffix']) | 
| 257 | - $suffix = trim($name_arr['suffixes']); | |
| 286 | +          { | |
| 287 | + $suffix = trim($name_arr['suffixes']); | |
| 288 | + } | |
| 258 | 289 | |
| 259 | 290 | if(isset($name_arr['additionalnames']) and $this->config['addnames']) | 
| 260 | - $addnames = trim($name_arr['additionalnames']); | |
| 291 | +          { | |
| 292 | + $addnames = trim($name_arr['additionalnames']); | |
| 293 | + } | |
| 261 | 294 | |
| 262 | 295 | if(isset($org_arr['name']) and $this->config['orgname']) | 
| 263 | - $orgname = trim($org_arr['name']); | |
| 296 | +          { | |
| 297 | + $orgname = trim($org_arr['name']); | |
| 298 | + } | |
| 264 | 299 | |
| 265 | 300 | $firstname = trim($name_arr['firstname']); | 
| 266 | 301 | $lastname = trim($name_arr['lastname']); | 
| @@ -280,71 +315,97 @@ discard block | ||
| 280 | 315 | |
| 281 | 316 | // Prefix | 
| 282 | 317 | if(!empty($prefix)) | 
| 283 | - $name .= $prefix; | |
| 318 | +          { | |
| 319 | + $name .= $prefix; | |
| 320 | + } | |
| 284 | 321 | |
| 285 | 322 | if($format == 0) | 
| 286 | 323 |            { | 
| 287 | 324 | // Lastname | 
| 288 | 325 | if(!empty($name) and !empty($lastname)) | 
| 289 | - $name .= ' ' . $lastname; | |
| 290 | - else | |
| 291 | - $name .= $lastname; | |
| 326 | +            { | |
| 327 | + $name .= ' ' . $lastname; | |
| 328 | + } | |
| 329 | +            else { | |
| 330 | + $name .= $lastname; | |
| 331 | + } | |
| 292 | 332 | } | 
| 293 | 333 | else | 
| 294 | 334 |            { | 
| 295 | 335 | // Firstname | 
| 296 | 336 | if(!empty($name) and !empty($firstname)) | 
| 297 | - $name .= ' ' . $firstname; | |
| 298 | - else | |
| 299 | - $name .= $firstname; | |
| 337 | +            { | |
| 338 | + $name .= ' ' . $firstname; | |
| 339 | + } | |
| 340 | +            else { | |
| 341 | + $name .= $firstname; | |
| 342 | + } | |
| 300 | 343 | } | 
| 301 | 344 | |
| 302 | 345 | if($format == 2) | 
| 303 | 346 |            { | 
| 304 | 347 | // AdditionalNames | 
| 305 | 348 | if(!empty($name) and !empty($addnames)) | 
| 306 | - $name .= ' ' . $addnames; | |
| 307 | - else | |
| 308 | - $name .= $addnames; | |
| 349 | +            { | |
| 350 | + $name .= ' ' . $addnames; | |
| 351 | + } | |
| 352 | +            else { | |
| 353 | + $name .= $addnames; | |
| 354 | + } | |
| 309 | 355 | } | 
| 310 | 356 | |
| 311 | 357 | if($format == 0) | 
| 312 | 358 |            { | 
| 313 | 359 | // Firstname | 
| 314 | 360 | if(!empty($name) and !empty($firstname)) | 
| 315 | - $name .= ', ' . $firstname; | |
| 316 | - else | |
| 317 | - $name .= $firstname; | |
| 361 | +            { | |
| 362 | + $name .= ', ' . $firstname; | |
| 363 | + } | |
| 364 | +            else { | |
| 365 | + $name .= $firstname; | |
| 366 | + } | |
| 318 | 367 | } | 
| 319 | 368 | else | 
| 320 | 369 |            { | 
| 321 | 370 | // Lastname | 
| 322 | 371 | if(!empty($name) and !empty($lastname)) | 
| 323 | - $name .= ' ' . $lastname; | |
| 324 | - else | |
| 325 | - $name .= $lastname; | |
| 372 | +            { | |
| 373 | + $name .= ' ' . $lastname; | |
| 374 | + } | |
| 375 | +            else { | |
| 376 | + $name .= $lastname; | |
| 377 | + } | |
| 326 | 378 | } | 
| 327 | 379 | |
| 328 | 380 | if($format != 2) | 
| 329 | 381 |            { | 
| 330 | 382 | // AdditionalNames | 
| 331 | 383 | if(!empty($name) and !empty($addnames)) | 
| 332 | - $name .= ' ' . $addnames; | |
| 333 | - else | |
| 334 | - $name .= $addnames; | |
| 384 | +            { | |
| 385 | + $name .= ' ' . $addnames; | |
| 386 | + } | |
| 387 | +            else { | |
| 388 | + $name .= $addnames; | |
| 389 | + } | |
| 335 | 390 | } | 
| 336 | 391 | |
| 337 | 392 | // Suffix | 
| 338 | 393 | if(!empty($name) and !empty($suffix)) | 
| 339 | - $name .= ' ' . $suffix; | |
| 340 | - else | |
| 341 | - $name .= $suffix; | |
| 394 | +          { | |
| 395 | + $name .= ' ' . $suffix; | |
| 396 | + } | |
| 397 | +          else { | |
| 398 | + $name .= $suffix; | |
| 399 | + } | |
| 342 | 400 | |
| 343 | 401 | // OrgName | 
| 344 | 402 | if(!empty($name) and !empty($orgname)) | 
| 345 | -            $name .= ' (' . $orgname . ')'; | |
| 346 | - else | |
| 347 | - $name .= $orgname; | |
| 403 | +          { | |
| 404 | +                      $name .= ' (' . $orgname . ')'; | |
| 405 | + } | |
| 406 | +          else { | |
| 407 | + $name .= $orgname; | |
| 408 | + } | |
| 348 | 409 | |
| 349 | 410 | // make sure to trim whitespaces and double spaces | 
| 350 | 411 |            $name = trim(str_replace('  ', ' ', $name)); | 
| @@ -361,15 +422,19 @@ discard block | ||
| 361 | 422 |              $photo = str_replace(array(',', '&', ' ', '/', 'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß', 'á', 'à', 'ó', 'ò', 'ú', 'ù', 'í', 'ø'), | 
| 362 | 423 |              array('', '_', '_', '_', 'ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss', 'a', 'a', 'o', 'o', 'u', 'u', 'i', 'oe'), $name); | 
| 363 | 424 | } | 
| 364 | - else | |
| 365 | - $photo = ''; | |
| 425 | +          else { | |
| 426 | + $photo = ''; | |
| 427 | + } | |
| 366 | 428 | |
| 367 | 429 | // phone | 
| 368 | 430 | $phone_no = array(); | 
| 369 | 431 | if($vcard_obj->categories) | 
| 370 | - $categories = $vcard_obj->categories[0]; | |
| 371 | - else | |
| 372 | - $categories = array(); | |
| 432 | +          { | |
| 433 | + $categories = $vcard_obj->categories[0]; | |
| 434 | + } | |
| 435 | +          else { | |
| 436 | + $categories = array(); | |
| 437 | + } | |
| 373 | 438 | |
| 374 | 439 | // check for quickdial entry | 
| 375 | 440 | if(isset($vcard_obj->note[0])) | 
| @@ -404,9 +469,10 @@ discard block | ||
| 404 | 469 | break; | 
| 405 | 470 | } | 
| 406 | 471 | } | 
| 407 | - } | |
| 408 | - else | |
| 409 | - $add_entry = 1; | |
| 472 | + } | |
| 473 | +          else { | |
| 474 | + $add_entry = 1; | |
| 475 | + } | |
| 410 | 476 | |
| 411 | 477 | if($add_entry == 1) | 
| 412 | 478 |            { | 
| @@ -431,9 +497,13 @@ discard block | ||
| 431 | 497 |                    { | 
| 432 | 498 | //Set quickdial | 
| 433 | 499 | if($value == 1) | 
| 434 | - print "\nWARNING: Quickdial value 1 (**701) is not possible but used! \n"; | |
| 500 | +                    { | |
| 501 | + print "\nWARNING: Quickdial value 1 (**701) is not possible but used! \n"; | |
| 502 | + } | |
| 435 | 503 | elseif($value >= 100) | 
| 436 | - print "\nWARNING: Quickdial value bigger than 99 (**799) is not possible but used! \n"; | |
| 504 | +                    { | |
| 505 | + print "\nWARNING: Quickdial value bigger than 99 (**799) is not possible but used! \n"; | |
| 506 | + } | |
| 437 | 507 | |
| 438 | 508 | $quickdial = $value; | 
| 439 | 509 | } | 
| @@ -443,23 +513,38 @@ discard block | ||
| 443 | 513 | |
| 444 | 514 | // find out priority | 
| 445 | 515 |                  if(in_array("pref", $typearr_lower)) | 
| 446 | - $prio = 1; | |
| 516 | +                { | |
| 517 | + $prio = 1; | |
| 518 | + } | |
| 447 | 519 | |
| 448 | 520 | // set the proper type | 
| 449 | 521 |                  if(in_array("cell", $typearr_lower)) | 
| 450 | - $type = "mobile"; | |
| 522 | +                { | |
| 523 | + $type = "mobile"; | |
| 524 | + } | |
| 451 | 525 |                  elseif(in_array("home", $typearr_lower)) | 
| 452 | - $type = "home"; | |
| 526 | +                { | |
| 527 | + $type = "home"; | |
| 528 | + } | |
| 453 | 529 |                  elseif(in_array("fax", $typearr_lower)) | 
| 454 | - $type = "fax_work"; | |
| 530 | +                { | |
| 531 | + $type = "fax_work"; | |
| 532 | + } | |
| 455 | 533 |                  elseif(in_array("work", $typearr_lower)) | 
| 456 | - $type = "work"; | |
| 534 | +                { | |
| 535 | + $type = "work"; | |
| 536 | + } | |
| 457 | 537 |                  elseif(in_array("other", $typearr_lower)) | 
| 458 | - $type = "other"; | |
| 538 | +                { | |
| 539 | + $type = "other"; | |
| 540 | + } | |
| 459 | 541 |                  elseif(in_array("dom", $typearr_lower)) | 
| 460 | - $type = "other"; | |
| 461 | - else | |
| 462 | - continue; | |
| 542 | +                { | |
| 543 | + $type = "other"; | |
| 544 | + } | |
| 545 | +                else { | |
| 546 | + continue; | |
| 547 | + } | |
| 463 | 548 | } | 
| 464 | 549 |                $phone_no[] = array("type"=>$type, "prio"=>$prio, "quickdial"=>$quickdial, "value" => $this->_clear_phone_number($phone_number)); | 
| 465 | 550 | } | 
| @@ -479,13 +564,20 @@ discard block | ||
| 479 | 564 | $email = $e['value']; | 
| 480 | 565 | $typearr_lower = unserialize(strtolower(serialize($e['type']))); | 
| 481 | 566 |                    if(in_array("work", $typearr_lower)) | 
| 482 | - $type_email = "work"; | |
| 567 | +                  { | |
| 568 | + $type_email = "work"; | |
| 569 | + } | |
| 483 | 570 |                    elseif(in_array("home", $typearr_lower)) | 
| 484 | - $type_email = "home"; | |
| 571 | +                  { | |
| 572 | + $type_email = "home"; | |
| 573 | + } | |
| 485 | 574 |                    elseif(in_array("other", $typearr_lower)) | 
| 486 | - $type_email = "other"; | |
| 487 | - else | |
| 488 | - continue; | |
| 575 | +                  { | |
| 576 | + $type_email = "other"; | |
| 577 | + } | |
| 578 | +                  else { | |
| 579 | + continue; | |
| 580 | + } | |
| 489 | 581 | } | 
| 490 | 582 | |
| 491 | 583 | // DEBUG: print out the email address on the console | 
| @@ -513,7 +605,9 @@ discard block | ||
| 513 | 605 | public function build_fb_xml() | 
| 514 | 606 |    { | 
| 515 | 607 | if(empty($this->entries)) | 
| 516 | -      throw new Exception('No entries available! Call get_carddav_entries or set $this->entries manually!'); | |
| 608 | +    { | |
| 609 | +          throw new Exception('No entries available! Call get_carddav_entries or set $this->entries manually!'); | |
| 610 | + } | |
| 517 | 611 | |
| 518 | 612 | // create FB XML in utf-8 format | 
| 519 | 613 |      $root = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><phonebooks><phonebook></phonebook></phonebooks>'); | 
| @@ -552,7 +646,9 @@ discard block | ||
| 552 | 646 | |
| 553 | 647 | // output a warning if no telephone number was found | 
| 554 | 648 | if($id == 0) | 
| 555 | - print " WARNING: no phone entry found. VCard will be ignored." . PHP_EOL; | |
| 649 | +      { | |
| 650 | + print " WARNING: no phone entry found. VCard will be ignored." . PHP_EOL; | |
| 651 | + } | |
| 556 | 652 | |
| 557 | 653 | // email: put the email addresses into the fritzbox xml file | 
| 558 | 654 |        $email = $contact->addChild("services"); | 
| @@ -602,8 +698,9 @@ discard block | ||
| 602 | 698 | |
| 603 | 699 | print " Added photo: " . basename($photo_file) . PHP_EOL; | 
| 604 | 700 | } | 
| 605 | - else | |
| 606 | - print " WARNING: Only jpg contact photos are currently supported." . PHP_EOL; | |
| 701 | +          else { | |
| 702 | + print " WARNING: Only jpg contact photos are currently supported." . PHP_EOL; | |
| 703 | + } | |
| 607 | 704 | } | 
| 608 | 705 | elseif(substr($entry['photo_data'][0], 0, 4) == 'http') | 
| 609 | 706 |          { | 
| @@ -612,8 +709,9 @@ discard block | ||
| 612 | 709 | |
| 613 | 710 | print " Added photo: " . $entry['photo_data'][0] . PHP_EOL; | 
| 614 | 711 | } | 
| 615 | - else | |
| 616 | - print " WARNING: Only VCard embedded photo data or a reference URL is currently supported." . PHP_EOL; | |
| 712 | +        else { | |
| 713 | + print " WARNING: Only VCard embedded photo data or a reference URL is currently supported." . PHP_EOL; | |
| 714 | + } | |
| 617 | 715 | } | 
| 618 | 716 | |
| 619 | 717 |        $contact->addChild("services"); | 
| @@ -622,7 +720,9 @@ discard block | ||
| 622 | 720 | } | 
| 623 | 721 | |
| 624 | 722 | if($root->asXML() !== false) | 
| 625 | - $this->fbxml = $root->asXML(); | |
| 723 | +    { | |
| 724 | + $this->fbxml = $root->asXML(); | |
| 725 | + } | |
| 626 | 726 | else | 
| 627 | 727 |      { | 
| 628 | 728 | print " ERROR: created XML data isn't well-formed." . PHP_EOL; | 
| @@ -639,19 +739,27 @@ discard block | ||
| 639 | 739 | public function _concat($text1, $text2) | 
| 640 | 740 |    { | 
| 641 | 741 | if($text1 == '') | 
| 642 | - return $text2; | |
| 742 | +    { | |
| 743 | + return $text2; | |
| 744 | + } | |
| 643 | 745 | elseif($text2 == '') | 
| 644 | - return $text1; | |
| 645 | - else | |
| 646 | - return $text1 . ", " . $text2; | |
| 746 | +    { | |
| 747 | + return $text1; | |
| 748 | + } | |
| 749 | +    else { | |
| 750 | + return $text1 . ", " . $text2; | |
| 751 | + } | |
| 647 | 752 | } | 
| 648 | 753 | |
| 649 | 754 | public function _parse_fb_result($text) | 
| 650 | 755 |    { | 
| 651 | 756 |      if(preg_match("/\<h2\>([^\<]+)\<\/h2\>/", $text, $matches) == 1 && !empty($matches)) | 
| 652 | - return $matches[1]; | |
| 653 | - else | |
| 654 | - return "Error while uploading xml to fritzbox"; | |
| 757 | +    { | |
| 758 | + return $matches[1]; | |
| 759 | + } | |
| 760 | +    else { | |
| 761 | + return "Error while uploading xml to fritzbox"; | |
| 762 | + } | |
| 655 | 763 | } | 
| 656 | 764 | |
| 657 | 765 | public function upload_to_fb() | 
| @@ -673,15 +781,17 @@ discard block | ||
| 673 | 781 |  	  	$newphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/","",file_get_contents($this->config['output_file'],'r'),-1,$debugnewtsreplace)); | 
| 674 | 782 | print " INFO: Compare old and new phonebook file versions." . PHP_EOL . " INFO: old version: " . $oldphonebhash . PHP_EOL . " INFO: new version: " . $newphonebhash . PHP_EOL; | 
| 675 | 783 | if($oldphonebhash === $newphonebhash) | 
| 676 | -      	{ | |
| 784 | +	  	{ | |
| 677 | 785 | print " INFO: Same versions ==> No changes in phonebook or images" . PHP_EOL . " EXIT: No need to upload phonebook to the FRITZ!Box.". PHP_EOL; | 
| 678 | 786 | return 0; | 
| 679 | 787 | } | 
| 680 | - else | |
| 681 | - print " INFO: Different versions ==> Changes in phonebook." . PHP_EOL . " INFO: Changes dedected! Continue with upload." . PHP_EOL; | |
| 788 | +      	else { | |
| 789 | + print " INFO: Different versions ==> Changes in phonebook." . PHP_EOL . " INFO: Changes dedected! Continue with upload." . PHP_EOL; | |
| 790 | + } | |
| 682 | 791 | } | 
| 683 | - else | |
| 684 | - return 0; | |
| 792 | +      else { | |
| 793 | + return 0; | |
| 794 | + } | |
| 685 | 795 | } | 
| 686 | 796 | // now we upload the photo jpgs first being stored in the | 
| 687 | 797 | // temp directory. | 
| @@ -751,12 +861,16 @@ discard block | ||
| 751 | 861 | |
| 752 | 862 | ftp_pasv($conn_id, true); | 
| 753 | 863 | if(!ftp_put($conn_id, $remote_path . "/" . $file, $fileinfo->getPathname(), FTP_BINARY)) | 
| 754 | - print " ERROR: while uploading file " . $fileinfo->getFilename() . PHP_EOL; | |
| 755 | - else | |
| 756 | - print " ok." . PHP_EOL; | |
| 864 | +                  { | |
| 865 | + print " ERROR: while uploading file " . $fileinfo->getFilename() . PHP_EOL; | |
| 866 | + } | |
| 867 | +                  else { | |
| 868 | + print " ok." . PHP_EOL; | |
| 869 | + } | |
| 870 | + } | |
| 871 | +                else { | |
| 872 | + print " ok." . PHP_EOL; | |
| 757 | 873 | } | 
| 758 | - else | |
| 759 | - print " ok." . PHP_EOL; | |
| 760 | 874 | |
| 761 | 875 | // cleanup old files | 
| 762 | 876 | foreach($all_existing_files as $existing_file) | 
| @@ -768,20 +882,23 @@ discard block | ||
| 768 | 882 | } | 
| 769 | 883 | } | 
| 770 | 884 | } | 
| 771 | - else | |
| 772 | - print " already exists." . PHP_EOL; | |
| 885 | +              else { | |
| 886 | + print " already exists." . PHP_EOL; | |
| 887 | + } | |
| 773 | 888 | } | 
| 774 | 889 | } | 
| 775 | 890 | } | 
| 776 | 891 | } | 
| 777 | - else | |
| 778 | - print " ERROR: couldn't login to FTP-server '" . $ftp_server . "' with provided username/password settings." . PHP_EOL; | |
| 892 | +      else { | |
| 893 | + print " ERROR: couldn't login to FTP-server '" . $ftp_server . "' with provided username/password settings." . PHP_EOL; | |
| 894 | + } | |
| 779 | 895 | |
| 780 | 896 | // close ftp connection | 
| 781 | 897 | ftp_close($conn_id); | 
| 782 | 898 | } | 
| 783 | - else | |
| 784 | - print " ERROR: couldn't connect to FTP server '" . $ftp_server . "'." . PHP_EOL; | |
| 899 | +    else { | |
| 900 | + print " ERROR: couldn't connect to FTP server '" . $ftp_server . "'." . PHP_EOL; | |
| 901 | + } | |
| 785 | 902 | |
| 786 | 903 | // lets post the phonebook xml to the FRITZ!Box | 
| 787 | 904 | print " Uploading Phonebook XML to " . $this->config['fritzbox_ip'] . PHP_EOL; |