Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
1.6.1 (fixed #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fs654 committed Dec 15, 2015
1 parent 2a2d8f4 commit c335570
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 46 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.6.1:
- Big cleanup
- Unused vars removed (bug #8)
- Contact picture url rewriting fix (bug #8)

1.6.0:
- Added match from suggested friends
- Fixed match page loading (No more waiting for page to load all the images)
Expand Down
31 changes: 8 additions & 23 deletions app/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace OCA\FbSync\App;

use OCA\FbSync\Controller\ContactsController;
use OCP\ICache;
use OCP\Image;
use OCA\FbSync\Controller\FacebookController;
use Sabre\VObject;
Expand All @@ -25,14 +23,6 @@
* @package OCA\FbSync\App
*/
class Contact {
/**
* @var ICache
*/
private $cache;
/**
* @var IManager
*/
private $contactsManager;
/**
* @var FacebookController
*/
Expand All @@ -56,24 +46,19 @@ class Contact {

/**
* Construct
* @var ICache
* @var FacebookController The facebook controller instance
* @var integer The contact local id
* @var integer|false The contact facebook id
* @var string The adressbook backend (usually "local")
* @var integer The adressbook id
* @var string The photo url
* @var intstringeger The last edit time
* @var VObject The vcard data
*/
public function __construct(
IManager $contactsManager,
ICache $cache,
FacebookController $fbController,
integer $id,
string $addressbook,
string $lastmodified,
$id,
$addressbook,
$lastmodified,
VObject $vcard
) {
$this->contactsManager = $contactsManager;
$this->cache = $cache;
$this->fbController = $fbController;
$this->id = $id;
$this->addressbook = $addressbook;
Expand Down Expand Up @@ -234,10 +219,10 @@ public function setFBID($fbid) {
*/
public function getPhotoUrl($size=false) {
if(App::$contactPlus) {
$photo = "index.php/apps/contactsplus/getcontactphoto/".$this->id;
$photo = "/index.php/apps/contactsplus/getcontactphoto/".$this->id;
} else {

$photo = "index.php/apps/contacts/addressbook/".
$photo = "/index.php/apps/contacts/addressbook/".
$this->backend."/".
$this->addressbook."/contact/".
$this->id."/photo";
Expand Down
6 changes: 1 addition & 5 deletions app/contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function getList(){
foreach($activeAddressbooks as $activeAddressbook) {
foreach(VCard::all($activeAddressbook) as $contact) {
$contacts[$contact['id']] = new Contact(
$this->contactsManager,
$this->cache,
$this->fbController,
$contact['id'],
$contact['addressbookid'],
Expand All @@ -74,8 +72,6 @@ public function getContact($id){
// Do you have the right to get this contact?
if(in_array($contact['addressbookid'], $activeAddressbooks)) {
return new Contact(
$this->contactsManager,
$this->cache,
$this->fbController,
$contact['id'],
$contact['addressbookid'],
Expand Down Expand Up @@ -170,7 +166,7 @@ public function delFBID($id) {
* Get profile picture url
* @NoAdminRequired
*/
public function getPhoto($id, $size) {
public function getPhoto($id, $size=60) {
$contact = $this->getContact($id);
if(!$contact) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<description>A Facebook info sync for owncloud contacts</description>
<licence>AGPL</licence>
<author>NOIJN</author>
<version>1.6.0</version>
<version>1.6.1</version>
<namespace>FbSync</namespace>
<category>other</category>
<require>8</require>
Expand Down
Empty file modified appinfo/jobs.php
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
['name' => 'contacts#setPhoto', 'url' => '/setphoto/{id}', 'verb' => 'GET'],
['name' => 'contacts#setBirthday', 'url' => '/setbday/{id}', 'verb' => 'GET'],
['name' => 'contacts#getFbContacts', 'url' => '/FBcontacts', 'verb' => 'GET'],
['name' => 'contacts#getPhoto', 'url' => '/getphoto/{id}', 'verb' => 'GET'],
['name' => 'contacts#getPhoto', 'url' => '/getphoto/{id}/{size}', 'verb' => 'GET'],
['name' => 'contacts#deletePhotos', 'url' => '/contacts/delphotos', 'verb' => 'GET'],
['name' => 'contacts#deleteBdays', 'url' => '/contacts/delbdays', 'verb' => 'GET'],
Expand Down
Empty file modified appinfo/update.php
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions controller/facebookcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class FacebookController extends Controller {
* @var Int Friends cache time (24h)
* @var Int Friends cache key
*/
private $cacheKey = "FBfriends-";
private $cacheKey;

public function __construct($AppName, ICache $cache=null, $userHome){
parent::__construct($AppName);
$this->cache = $cache;
$this->userHome = $userHome;
$this->cacheKey = $cacheKey.substr(md5($this->userHome), 0, 8);
$this->cacheKey = "FBfriends-".substr(md5($this->userHome), 0, 8);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions css/fbsync.css
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@
border-radius: 0;
display: block;
}
#contacts-list-results {
padding: 20px;
}
.sync-contact {
display: inline-block;
margin: 10px;
Expand Down
Empty file modified fonts/FontAwesome.otf
100644 → 100755
Empty file.
Empty file modified fonts/IndieFlower.woff2
100644 → 100755
Empty file.
Empty file modified fonts/font-awesome.min.css
100644 → 100755
Empty file.
Empty file modified fonts/fontawesome-webfont.eot
100644 → 100755
Empty file.
Empty file modified fonts/fontawesome-webfont.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified fonts/fontawesome-webfont.ttf
100644 → 100755
Empty file.
Empty file modified fonts/fontawesome-webfont.woff
100644 → 100755
Empty file.
Empty file modified fonts/fontawesome-webfont.woff2
100644 → 100755
Empty file.
Empty file modified img/loading.xcf
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions js/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ function isDoneSyncing(synced, error, ignored, total, syncbutton) {
if(synced+error+ignored >= total) {
$(syncbutton).text('Done !').removeClass('loading');
$('#loader').fadeOut();
$('#contacts-list').fadeIn();
$('#contacts-list-results').fadeIn();
$(".syncbutton").removeProp('disabled');
$(syncbutton).text($(syncbutton).data('text')).removeData('text');
// Fixes the padding in case of low width screen resolution
$('#contacts-list').css({'padding-top':$('#controls').height()+'px'});
$('#contacts-list-results').css({'padding-top':$('#controls').height()+'px'});
}
}

Expand Down Expand Up @@ -149,7 +149,7 @@ function syncBirthdays() {
$(document).ready(function () {

// Better visual
$('#contacts-list').fadeOut();
$('#contacts-list-results').fadeOut();
$('.tooltipped-top').tipsy({gravity: 's'});
$('.tooltipped-bottom').tipsy({gravity: 'n'});

Expand Down Expand Up @@ -214,9 +214,9 @@ function syncBirthdays() {

//---------- RESIZE & SCREEN ADAPTATION ----------
// Fixes the padding in case of low width screen resolution
$('#contacts-list').css({'padding-top':$('#controls').height()+'px'});
$('#contacts-list-results').css({'padding-top':$('#controls').height()+'px'});
$(window).resize(function() {
$('#contacts-list').css({'padding-top':$('#controls').height()+'px'});
$('#contacts-list-results').css({'padding-top':$('#controls').height()+'px'});

});

Expand Down
2 changes: 1 addition & 1 deletion lib/jarowinkler.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

class JaroWinkler {

private function getCommonCharacters( $string1, $string2, $allowedDistance ){
private static function getCommonCharacters( $string1, $string2, $allowedDistance ){

$str1_len = strlen($string1);
$str2_len = strlen($string2);
Expand Down
25 changes: 17 additions & 8 deletions lib/vcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,24 @@ public static function all($id, $offset=null, $limit=null, $fields = array(),$bO
if(!is_null($result)) {
while( $row = $result->fetchRow()) {

if($row['bcompany']){
$row['sortFullname'] = mb_substr($row['fullname'],0,3,"UTF-8");
}else{
if($row['lastname'] !== ''){
$row['sortFullname'] = mb_substr($row['lastname'],0,3,"UTF-8");
}else{
$row['sortFullname'] = mb_substr($row['surename'],0,3,"UTF-8");
// Prevent undefined indexes if using the default contacts app
if(isset($row['bcompany']) && isset($row['lastname'])) {

if($row['bcompany']){
$row['sortFullname'] = mb_substr($row['fullname'],0,3,"UTF-8");
} else {
if($row['lastname'] !== ''){
$row['sortFullname'] = mb_substr($row['lastname'],0,3,"UTF-8");
} else {
$row['sortFullname'] = mb_substr($row['surename'],0,3,"UTF-8");
}
}

} else {
$row['lastname'] == '';
$row['bcompany'] == false;
}

if($row['fullname'] == '' && $row['lastname'] == ''){
$row['fullname'] = 'unknown';
$row['sortFullname'] = mb_substr($row['fullname'],0,3,"UTF-8");
Expand Down Expand Up @@ -286,7 +295,7 @@ public static function edit($id, VObject\Component $card) {
if($bCompany && $organization !== ''){
$card->FN = $organization;
$fn = $organization;
}else{
} else {
if($lastname !== '' || $surename !== ''){
$fn = $surename.$lastname;
$card->FN = $fn;
Expand Down
Empty file modified templates/error.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion templates/sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<!-- Fake contact div to load the contact svg before the contacts pictures -->
<div class="sync-contact" style="display:none"></div>

<div id="contacts-list" class="hidden">
<div id="contacts-list-results" style="display:none">
<div id="sync-success" class="clear sync-results-container"><h2>Success</h2><div class="sync-results"></div></div>
<div id="sync-errors" class="clear sync-results-container"><h2>Errors</h2><div class="sync-results"></div></div>
<div id="sync-ignored" class="clear sync-results-container"><h2>Ignored</h2><div class="sync-results"></div></div>
Expand Down

0 comments on commit c335570

Please sign in to comment.