From 7fff38667953028d499f978798b44deccbd55a84 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Fri, 20 Jul 2012 17:09:03 +0200
Subject: [PATCH] Code style.

---
 apps/contacts/ajax/addproperty.php         | 11 ++--
 apps/contacts/ajax/savecrop.php            |  2 +-
 apps/contacts/ajax/saveproperty.php        |  2 +-
 apps/contacts/appinfo/app.php              |  2 +-
 apps/contacts/appinfo/migrate.php          | 15 +++---
 apps/contacts/appinfo/remote.php           |  4 +-
 apps/contacts/carddav.php                  |  6 +--
 apps/contacts/export.php                   | 18 ++++---
 apps/contacts/import.php                   | 58 ++++++++++++++++++----
 apps/contacts/index.php                    | 45 +++++++++--------
 apps/contacts/lib/addressbook.php          |  2 +-
 apps/contacts/lib/connector_sabre.php      |  6 +--
 apps/contacts/lib/vcard.php                |  4 +-
 apps/contacts/photo.php                    | 23 +++++----
 apps/contacts/templates/index.php          |  2 +-
 apps/contacts/templates/part.cropphoto.php |  1 -
 apps/contacts/thumbnail.php                | 27 +++++++---
 apps/contacts/tmpphoto.php                 |  2 +-
 18 files changed, 143 insertions(+), 87 deletions(-)

diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index 96f27b2b9b..58b857547f 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -48,10 +48,11 @@ if(!$vcard) {
 
 if(!is_array($value)) {
 	$value = trim($value);
-	if(!$value && in_array(
-			$name, 
-			array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE'))
-		) {
+	if(!$value 
+		&& in_array(
+		$name, 
+		array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE'))
+	) {
 		bailOut($l10n->t('Cannot add empty property.'));
 	}
 } elseif($name === 'ADR') { // only add if non-empty elements.
@@ -129,7 +130,7 @@ foreach ($parameters as $key=>$element) {
 		// NOTE: Maybe this doesn't only apply for TYPE?
 		// And it probably shouldn't be done here anyways :-/
 		foreach($element as $e) {
-			if($e != '' && !is_null($e)){
+			if($e != '' && !is_null($e)) {
 				$vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key, $e);
 			}
 		}
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index 3958af5c07..8ee2e46bf0 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -89,7 +89,7 @@ if($data) {
 				}
 				$now = new DateTime;
 				$card->setString('REV', $now->format(DateTime::W3C));
-				if(!OC_Contacts_VCard::edit($id,$card)) {
+				if(!OC_Contacts_VCard::edit($id, $card)) {
 					bailOut(OC_Contacts_App::$l10n->t('Error saving contact.'));
 				}
 				$tmpl = new OCP\Template("contacts", "part.contactphoto");
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index c3aaf5a959..5d743c99df 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -129,7 +129,7 @@ if(!$value) {
 }
 //debug('New checksum: '.$checksum);
 
-if(!OC_Contacts_VCard::edit($id,$vcard)) {
+if(!OC_Contacts_VCard::edit($id, $vcard)) {
 	bailOut(OC_Contacts_App::$l10n->t('Error updating contact property.'));
 	exit();
 }
diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php
index 33e89c3e9b..cbbbbc79e5 100644
--- a/apps/contacts/appinfo/app.php
+++ b/apps/contacts/appinfo/app.php
@@ -19,6 +19,6 @@ OCP\App::addNavigationEntry( array(
   'name' => OC_L10N::get('contacts')->t('Contacts') ));
 
 
-OCP\App::registerPersonal('contacts','settings');
+OCP\App::registerPersonal('contacts', 'settings');
 OCP\Util::addscript('contacts', 'loader');
 OC_Search::registerProvider('OC_Search_Provider_Contacts');
diff --git a/apps/contacts/appinfo/migrate.php b/apps/contacts/appinfo/migrate.php
index 02026c5979..2559b4ea45 100644
--- a/apps/contacts/appinfo/migrate.php
+++ b/apps/contacts/appinfo/migrate.php
@@ -2,7 +2,7 @@
 class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
 	
 	// Create the xml for the user supplied
-	function export( ){
+	function export( ) {
 		$options = array(
 			'table'=>'contacts_addressbooks',
 			'matchcol'=>'userid',
@@ -21,9 +21,8 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
 		$ids2 = $this->content->copyRows( $options );
 		
 		// If both returned some ids then they worked
-		if( is_array( $ids ) && is_array( $ids2 ) )
-		{
-			return true;	
+		if(is_array($ids) && is_array($ids2)) {
+			return true;
 		} else {
 			return false;
 		}
@@ -31,14 +30,14 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
 	}
 	
 	// Import function for contacts
-	function import( ){
-		switch( $this->appinfo->version ){
+	function import( ) {
+		switch( $this->appinfo->version ) {
 			default:
 				// All versions of the app have had the same db structure, so all can use the same import function
 				$query = $this->content->prepare( "SELECT * FROM contacts_addressbooks WHERE userid LIKE ?" );
 				$results = $query->execute( array( $this->olduid ) );
 				$idmap = array();
-				while( $row = $results->fetchRow() ){
+				while( $row = $results->fetchRow() ) {
 					// Import each addressbook	
 					$addressbookquery = OCP\DB::prepare( "INSERT INTO *PREFIX*contacts_addressbooks (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)" );
 					$addressbookquery->execute( array( $this->uid, $row['displayname'], $row['uri'], $row['description'], $row['ctag'] ) );
@@ -48,7 +47,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
 					OC_Contacts_Addressbook::setActive($idmap[$row['id']], true);
 				}
 				// Now tags
-				foreach($idmap as $oldid => $newid){
+				foreach($idmap as $oldid => $newid) {
 					
 					$query = $this->content->prepare( "SELECT * FROM contacts_cards WHERE addressbookid LIKE ?" );
 					$results = $query->execute( array( $oldid ) );
diff --git a/apps/contacts/appinfo/remote.php b/apps/contacts/appinfo/remote.php
index 09c2de1799..fd5604aec6 100644
--- a/apps/contacts/appinfo/remote.php
+++ b/apps/contacts/appinfo/remote.php
@@ -22,7 +22,7 @@
 
 OCP\App::checkAppEnabled('contacts');
 
-if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php'){
+if(substr($_SERVER["REQUEST_URI"], 0, strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php') {
 	$baseuri = OC_App::getAppWebPath('contacts').'/carddav.php';
 }
 
@@ -45,7 +45,7 @@ $nodes = array(
 $server = new Sabre_DAV_Server($nodes);
 $server->setBaseUri($baseuri);
 // Add plugins
-$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud'));
+$server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, 'ownCloud'));
 $server->addPlugin(new Sabre_CardDAV_Plugin());
 $server->addPlugin(new Sabre_DAVACL_Plugin());
 $server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload
diff --git a/apps/contacts/carddav.php b/apps/contacts/carddav.php
index e0579e625d..264eb30836 100644
--- a/apps/contacts/carddav.php
+++ b/apps/contacts/carddav.php
@@ -1,6 +1,6 @@
 <?php
-if(!file_exists('../../lib/base.php')){
+if(!file_exists('../../lib/base.php')) {
 	die('Please update the path to /lib/base.php in carddav.php or make use of /remote.php/carddav/');
 }
-require_once('../../lib/base.php');
-require_once('appinfo/remote.php');
\ No newline at end of file
+require_once '../../lib/base.php';
+require_once 'appinfo/remote.php';
\ No newline at end of file
diff --git a/apps/contacts/export.php b/apps/contacts/export.php
index eb506506c4..161ca8047a 100644
--- a/apps/contacts/export.php
+++ b/apps/contacts/export.php
@@ -9,26 +9,30 @@
  
 OCP\User::checkLoggedIn();
 OCP\App::checkAppEnabled('contacts');
-$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL;
-$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL;
+$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
+$contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null;
 $nl = "\n";
-if(isset($bookid)){
+if(isset($bookid)) {
 	$addressbook = OC_Contacts_App::getAddressbook($bookid);
 	//$cardobjects = OC_Contacts_VCard::all($bookid);
 	header('Content-Type: text/directory');
-	header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf'); 
+	header('Content-Disposition: inline; filename=' 
+		. str_replace(' ', '_', $addressbook['displayname']) . '.vcf'); 
 
 	$start = 0;
-	$batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'export_batch_size', 20);
+	$batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 
+		'contacts', 
+		'export_batch_size', 20);
 	while($cardobjects = OC_Contacts_VCard::all($bookid, $start, $batchsize)){
 		foreach($cardobjects as $card) {
 			echo $card['carddata'] . $nl;
 		}
 		$start += $batchsize;
 	}
-}elseif(isset($contactid)){
+}elseif(isset($contactid)) {
 	$data = OC_Contacts_App::getContactObject($contactid);
 	header('Content-Type: text/vcard');
-	header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf'); 
+	header('Content-Disposition: inline; filename=' 
+		. str_replace(' ', '_', $data['fullname']) . '.vcf'); 
 	echo $data['carddata'];
 }
diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index 7d3acf86cf..1986d79f6d 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -38,17 +38,29 @@ if(!$file) {
 	OCP\JSON::error(array('data' => array('message' => 'Import file was empty.')));
 	exit();
 }
-if(isset($_POST['method']) && $_POST['method'] == 'new'){
-	$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']);
+if(isset($_POST['method']) && $_POST['method'] == 'new') {
+	$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), 
+		$_POST['addressbookname']);
 	if(!$id) {
-		OCP\JSON::error(array('data' => array('message' => 'Error creating address book.')));
+		OCP\JSON::error(
+			array(
+				'data' => array('message' => 'Error creating address book.')
+			)
+		);
 		exit();
 	}
 	OC_Contacts_Addressbook::setActive($id, 1);
 }else{
 	$id = $_POST['id'];
 	if(!$id) {
-		OCP\JSON::error(array('data' => array('message' => 'Error getting the ID of the address book.', 'file'=>$_POST['file'])));
+		OCP\JSON::error(
+			array(
+				'data' => array(
+					'message' => 'Error getting the ID of the address book.', 
+					'file'=>$_POST['file']
+				)
+			)
+		);
 		exit();
 	}
 	OC_Contacts_App::getAddressbook($id); // is owner access check
@@ -62,7 +74,7 @@ $inelement = false;
 $parts = array();
 $card = array();
 foreach($lines as $line){
-	if(strtoupper(trim($line)) == 'BEGIN:VCARD'){
+	if(strtoupper(trim($line)) == 'BEGIN:VCARD') {
 		$inelement = true;
 	} elseif (strtoupper(trim($line)) == 'END:VCARD') {
 		$card[] = $line;
@@ -79,10 +91,20 @@ writeProgress('70');
 $imported = 0;
 $failed = 0;
 if(!count($parts) > 0) {
-	OCP\JSON::error(array('data' => array('message' => 'No contacts to import in '.$_POST['file'].'. Please check if the file is corrupted.', 'file'=>$_POST['file'])));
+	OCP\JSON::error(
+		array(
+			'data' => array(
+				'message' => 'No contacts to import in '
+					. $_POST['file'].'. Please check if the file is corrupted.', 
+				'file'=>$_POST['file']
+			)
+		)
+	);
 	if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
 		if(!$view->unlink('/imports/' . $_POST['file'])) {
-			OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
+			OCP\Util::writeLog('contacts', 
+				'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], 
+				OCP\Util::ERROR);
 		}
 	}
 	exit();
@@ -91,14 +113,18 @@ foreach($parts as $part){
 	$card = OC_VObject::parse($part);
 	if (!$card) {
 		$failed += 1;
-		OCP\Util::writeLog('contacts','Import: skipping card. Error parsing VCard: '.$part, OCP\Util::ERROR);
+		OCP\Util::writeLog('contacts', 
+			'Import: skipping card. Error parsing VCard: ' . $part, 
+				OCP\Util::ERROR);
 		continue; // Ditch cards that can't be parsed by Sabre.
 	}
 	try {
 		OC_Contacts_VCard::add($id, $card);
 		$imported += 1;
 	} catch (Exception $e) {
-		OCP\Util::writeLog('contacts', 'Error importing vcard: '.$e->getMessage().$nl.$card, OCP\Util::ERROR);
+		OCP\Util::writeLog('contacts', 
+			'Error importing vcard: ' . $e->getMessage() . $nl . $card, 
+			OCP\Util::ERROR);
 		$failed += 1;
 	}
 }
@@ -108,7 +134,17 @@ sleep(3);
 OC_Cache::remove($progresskey);
 if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
 	if(!$view->unlink('/imports/' . $_POST['file'])) {
-		OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
+		OCP\Util::writeLog('contacts', 
+			'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], 
+			OCP\Util::ERROR);
 	}
 }
-OCP\JSON::success(array('data' => array('imported'=>$imported, 'failed'=>$failed, 'file'=>$_POST['file'])));
+OCP\JSON::success(
+	array(
+		'data' => array(
+			'imported'=>$imported, 
+			'failed'=>$failed, 
+			'file'=>$_POST['file'],
+		)
+	)
+);
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 00b1b4f7a9..c35e1b85d4 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -14,13 +14,17 @@ OCP\App::checkAppEnabled('contacts');
 
 // Get active address books. This creates a default one if none exists.
 $ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0 ? true : false); // just to check if there are any contacts.
+$has_contacts = (count(OC_Contacts_VCard::all($ids, 0, 1)) > 0 
+	? true 
+	: false); // just to check if there are any contacts.
 if($has_contacts === false) {
-	OCP\Util::writeLog('contacts','index.html: No contacts found.',OCP\Util::DEBUG);
+	OCP\Util::writeLog('contacts', 
+		'index.html: No contacts found.', 
+		OCP\Util::DEBUG);
 }
 
 // Load the files we need
-OCP\App::setActiveNavigationEntry( 'contacts_index' );
+OCP\App::setActiveNavigationEntry('contacts_index');
 
 // Load a specific user?
 $id = isset( $_GET['id'] ) ? $_GET['id'] : null;
@@ -34,30 +38,31 @@ $post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
 $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
 
 $freeSpace=OC_Filesystem::free_space('/');
-$freeSpace=max($freeSpace,0);
-$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
-
-OCP\Util::addscript('','jquery.multiselect');
-OCP\Util::addscript('','oc-vcategories');
-OCP\Util::addscript('contacts','contacts');
-OCP\Util::addscript('contacts','expanding');
-OCP\Util::addscript('contacts','jquery.combobox');
+$freeSpace=max($freeSpace, 0);
+$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
+
+OCP\Util::addscript('', 'jquery.multiselect');
+OCP\Util::addscript('', 'oc-vcategories');
+OCP\Util::addscript('contacts', 'contacts');
+OCP\Util::addscript('contacts', 'expanding');
+OCP\Util::addscript('contacts', 'jquery.combobox');
 OCP\Util::addscript('files', 'jquery.fileupload');
-OCP\Util::addscript('contacts','jquery.inview');
-OCP\Util::addscript('contacts','jquery.Jcrop');
-OCP\Util::addscript('contacts','jquery.multi-autocomplete');
-OCP\Util::addStyle('','jquery.multiselect');
-OCP\Util::addStyle('contacts','jquery.combobox');
-OCP\Util::addStyle('contacts','jquery.Jcrop');
-OCP\Util::addStyle('contacts','contacts');
+OCP\Util::addscript('contacts', 'jquery.inview');
+OCP\Util::addscript('contacts', 'jquery.Jcrop');
+OCP\Util::addscript('contacts', 'jquery.multi-autocomplete');
+OCP\Util::addStyle('', 'jquery.multiselect');
+OCP\Util::addStyle('contacts', 'jquery.combobox');
+OCP\Util::addStyle('contacts', 'jquery.Jcrop');
+OCP\Util::addStyle('contacts', 'contacts');
 
 $tmpl = new OCP\Template( "contacts", "index", "user" );
 $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
-$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize), false);
+$tmpl->assign('uploadMaxHumanFilesize', 
+	OCP\Util::humanFileSize($maxUploadFilesize), false);
 $tmpl->assign('property_types', $property_types, false);
 $tmpl->assign('phone_types', $phone_types, false);
 $tmpl->assign('email_types', $email_types, false);
 $tmpl->assign('categories', $categories, false);
 $tmpl->assign('has_contacts', $has_contacts, false);
-$tmpl->assign('id',$id, false);
+$tmpl->assign('id', $id, false);
 $tmpl->printPage();
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 65e02312bd..eb61b6dbce 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -133,7 +133,7 @@ class OC_Contacts_Addressbook {
 		if(is_null($uid)) {
 			$uid = OCP\USER::getUser();
 		}
-		$id = self::add($uid,'Contacts', 'Default Address Book');
+		$id = self::add($uid, 'Contacts', 'Default Address Book');
 		if($id !== false) {
 			self::setActive($id, true);
 		}
diff --git a/apps/contacts/lib/connector_sabre.php b/apps/contacts/lib/connector_sabre.php
index 99b94fc767..9fcfff08fa 100644
--- a/apps/contacts/lib/connector_sabre.php
+++ b/apps/contacts/lib/connector_sabre.php
@@ -79,7 +79,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
 			}
 		}
 
-		OC_Contacts_Addressbook::edit($addressbookid,$name,$description);
+		OC_Contacts_Addressbook::edit($addressbookid, $name, $description);
 
 		return true;
 
@@ -113,7 +113,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
 
 		}
 
-		OC_Contacts_Addressbook::addFromDAVData($principaluri,$url,$name,$description);
+		OC_Contacts_Addressbook::addFromDAVData($principaluri, $url, $name, $description);
 	}
 
 	/**
@@ -156,7 +156,7 @@ class OC_Connector_Sabre_CardDAV extends Sabre_CardDAV_Backend_Abstract {
 	 * @return array
 	 */
 	public function getCard($addressbookid, $carduri) {
-		return OC_Contacts_VCard::findWhereDAVDataIs($addressbookid,$carduri);
+		return OC_Contacts_VCard::findWhereDAVDataIs($addressbookid, $carduri);
 
 	}
 
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 732c5a2258..6b9a4c04f1 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -212,7 +212,7 @@ class OC_Contacts_VCard{
 		// Add version if needed
 		if($version && $version < '3.0') {
 			$upgrade = true;
-			OCP\Util::writeLog('contacts','OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OCP\Util::DEBUG);
+			OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OCP\Util::DEBUG);
 		}
 		foreach($vcard->children as &$property){
 			// Decode string properties and remove obsolete properties.
@@ -487,7 +487,7 @@ class OC_Contacts_VCard{
 	public static function unescapeDelimiters($value, $delimiter=';') {
 		$array = explode($delimiter, $value);
 		for($i=0;$i<count($array);$i++) {
-			if(substr($array[$i],-1, 1)=="\\") {
+			if(substr($array[$i], -1, 1)=="\\") {
 				if(isset($array[$i+1])) {
 					$array[$i] = substr($array[$i], 0, count($array[$i])-2).$delimiter.$array[$i+1];
 					unset($array[$i+1]);
diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php
index 4660d61f61..efdf157cd9 100644
--- a/apps/contacts/photo.php
+++ b/apps/contacts/photo.php
@@ -13,7 +13,7 @@
 OCP\User::checkLoggedIn();
 OCP\App::checkAppEnabled('contacts');
 
-function getStandardImage(){
+function getStandardImage() {
 	//OCP\Response::setExpiresHeader('P10D');
 	OCP\Response::enableCaching();
 	OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person_large.png'));
@@ -27,37 +27,39 @@ if(is_null($id)) {
 }
 
 if(!extension_loaded('gd') || !function_exists('gd_info')) {
-	OCP\Util::writeLog('contacts','photo.php. GD module not installed',OCP\Util::DEBUG);
+	OCP\Util::writeLog('contacts', 
+		'photo.php. GD module not installed', OCP\Util::DEBUG);
 	getStandardImage();
 }
 
 $contact = OC_Contacts_App::getContactVCard($id);
 $image = new OC_Image();
-if(!$image) {
+if (!$image) {
 	getStandardImage();
 }
 // invalid vcard
-if( is_null($contact)) {
-	OCP\Util::writeLog('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OCP\Util::ERROR);
+if (is_null($contact)) {
+	OCP\Util::writeLog('contacts', 
+		'photo.php. The VCard for ID ' . $id . ' is not RFC compatible', 
+		OCP\Util::ERROR);
 } else {
 	OCP\Response::enableCaching($caching);
 	OC_Contacts_App::setLastModifiedHeader($contact);
 
 	// Photo :-)
-	if($image->loadFromBase64($contact->getAsString('PHOTO'))) {
+	if ($image->loadFromBase64($contact->getAsString('PHOTO'))) {
 		// OK
 		OCP\Response::setETagHeader(md5($contact->getAsString('PHOTO')));
 	}
 	else
 	// Logo :-/
-	if($image->loadFromBase64($contact->getAsString('LOGO'))) {
+	if ($image->loadFromBase64($contact->getAsString('LOGO'))) {
 		// OK
 		OCP\Response::setETagHeader(md5($contact->getAsString('LOGO')));
 	}
 	if ($image->valid()) {
 		$max_size = 200;
-		if($image->width() > $max_size ||
-		   $image->height() > $max_size) {
+		if ($image->width() > $max_size || $image->height() > $max_size) {
 			$image->resize($max_size);
 		}
 	}
@@ -65,8 +67,7 @@ if( is_null($contact)) {
 if (!$image->valid()) {
 	// Not found :-(
 	getStandardImage();
-	//$image->loadFromFile('img/person_large.png');
 }
 header('Content-Type: '.$image->mimeType());
 $image->show();
-//echo OC_Contacts_App::$l10n->t('This card does not contain a photo.');
+
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 98cb67a26e..1bc4a19553 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -25,7 +25,7 @@
 </div>
 <div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
 	<?php
-		if($_['has_contacts']){
+		if($_['has_contacts']) {
 			echo $this->inc('part.contact');
 		}
 		else{
diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php
index 6d7b1e4477..3f5817622b 100644
--- a/apps/contacts/templates/part.cropphoto.php
+++ b/apps/contacts/templates/part.cropphoto.php
@@ -2,7 +2,6 @@
 $id = $_['id'];
 $tmpkey = $_['tmpkey'];
 $requesttoken = $_['requesttoken'];
-OCP\Util::writeLog('contacts','templates/part.cropphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
 ?>
 <script type="text/javascript">
 	jQuery(function($) {
diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php
index a69e9c74f7..6deb5ca379 100644
--- a/apps/contacts/thumbnail.php
+++ b/apps/contacts/thumbnail.php
@@ -25,14 +25,15 @@ OCP\JSON::checkLoggedIn();
 OCP\App::checkAppEnabled('contacts');
 session_write_close();
 
-function getStandardImage(){
+function getStandardImage() {
 	//OCP\Response::setExpiresHeader('P10D');
 	OCP\Response::enableCaching();
 	OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
 }
 
 if(!extension_loaded('gd') || !function_exists('gd_info')) {
-	OCP\Util::writeLog('contacts','thumbnail.php. GD module not installed',OCP\Util::DEBUG);
+	OCP\Util::writeLog('contacts', 
+		'thumbnail.php. GD module not installed', OCP\Util::DEBUG);
 	getStandardImage();
 	exit();
 }
@@ -43,8 +44,10 @@ $caching = isset($_GET['refresh']) ? 0 : null;
 $contact = OC_Contacts_App::getContactVCard($id);
 
 // invalid vcard
-if(is_null($contact)){
-	OCP\Util::writeLog('contacts','thumbnail.php. The VCard for ID '.$id.' is not RFC compatible',OCP\Util::ERROR);
+if(is_null($contact)) {
+	OCP\Util::writeLog('contacts', 
+		'thumbnail.php. The VCard for ID ' . $id . ' is not RFC compatible', 
+		OCP\Util::ERROR);
 	getStandardImage();
 	exit();
 }
@@ -64,16 +67,24 @@ if($photo) {
 				if($image->show()) {
 					exit();
 				} else {
-					OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OCP\Util::ERROR);
+					OCP\Util::writeLog('contacts', 
+						'thumbnail.php. Couldn\'t display thumbnail for ID ' . $id, 
+						OCP\Util::ERROR);
 				}
 			} else {
-				OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t resize thumbnail for ID '.$id,OCP\Util::ERROR);
+				OCP\Util::writeLog('contacts', 
+					'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $id, 
+					OCP\Util::ERROR);
 			}
 		}else{
-			OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t crop thumbnail for ID '.$id,OCP\Util::ERROR);
+			OCP\Util::writeLog('contacts', 
+				'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $id, 
+				OCP\Util::ERROR);
 		}
 	} else {
-		OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t load image string for ID '.$id,OCP\Util::ERROR);
+		OCP\Util::writeLog('contacts', 
+			'thumbnail.php. Couldn\'t load image string for ID ' . $id, 
+			OCP\Util::ERROR);
 	}
 }
 getStandardImage();
diff --git a/apps/contacts/tmpphoto.php b/apps/contacts/tmpphoto.php
index 5fde8de997..156d5c8030 100644
--- a/apps/contacts/tmpphoto.php
+++ b/apps/contacts/tmpphoto.php
@@ -24,7 +24,7 @@ $tmpkey = $_GET['tmpkey'];
 $maxsize = isset($_GET['maxsize']) ? $_GET['maxsize'] : -1;
 header("Cache-Control: no-cache, no-store, must-revalidate");
 
-OCP\Util::writeLog('contacts','tmpphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
+OCP\Util::writeLog('contacts', 'tmpphoto.php: tmpkey: '.$tmpkey, OCP\Util::DEBUG);
 
 $image = new OC_Image();
 $image->loadFromData(OC_Cache::get($tmpkey));
-- 
GitLab