From e9213043a820095cceeb6cacbfacf08bba9d3142 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 18 Apr 2009 19:36:25 -0700 Subject: add reply_to index to notice --- db/laconica.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/laconica.sql b/db/laconica.sql index a790a3fd2..5b57494d9 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -117,6 +117,7 @@ create table notice ( index notice_profile_id_idx (profile_id), index notice_created_idx (created), + index notice_replyto_idx (reply_to), FULLTEXT(content) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; -- cgit v1.2.3-54-g00ecf From 4cb0a929806869b09d4325c1464fc2ecb7b5a76e Mon Sep 17 00:00:00 2001 From: CiaranG Date: Tue, 21 Apr 2009 20:43:57 +0100 Subject: Add feed2omb to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index d5124e223..ce44f3235 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -8,6 +8,7 @@ VALUES ('deskbar','Deskbar-Applet','http://www.gnome.org/projects/deskbar-applet/', now()), ('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()), ('Facebook','Facebook','http://apps.facebook.com/identica/', now()), + ('feed2omb','feed2omb','http://projects.ciarang.com/p/feed2omb/', now()), ('Gwibber','Gwibber','http://launchpad.net/gwibber', now()), ('HelloTxt','HelloTxt','http://hellotxt.com/', now()), ('identicatools','Laconica Tools','http://bitbucketlabs.net/laconica-tools/', now()), -- cgit v1.2.3-54-g00ecf From f798d1ea430d25c2f4a60179c65b39b1257a5340 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Apr 2009 17:08:20 -0700 Subject: Added dirty dates to Foreign_link --- classes/Foreign_link.php | 2 ++ classes/laconica.ini | 2 ++ db/laconica.sql | 2 ++ 3 files changed, 6 insertions(+) (limited to 'db') diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index 5d9c82a85..606560951 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -17,6 +17,8 @@ class Foreign_link extends Memcached_DataObject public $noticesync; // tinyint(1) not_null default_1 public $friendsync; // tinyint(1) not_null default_2 public $profilesync; // tinyint(1) not_null default_1 + public $last_noticesync; // datetime() + public $last_friendsync; // datetime() public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/classes/laconica.ini b/classes/laconica.ini index dd424bbdd..5a905a4bb 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -55,6 +55,8 @@ credentials = 2 noticesync = 145 friendsync = 145 profilesync = 145 +last_noticesync = 14 +last_friendsync = 14 created = 142 modified = 384 diff --git a/db/laconica.sql b/db/laconica.sql index 83d610f0d..d9e21a7b5 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -291,6 +291,8 @@ create table foreign_link ( noticesync tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies', friendsync tinyint not null default 2 comment 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming', profilesync tinyint not null default 1 comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming', + last_noticesync datetime default null comment 'last time notices were imported', + last_friendsync datetime default null comment 'last time friends were imported', created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified', -- cgit v1.2.3-54-g00ecf From 6a12598695637e7ebdc613977c797413957cc464 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 3 May 2009 21:36:03 -0700 Subject: add pingvine notice source --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index ce44f3235..17720028d 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -24,6 +24,7 @@ VALUES ('peoplebrowsr', 'PeopleBrowsr', 'http://www.peoplebrowsr.com/', now()), ('Pikchur','Pikchur','http://www.pikchur.com/', now()), ('Ping.fm','Ping.fm','http://ping.fm/', now()), + ('pingvine','PingVine','http://pingvine.com/', now()), ('pocketwit','PockeTwit','http://code.google.com/p/pocketwit/', now()), ('posty','Posty','http://spreadingfunkyness.com/posty/', now()), ('royalewithcheese','Royale With Cheese','http://p.hellyeah.org/', now()), -- cgit v1.2.3-54-g00ecf From 4b0e5ff271d4ac0af3256b2716f1e1362ddb02d8 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 7 May 2009 14:07:03 -0700 Subject: Added Twitter to notice sources --- db/notice_source.sql | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/notice_source.sql b/db/notice_source.sql index ce44f3235..e6e2180a5 100644 --- a/db/notice_source.sql +++ b/db/notice_source.sql @@ -43,6 +43,7 @@ VALUES ('twidge','Twidge','http://software.complete.org/twidge', now()), ('twidroid','twidroid','http://www.twidroid.com/', now()), ('twittelator','Twittelator','http://www.stone.com/iPhone/Twittelator/', now()), + ('twitter','Twitter','http://twitter.com/', now()), ('twitterfeed','twitterfeed','http://twitterfeed.com/', now()), ('twitterphoto','TwitterPhoto','http://richfish.org/twitterphoto/', now()), ('twitterpm','Net::Twitter','http://search.cpan.org/dist/Net-Twitter/', now()), -- cgit v1.2.3-54-g00ecf From 3e7b1e69e3e97ac007465376b62084f10bcf97ca Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Tue, 28 Apr 2009 17:08:20 -0700 Subject: Added dirty dates to Foreign_link --- classes/Foreign_link.php | 2 ++ classes/laconica.ini | 2 ++ db/laconica.sql | 2 ++ 3 files changed, 6 insertions(+) (limited to 'db') diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index afc0e2180..af2b3f189 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -17,6 +17,8 @@ class Foreign_link extends Memcached_DataObject public $noticesync; // tinyint(1) not_null default_1 public $friendsync; // tinyint(1) not_null default_2 public $profilesync; // tinyint(1) not_null default_1 + public $last_noticesync; // datetime() + public $last_friendsync; // datetime() public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP diff --git a/classes/laconica.ini b/classes/laconica.ini index 529454d99..c05419588 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -55,6 +55,8 @@ credentials = 2 noticesync = 145 friendsync = 145 profilesync = 145 +last_noticesync = 14 +last_friendsync = 14 created = 142 modified = 384 diff --git a/db/laconica.sql b/db/laconica.sql index 5b57494d9..c9730098e 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -289,6 +289,8 @@ create table foreign_link ( noticesync tinyint not null default 1 comment 'notice synchronization, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies', friendsync tinyint not null default 2 comment 'friend synchronization, bit 1 = sync outgoing, bit 2 = sync incoming', profilesync tinyint not null default 1 comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming', + last_noticesync datetime default null comment 'last time notices were imported', + last_friendsync datetime default null comment 'last time friends were imported', created datetime not null comment 'date this record was created', modified timestamp comment 'date this record was modified', -- cgit v1.2.3-54-g00ecf From 9a8095079dc602c7f2b74e48237445d682844de6 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Fri, 8 May 2009 08:14:50 +0100 Subject: PostgreSQL - added dirty dates to Foreign_link - see 3e7b1e69e3e97ac007465376b62084f10bcf97ca --- db/laconica_pg.sql | 2 ++ 1 file changed, 2 insertions(+) (limited to 'db') diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index f879d7936..a27a616f2 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -291,6 +291,8 @@ create table foreign_link ( noticesync int not null default 1 /* comment 'notice synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies' */, friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, profilesync int not null default 1 /* comment 'profile synchronization, bit 1 = sync outgoing, bit 2 = sync incoming' */, + last_noticesync timestamp default null /* comment 'last time notices were imported' */, + last_friendsync timestamp default null /* comment 'last time friends were imported' */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */, -- cgit v1.2.3-54-g00ecf From 6c4e26fe61a3c1cada4775a42a929eb884150b2d Mon Sep 17 00:00:00 2001 From: Robin Millette Date: Fri, 15 May 2009 16:17:44 -0400 Subject: Added sql files to handle attachments (not yet tested) Hoping someone will improve the postgres version. --- db/laconica.sql | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ db/laconica_pg.sql | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) (limited to 'db') diff --git a/db/laconica.sql b/db/laconica.sql index d9e21a7b5..344f0ff72 100644 --- a/db/laconica.sql +++ b/db/laconica.sql @@ -425,3 +425,62 @@ create table group_inbox ( ) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; +create table file ( + id integer primary key auto_increment, + url varchar(255), mimetype varchar(50), + size integer, + title varchar(255), + date integer(11), + protected integer(1), + + unique(url) +) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; + +create table file_oembed ( + id integer primary key auto_increment, + file_id integer, + version varchar(20), + type varchar(20), + provider varchar(50), + provider_url varchar(255), + width integer, + height integer, + html text, + title varchar(255), + author_name varchar(50), + author_url varchar(255), + url varchar(255), + + unique(file_id) +) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci; + +create table file_redirection ( + id integer primary key auto_increment, + url varchar(255), + file_id integer, + redirections integer, + httpcode integer, + + unique(url) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table file_thumbnail ( + id integer primary key auto_increment, + file_id integer, + url varchar(255), + width integer, + height integer, + + unique(file_id), + unique(url) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + +create table file_to_post ( + id integer primary key auto_increment, + file_id integer, + post_id integer, + + unique(file_id, post_id) +) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin; + + diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index a27a616f2..b213bbd50 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -427,6 +427,64 @@ create table group_inbox ( ); create index group_inbox_created_idx on group_inbox using btree(created); + +/*attachments and URLs stuff */ +create sequence file_seq; +create table file ( + id bigint default nextval('file_seq') primary key /* comment 'unique identifier' */, + url varchar(255) unique, + mimetype varchar(50), + size integer, + title varchar(255), + date integer(11), + protected integer(1) +); + +create sequence file_oembed_seq; +create table file_oembed ( + id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */, + file_id bigint unique, + version varchar(20), + type varchar(20), + provider varchar(50), + provider_url varchar(255), + width integer, + height integer, + html text, + title varchar(255), + author_name varchar(50), + author_url varchar(255), + url varchar(255), +); + +create sequence file_redirection_seq; +create table file_redirection ( + id bigint default nextval('file_redirection_seq') primary key /* comment 'unique identifier' */, + url varchar(255) unique, + file_id bigint, + redirections integer, + httpcode integer +); + +create sequence file_thumbnail_seq; +create table file_thumbnail ( + id bigint default nextval('file_thumbnail_seq') primary key /* comment 'unique identifier' */, + file_id bigint unique, + url varchar(255) unique, + width integer, + height integer +); + +create sequence file_to_post_seq; +create table file_to_post ( + id bigint default nextval('file_to_post_seq') primary key /* comment 'unique identifier' */, + file_id bigint, + post_id bigint, + + unique(file_id, post_id) +); + + /* Textsearch stuff */ create index textsearch_idx on profile using gist(textsearch); -- cgit v1.2.3-54-g00ecf From 54cd0a2046c417fd072bb4cf79aeda163cf760af Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 21 May 2009 05:43:11 +0000 Subject: - Reworked login / logout workflow - Added Facebook Connect tab to login nav - Show Facebook mini-avatar when logged in - Added Facebook Connect tab to connect settings nav - Option to disconnect from Facebook --- db/foreign_services.sql | 3 +- plugins/FBConnect/FBCSettingsNav.php | 113 ++++++++++++++++++++ plugins/FBConnect/FBConnectAuth.php | 31 ++++-- plugins/FBConnect/FBConnectLogin.php | 10 +- plugins/FBConnect/FBConnectPlugin.php | 179 +++++++++++-------------------- plugins/FBConnect/FBConnectSettings.php | 184 ++++++++++++++++++++++++++++++++ 6 files changed, 393 insertions(+), 127 deletions(-) create mode 100644 plugins/FBConnect/FBCSettingsNav.php create mode 100644 plugins/FBConnect/FBConnectSettings.php (limited to 'db') diff --git a/db/foreign_services.sql b/db/foreign_services.sql index 557ede024..79c04cee5 100644 --- a/db/foreign_services.sql +++ b/db/foreign_services.sql @@ -2,4 +2,5 @@ insert into foreign_service (id, name, description, created) values ('1','Twitter', 'Twitter Micro-blogging service', now()), - ('2','Facebook', 'Facebook', now()); + ('2','Facebook', 'Facebook', now()), + ('3','FacebookConnect', 'Facebook Connect', now()); diff --git a/plugins/FBConnect/FBCSettingsNav.php b/plugins/FBConnect/FBCSettingsNav.php new file mode 100644 index 000000000..8b8411853 --- /dev/null +++ b/plugins/FBConnect/FBCSettingsNav.php @@ -0,0 +1,113 @@ +. + * + * @category Menu + * @package Laconica + * @author Evan Prodromou + * @author Zach Copley + * @copyright 2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR . '/lib/widget.php'; + +/** + * A widget for showing the connect group local nav menu + * + * @category Output + * @package Laconica + * @author Evan Prodromou + * @author Zach Copley + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + * + * @see Widget + */ + +class FBCSettingsNav extends Widget +{ + var $action = null; + + /** + * Construction + * + * @param Action $action current action, used for output + */ + + function __construct($action=null) + { + parent::__construct($action); + $this->action = $action; + } + + /** + * Show the menu + * + * @return void + */ + + function show() + { + + $this->action->elementStart('dl', array('id' => 'site_nav_local_views')); + $this->action->element('dt', null, _('Local views')); + $this->action->elementStart('dd'); + + # action => array('prompt', 'title') + $menu = + array('imsettings' => + array(_('IM'), + _('Updates by instant messenger (IM)')), + 'smssettings' => + array(_('SMS'), + _('Updates by SMS')), + 'twittersettings' => + array(_('Twitter'), + _('Twitter integration options')), + 'FBConnectSettings' => + array(_('Facebook'), + _('Facebook Connect settings'))); + + $action_name = $this->action->trimmed('action'); + $this->action->elementStart('ul', array('class' => 'nav')); + + foreach ($menu as $menuaction => $menudesc) { + if ($menuaction == 'imsettings' && + !common_config('xmpp', 'enabled')) { + continue; + } + $this->action->menuItem(common_local_url($menuaction), + $menudesc[0], + $menudesc[1], + $action_name === $menuaction); + } + + $this->action->elementEnd('ul'); + + $this->action->elementEnd('dd'); + $this->action->elementEnd('dl'); + } +} diff --git a/plugins/FBConnect/FBConnectAuth.php b/plugins/FBConnect/FBConnectAuth.php index 0dc016c05..e8724cdf9 100644 --- a/plugins/FBConnect/FBConnectAuth.php +++ b/plugins/FBConnect/FBConnectAuth.php @@ -29,7 +29,7 @@ require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php'; -class FbconnectauthAction extends Action +class FBConnectauthAction extends Action { var $fbuid = null; @@ -38,9 +38,20 @@ class FbconnectauthAction extends Action function prepare($args) { parent::prepare($args); - $this->fbuid = getFacebook()->get_loggedin_user(); - $this->fb_fields = $this->getFacebookFields($this->fbuid, - array('first_name', 'last_name', 'name')); + try { + + $this->fbuid = getFacebook()->get_loggedin_user(); + + if ($this->fbuid > 0) { + $this->fb_fields = $this->getFacebookFields($this->fbuid, + array('first_name', 'last_name', 'name')); + } else { + common_debug("No Facebook User found."); + } + + } catch (Exception $e) { + common_debug("Problem getting fbuid."); + } return true; } @@ -52,6 +63,7 @@ class FbconnectauthAction extends Action if (common_is_real_login()) { $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->showForm(_('There was a problem with your session token. Try again, please.')); @@ -113,7 +125,7 @@ class FbconnectauthAction extends Action $this->elementStart('form', array('method' => 'post', 'id' => 'account_connect', - 'action' => common_local_url('fbconnectlogin'))); + 'action' => common_local_url('FBConnectAuth'))); $this->hidden('token', common_session_token()); $this->element('h2', null, _('Create new account')); @@ -255,7 +267,7 @@ class FbconnectauthAction extends Action { common_debug("Trying Facebook Login..."); - $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_SERVICE); + $flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE); if ($flink) { $user = $flink->getUser(); @@ -270,6 +282,9 @@ class FbconnectauthAction extends Action } } else { + + common_debug("no flink found for fbuid: $this->fbuid"); + $this->showForm(null, $this->bestNewNickname()); } } @@ -291,10 +306,12 @@ class FbconnectauthAction extends Action function flinkUser($user_id, $fbuid) { + common_debug("flinkUser()"); + $flink = new Foreign_link(); $flink->user_id = $user_id; $flink->foreign_id = $fbuid; - $flink->service = FACEBOOK_SERVICE; + $flink->service = FACEBOOK_CONNECT_SERVICE; $flink->created = common_sql_now(); $flink_id = $flink->insert(); diff --git a/plugins/FBConnect/FBConnectLogin.php b/plugins/FBConnect/FBConnectLogin.php index 70710eb70..7989dc854 100644 --- a/plugins/FBConnect/FBConnectLogin.php +++ b/plugins/FBConnect/FBConnectLogin.php @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { - exit(1); +if (!defined('LACONICA')) { + exit(1); } require_once INSTALLDIR . '/plugins/FBConnect/FBConnectPlugin.php'; @@ -31,8 +31,8 @@ class FBConnectLoginAction extends Action if (common_is_real_login()) { $this->clientError(_('Already logged in.')); - } - + } + $this->showPage(); } @@ -58,7 +58,7 @@ class FBConnectLoginAction extends Action function showContent() { $this->elementStart('fieldset'); - + $this->element('fb:login-button', array('onlogin' => 'goto_login()', 'length' => 'long')); diff --git a/plugins/FBConnect/FBConnectPlugin.php b/plugins/FBConnect/FBConnectPlugin.php index 079270510..36dee0448 100644 --- a/plugins/FBConnect/FBConnectPlugin.php +++ b/plugins/FBConnect/FBConnectPlugin.php @@ -31,10 +31,15 @@ if (!defined('LACONICA')) { exit(1); } +define("FACEBOOK_CONNECT_SERVICE", 3); + require_once INSTALLDIR . '/lib/facebookutil.php'; require_once INSTALLDIR . '/plugins/FBConnect/FBConnectAuth.php'; require_once INSTALLDIR . '/plugins/FBConnect/FBConnectLogin.php'; +require_once INSTALLDIR . '/plugins/FBConnect/FBConnectSettings.php'; require_once INSTALLDIR . '/plugins/FBConnect/FBCLoginGroupNav.php'; +require_once INSTALLDIR . '/plugins/FBConnect/FBCSettingsNav.php'; + /** * Plugin to enable Facebook Connect @@ -56,32 +61,14 @@ class FBConnectPlugin extends Plugin // Hook in new actions function onRouterInitialized(&$m) { - - common_debug("onRouterIntialized()"); - $m->connect('main/facebookconnect', array('action' => 'FBConnectAuth')); $m->connect('main/facebooklogin', array('action' => 'FBConnectLogin')); + $m->connect('settings/facebook', array('action' => 'FBConnectSettings')); } // Add in xmlns:fb function onStartShowHTML($action) { - - // XXX: This is probably a bad place to do general processing - // so maybe I need to make some new events? Maybe in - // Action::prepare? - - $name = get_class($action); - - common_debug("onStartShowHTML: action = $name"); - - // Avoid a redirect loop - if (!in_array($name, array('FBConnectAuthAction', 'ClientErrorAction'))) { - - $this->checkFacebookUser($action); - - } - $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; @@ -128,15 +115,7 @@ class FBConnectPlugin extends Plugin $apikey = common_config('facebook', 'apikey'); $plugin_path = common_path('plugins/FBConnect'); - $login_url = common_get_returnto(); - - if ($login_url) { - // We don't have to return to it again - common_set_returnto(null); - } else { - $url = common_local_url('public'); - } - + $login_url = common_local_url('FBConnectAuth'); $logout_url = common_local_url('logout'); $html = sprintf('