Skip to content

Commit

Permalink
Change FALSE() to check against 'false'
Browse files Browse the repository at this point in the history
No functional changes.
  • Loading branch information
Alfred Klomp committed Dec 16, 2013
1 parent b41cd22 commit c420b57
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 81 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ shed light on the problem.
If you're still fairly certain that things should be working but they don't,
try changing the error output statements in `server.php` to:

ini_set('display_errors', TRUE);
ini_set('html_errors', TRUE);
ini_set('display_errors', true);
ini_set('html_errors', true);

PHP should now complain loudly when something goes wrong. Also, make sure
`log4php` is installed and enable very verbose logging by setting the log level
Expand Down Expand Up @@ -299,7 +299,7 @@ and issues you find.

Sabre-Zarafa 0.19 adds the `ETAG_ENABLE` config variable to `config.inc.php`.
This variable controls the optional generation of ETags. If Sabre-Zarafa
notices that the variable is not set, it will default to TRUE. So users with an
notices that the variable is not set, it will default to true. So users with an
existing config file don't absolutely need to update their config, though it is
advised.

Expand Down
2 changes: 1 addition & 1 deletion ZarafaLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class Zarafa_Logger
{
private $logger = FALSE;
private $logger = false;

public function __construct ($classname)
{
Expand Down
8 changes: 0 additions & 8 deletions common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@
define ('PR_CARDDAV_RAW_DATA_GENERATION_TIME', mapi_prop_tag(PT_SYSTIME, CARDDAV_CUSTOM_PROPERTY_ID | 0x0002));
define ('PR_CARDDAV_AB_CONTACT_COUNT', mapi_prop_tag(PT_LONG, CARDDAV_CUSTOM_PROPERTY_ID | 0x0003));
define ('PR_CARDDAV_RAW_DATA_VERSION', mapi_prop_tag(PT_STRING8, CARDDAV_CUSTOM_PROPERTY_ID | 0x0004));

if (!function_exists('FALSE'))
{
function FALSE ($expr)
{
return ($expr === FALSE);
}
}
2 changes: 1 addition & 1 deletion config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
// become confused when, for a given ETag, we don't return
// byte-for-byte the exact body that the client sent. So support for
// this feature is kept optional:
define('ETAG_ENABLE', TRUE);
define('ETAG_ENABLE', true);

// Change the name of the folder as returned by Sabre-Zarafa.
// Format options available:
Expand Down
4 changes: 2 additions & 2 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
$logger = new Zarafa_Logger('server');

error_reporting(E_ALL);
ini_set('display_errors', FALSE);
ini_set('display_errors', false);
ini_set("html_errors", false);

// Include Zarafa SabreDav Bridge
include ("./ZarafaBridge.php");

// Disable MAPI exceptions;
// we handle errors by checking a function's return status (at least for now):
mapi_enable_exceptions(FALSE);
mapi_enable_exceptions(false);

// SabreDAV
include('lib/SabreDAV/vendor/autoload.php');
Expand Down
72 changes: 36 additions & 36 deletions vcard/VCardParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class VCardParser implements IVCardParser
{
protected $bridge;
protected $logger;
protected $vcard = FALSE;
protected $vcard = false;
protected $mapi = array();
protected $extendedProperties = FALSE;
protected $extendedProperties = false;

function __construct ($bridge)
{
Expand All @@ -62,16 +62,16 @@ public function vObjectToProperties ($vcardData)

$this->vcard = Sabre\VObject\Reader::read($vcardData);

if (FALSE($this->vcard)) {
if ($this->vcard === false) {
$this->logger->fatal('failed to create vCard object');
return FALSE;
return false;
}
$this->logger->trace("VObject: \n" . print_r($this->vcard, TRUE));
$this->logger->trace("VObject: \n" . print_r($this->vcard, true));

// Common VCard properties parsing
if (FALSE($this->extendedProperties = $this->bridge->getExtendedProperties())) {
if (($this->extendedProperties = $this->bridge->getExtendedProperties()) === false) {
$this->logger->fatal('failed to load extended properties');
return FALSE;
return false;
}
// Use shorthand notation for brevity's sake:
$p = $this->extendedProperties;
Expand Down Expand Up @@ -192,14 +192,14 @@ public function vObjectToProperties ($vcardData)
{
// If a property occurs more than once, we take the *first*
// mention to be the most important:
$already_set = FALSE;
$already_set = false;
foreach ($this->vcard->select($prop_vcard) as $prop) {
if ($already_set) {
$this->logger->info(sprintf('Discarding %s with value "%s"; MAPI can store just one field.', $prop_vcard, $prop->getValue()));
continue;
}
$this->mapi[$p[$prop_mapi]] = $prop->getValue();
$already_set = TRUE;
$already_set = true;
}
}
if (isset($this->vcard->ORG)) {
Expand Down Expand Up @@ -276,7 +276,7 @@ public function vObjectToProperties ($vcardData)
private function
sortAsConvert ()
{
$fileas = FALSE;
$fileas = false;
$p = $this->extendedProperties;

$map = array
Expand All @@ -293,11 +293,11 @@ private function
}
}
// SORT-AS can also be given as a parameter to N:
if (FALSE($fileas) && isset($this->vcard->N) && $this->vcard->N->offsetExists('SORT-AS')) {
if ($fileas === false && isset($this->vcard->N) && $this->vcard->N->offsetExists('SORT-AS')) {
$fileas = $this->vcard->N->offsetGet('SORT-AS')->getValue();
}
// If not yet found, or override specified, derive:
if (FALSE($fileas) || SAVE_AS_OVERRIDE_SORTAS) {
if ($fileas === false || SAVE_AS_OVERRIDE_SORTAS) {
$this->logger->trace('Empty sort-as or SAVE_AS_OVERRIDE_SORTAS set');

$fileas = SAVE_AS_PATTERN;
Expand Down Expand Up @@ -349,14 +349,14 @@ private function
// OS X Contacts.app sends contacts back in the following form:
// ADR;type=HOME;type=pref:;;Main Street;Littleville;Arizona;AAA999;Denmark
// Nice, multiple 'type' tags. Get them all:
$type = FALSE;
$type = false;
foreach ($types as $type => $dummy) {
if (isset($map[$type])) {
break;
}
$type = FALSE;
$type = false;
}
if (FALSE($type)) {
if ($type === false) {
$this->logger->info(sprintf('Ignoring address with unknown type(s) "%s"', $types->getValue()));
continue;
}
Expand All @@ -369,7 +369,7 @@ private function
$pCountry = "{$map[$type]}_address_country";
}
$parts = $addr->getParts();
$this->logger->trace("Address components:\n".print_r($parts, TRUE));
$this->logger->trace("Address components:\n".print_r($parts, true));

$this->mapi[$p[$pStreet]] = isset($parts[2]) ? $parts[2] : '';
$this->mapi[$p[$pCity]] = isset($parts[3]) ? $parts[3] : '';
Expand Down Expand Up @@ -426,7 +426,7 @@ private function
( 'address' => $address
, 'display_name' => $displayName
, 'pref' => $pref
, 'type' => ($type = $email['TYPE']) ? strtoupper($type->getValue()) : FALSE
, 'type' => ($type = $email['TYPE']) ? strtoupper($type->getValue()) : false
, 'order' => $numMail
);
}
Expand All @@ -445,7 +445,7 @@ private function
continue;
}
// Create one-off entry:
if (FALSE($oneoff = mapi_createoneoff($emails[$i]['display_name'], 'SMTP', $emails[$i]['address']))) {
if (($oneoff = mapi_createoneoff($emails[$i]['display_name'], 'SMTP', $emails[$i]['address'])) === false) {
$this->logger->warn(sprintf('Failed to create one-off for "%s", reason: %s', $emails[$i]['address'], get_mapi_error_name()));
continue;
}
Expand Down Expand Up @@ -488,7 +488,7 @@ private function
$n_work_voice = 0;
foreach ($this->vcard->select('TEL') as $tel)
{
$pk = FALSE;
$pk = false;
$types = $this->getTypes($tel);

if (isset($types['HOME'])) {
Expand Down Expand Up @@ -538,7 +538,7 @@ private function
? 'primary_fax_number'
: 'other_telephone_number';
}
if (FALSE($pk)) {
if ($pk === false) {
// No match yet? Try to match against map:
// Note: there is also 'cellular_telephone_number',
// but it's an alias for 'mobile_telephone_number'.
Expand Down Expand Up @@ -569,7 +569,7 @@ private function
}
}
// Still no match found?
if (FALSE($pk)) {
if ($pk === false) {
// If no type info set (so just 'TEL:'), use default phone property:
if (count($types) == 0) {
$pk = DEFAULT_TELEPHONE_NUMBER_PROPERTY;
Expand All @@ -590,14 +590,14 @@ private function
// Convert to JPEG if not already in that format:
if ($type != 'jpeg' && $type != 'image/jpeg' && $type != 'image/jpg')
{
if (FALSE(extension_loaded('gd'))) {
if (extension_loaded('gd') === false) {
$this->logger->warn("Cannot convert image of type \"$type\" to jpeg: GD extension not installed");
return FALSE;
return false;
}
$this->logger->trace('Converting to jpeg using GD');
if (FALSE($img = imagecreatefromstring($content))) {
if (($img = imagecreatefromstring($content)) === false) {
$this->logger->warn('Corrupted contact picture or unknown format');
return FALSE;
return false;
}
$this->logger->trace('Image loaded by GD');
// Capture output
Expand All @@ -609,10 +609,10 @@ private function
}
$this->logger->info('Contact has picture!');
$this->mapi['ContactPicture'] = $content;
$this->mapi[PR_HASATTACH] = TRUE;
$this->mapi[$this->extendedProperties['has_picture']] = TRUE;
$this->mapi[PR_HASATTACH] = true;
$this->mapi[$this->extendedProperties['has_picture']] = true;

return TRUE;
return true;
}

private function
Expand All @@ -627,9 +627,9 @@ private function
$pk = (isset($types['ASSISTANT'])) ? 'assistant'
: ((isset($types['MANAGER'])) ? 'manager_name'
: ((isset($types['SPOUSE'])) ? 'spouse_name'
: FALSE));
: false));

if (FALSE($pk)) {
if ($pk === false) {
$this->logger->info(sprintf('Ignoring RELATED property with unknown TYPE "%s"', implode('/', array_keys($types))));
continue;
}
Expand Down Expand Up @@ -671,10 +671,10 @@ private function
foreach ($this->vcard->select($propname) as $prop)
{
$elem = $prop->getValue();
$type = FALSE;
$name = FALSE;
$type = false;
$name = false;

if (FALSE($pos = strpos($elem, ':'))) {
if (($pos = strpos($elem, ':')) === false) {
$name = $elem;
}
else if ($pos === 0 && strlen($elem) > 1) {
Expand All @@ -692,9 +692,9 @@ private function
}
// If no type tag, only add if same name with type tag
// not added (theirs is more specific):
if (FALSE($type)) {
if ($type === false) {
foreach ($elems as $e) {
if (!FALSE($e[0]) && $e[1] === $name) {
if ($e[0] !== false && $e[1] === $name) {
continue 2;
}
}
Expand All @@ -703,7 +703,7 @@ private function
// name but no type (ours is more specific):
else {
for ($i = count($elems) - 1; $i >= 0; $i--) {
if (FALSE($elems[$i][0]) && $elems[$i][1] === $name) {
if ($elems[$i][0] === false && $elems[$i][1] === $name) {
unset($elems[$i]);
}
}
Expand Down
Loading

0 comments on commit c420b57

Please sign in to comment.