From ae6a3e258d58c863fb54c1c2b06a426fccb5a689 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 14 Jul 2009 03:45:12 +0800 Subject: [PATCH 01/88] Adds HTTP basic authentication for private RSS 1.0 feeds --- index.php | 3 ++- lib/rssaction.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 5f9a048f2c..69c0bc1b23 100644 --- a/index.php +++ b/index.php @@ -165,7 +165,8 @@ function main() if (!$user && common_config('site', 'private') && !in_array($action, array('login', 'openidlogin', 'finishopenidlogin', - 'recoverpassword', 'api', 'doc', 'register'))) { + 'recoverpassword', 'api', 'doc', 'register')) && + !preg_match('/rss$/', $action)) { common_redirect(common_local_url('login')); return; } diff --git a/lib/rssaction.php b/lib/rssaction.php index fe3fd6f4a2..dceabcbec8 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -96,6 +96,28 @@ class Rss10Action extends Action { // Parent handling, including cache check parent::handle($args); + + if (common_config('site', 'private')) { + if (!isset($_SERVER['PHP_AUTH_USER'])) { + + # This header makes basic auth go + header('WWW-Authenticate: Basic realm="Laconica RSS"'); + + # If the user hits cancel -- bam! + $this->show_basic_auth_error(); + return; + } else { + $nickname = $_SERVER['PHP_AUTH_USER']; + $password = $_SERVER['PHP_AUTH_PW']; + + if (!common_check_user($nickname, $password)) { + # basic authentication failed + $this->show_basic_auth_error(); + return; + } + } + } + // Get the list of notices if (empty($this->tag)) { $this->notices = $this->getNotices($this->limit); @@ -105,6 +127,18 @@ class Rss10Action extends Action $this->showRss(); } + function show_basic_auth_error() + { + header('HTTP/1.1 401 Unauthorized'); + header('Content-Type: application/xml; charset=utf-8'); + $this->startXML(); + $this->elementStart('hash'); + $this->element('error', null, 'Could not authenticate you.'); + $this->element('request', null, $_SERVER['REQUEST_URI']); + $this->elementEnd('hash'); + $this->endXML(); + } + /** * Get the notices to output in this stream * From 8f1b1ffcf04da08193da51544487afa6647ad225 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 24 Jun 2009 04:04:28 +1200 Subject: [PATCH 02/88] mysql or pgsql required (not mysql) --- install.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 570b08edf4..4e54ba8700 100644 --- a/install.php +++ b/install.php @@ -48,7 +48,7 @@ function checkPrereqs() $pass = false; } - $reqs = array('gd', 'mysql', 'curl', + $reqs = array('gd', 'curl', 'xmlwriter', 'mbstring', 'gettext'); @@ -58,6 +58,10 @@ function checkPrereqs() $pass = false; } } + if (!checkExtension('pgsql') && !checkExtension('mysql')) { + ?>

Cannot mysql or pgsql extension. You need one or the other:

Cannot write config file to:

From 4d42bc7690da6cb87b4526c25e5447d06ba12212 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 24 Jun 2009 04:07:15 +1200 Subject: [PATCH 03/88] missing word (find) added --- install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.php b/install.php index 4e54ba8700..103c367c33 100644 --- a/install.php +++ b/install.php @@ -59,7 +59,7 @@ function checkPrereqs() } } if (!checkExtension('pgsql') && !checkExtension('mysql')) { - ?>

Cannot mysql or pgsql extension. You need one or the other:

Cannot find mysql or pgsql extension. You need one or the other:

Date: Wed, 24 Jun 2009 04:31:52 +1200 Subject: [PATCH 04/88] added dbtype to the installer form --- install.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install.php b/install.php index 103c367c33..233a05550e 100644 --- a/install.php +++ b/install.php @@ -126,12 +126,14 @@ function showForm()

Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.

  • - - -

    Database hostname

    + + MySQL
    + PostgreSQL
    +

    Database type

  • +
  • - +

    Database name

  • From 3fe182e86503a9e95183fe6d641e511a4d3eb0f1 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 17:37:01 +1200 Subject: [PATCH 05/88] added dbtype detection - and only install mysql stuff if mysql selected --- install.php | 114 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/install.php b/install.php index 233a05550e..61156e9371 100644 --- a/install.php +++ b/install.php @@ -126,14 +126,20 @@ function showForm()

    Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.

  • + + +

    Database hostname

    +
  • +
  • + - MySQL
    - PostgreSQL
    + MySQL
    + PostgreSQL

    Database type

  • - +

    Database name

  • @@ -145,7 +151,7 @@ function showForm()
  • -

    Database password

    +

    Database password (optional)

  • @@ -169,6 +175,7 @@ function handlePost() 'SMS carrier', - 'notice_source' => 'notice source', - 'foreign_services' => 'foreign service') - as $scr => $name) { - updateStatus(sprintf("Adding %s data to database...", $name)); - $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); - if ($res === false) { - updateStatus(sprintf("Can't run %d script.", $name), true); - showForm(); - return; - } - } - updateStatus("Writing config file..."); - $sqlUrl = "mysqli://$username:$password@$host/$database"; - $res = writeConf($sitename, $sqlUrl, $fancy); - if (!$res) { - updateStatus("Can't write config file.", true); - showForm(); - return; - } - updateStatus("Done!"); if ($path) $path .= '/'; updateStatus("You can visit your new Laconica site."); ?> @@ -262,6 +233,57 @@ function handlePost() 'SMS carrier', + 'notice_source' => 'notice source', + 'foreign_services' => 'foreign service') + as $scr => $name) { + updateStatus(sprintf("Adding %s data to database...", $name)); + $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); + if ($res === false) { + updateStatus(sprintf("Can't run %d script.", $name), true); + showForm(); + return; + } + } + + updateStatus("Writing config file..."); + $sqlUrl = "mysqli://$username:$password@$host/$database"; + $res = writeConf($sitename, $sqlUrl, $fancy); + if (!$res) { + updateStatus("Can't write config file.", true); + showForm(); + return; + } + updateStatus("Done!"); + } function writeConf($sitename, $sqlUrl, $fancy) { $res = file_put_contents(INSTALLDIR.'/config.php', From 343e2010ae276fa4ca5e56c40eb6f06cd01a6136 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 17:43:46 +1200 Subject: [PATCH 06/88] connect to pg working --- install.php | 97 +++++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/install.php b/install.php index 61156e9371..9f48c919de 100644 --- a/install.php +++ b/install.php @@ -204,21 +204,21 @@ function handlePost() $fail = true; } - if (empty($password)) { - updateStatus("No password specified.", true); - $fail = true; - } +// if (empty($password)) { +// updateStatus("No password specified.", true); +// $fail = true; +// } if (empty($sitename)) { updateStatus("No sitename specified.", true); $fail = true; } - if($fail){ - showForm(); - return; - } - + if($fail){ + showForm(); + return; + } + switch($dbtype) { case 'mysql': mysql_db_installer($host, $database, $username, $password, $sitename); break; @@ -233,46 +233,55 @@ function handlePost() 'SMS carrier', + 'notice_source' => 'notice source', + 'foreign_services' => 'foreign service') + as $scr => $name) { + updateStatus(sprintf("Adding %s data to database...", $name)); + $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); if ($res === false) { - updateStatus("Can't run database script.", true); + updateStatus(sprintf("Can't run %d script.", $name), true); showForm(); return; } - foreach (array('sms_carrier' => 'SMS carrier', - 'notice_source' => 'notice source', - 'foreign_services' => 'foreign service') - as $scr => $name) { - updateStatus(sprintf("Adding %s data to database...", $name)); - $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn); - if ($res === false) { - updateStatus(sprintf("Can't run %d script.", $name), true); - showForm(); - return; - } - } + } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; From 4f9c3b50e7103498f06f7c9b0a232bcda5bf17b8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 18:01:03 +1200 Subject: [PATCH 07/88] install.php works for postgres --- install.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index 9f48c919de..1b8b7655c6 100644 --- a/install.php +++ b/install.php @@ -244,6 +244,45 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename) { updateStatus("Checking database..."); $conn = pg_connect($connstring); + updateStatus("Running database script..."); + //wrap in transaction; + pg_query($conn, 'BEGIN'); + $res = runDbScript(INSTALLDIR.'/db/laconica_pg.sql', $conn, 'pgsql'); + + if ($res === false) { + updateStatus("Can't run database script.", true); + showForm(); + return; + } + foreach (array('sms_carrier' => 'SMS carrier', + 'notice_source' => 'notice source', + 'foreign_services' => 'foreign service') + as $scr => $name) { + updateStatus(sprintf("Adding %s data to database...", $name)); + $res = runDbScript(INSTALLDIR.'/db/'.$scr.'.sql', $conn, 'pgsql'); + if ($res === false) { + updateStatus(sprintf("Can't run %d script.", $name), true); + showForm(); + return; + } + } + pg_query($conn, 'COMMIT'); + + updateStatus("Writing config file..."); + if (empty($password)) { + $sqlUrl = "pgsql://$username@$host/$database"; + } + else { + $sqlUrl = "pgsql://$username:$password@$host/$database"; + } + $res = writeConf($sitename, $sqlUrl, $fancy); + if (!$res) { + updateStatus("Can't write config file.", true); + showForm(); + return; + } + updateStatus("Done!"); + } function mysql_db_installer($host, $database, $username, $password, $sitename) { @@ -305,7 +344,7 @@ function writeConf($sitename, $sqlUrl, $fancy) return $res; } -function runDbScript($filename, $conn) +function runDbScript($filename, $conn, $type='mysql') { $sql = trim(file_get_contents($filename)); $stmts = explode(';', $sql); @@ -314,8 +353,13 @@ function runDbScript($filename, $conn) if (!mb_strlen($stmt)) { continue; } - $res = mysql_query($stmt, $conn); + if ($type == 'mysql') { + $res = mysql_query($stmt, $conn); + } elseif ($type=='pgsql') { + $res = pg_query($conn, $stmt); + } if ($res === false) { + updateStatus("FAILED SQL: $stmt"); return $res; } } From 6b710092061d885a358dc07c8153324e36677965 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 25 Jun 2009 21:59:33 +1200 Subject: [PATCH 08/88] removed semicolons from comments (mucks up logic in install.php) and fixed stray commas that stopped it parsing as valid SQL --- db/laconica_pg.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index dae8b8fafe..3683273a3e 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -120,6 +120,7 @@ create table notice ( conversation integer /*id of root notice in this conversation' */ references notice (id) + /* FULLTEXT(content) */ ); create index notice_profile_id_idx on notice using btree(profile_id); From b5fa0ac1d1b6b3e4ecd0f39fe086702cf19eccdf Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 18:48:39 +1200 Subject: [PATCH 09/88] added missing conversation id to notices Conflicts: db/laconica_pg.sql --- db/laconica_pg.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 3683273a3e..dae8b8fafe 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -120,7 +120,6 @@ create table notice ( conversation integer /*id of root notice in this conversation' */ references notice (id) - /* FULLTEXT(content) */ ); create index notice_profile_id_idx on notice using btree(profile_id); From f22ed5dc807392889a910d491b614c5d33efa8af Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:55:43 +1200 Subject: [PATCH 10/88] added group_block and group_alias tables --- db/laconica_pg.sql | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index dae8b8fafe..92331181d7 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -499,6 +499,26 @@ create table design ( primary key (id) ); +create table group_block ( + group_id integer not null /* comment 'group profile is blocked from' */ references user_group (id), + blocked integer not null /* comment 'profile that is blocked' */references profile (id), + blocker integer not null /* comment 'user making the block'*/ references "user" (id), + modified timestamp /* comment 'date of blocking'*/ , + + primary key (group_id, blocked) +); + +create table group_alias ( + + alias varchar(64) /* comment 'additional nickname for the group'*/ , + group_id integer not null /* comment 'group profile is blocked from'*/ references user_group (id), + modified timestamp /* comment 'date alias was created'*/, + primary key (alias) + +); +create index group_alias_group_id_idx on group_alias (group_id); + + /* Textsearch stuff */ create index textsearch_idx on profile using gist(textsearch); From 186b5a1674ae345829b57c495f590140424e04ad Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 22:39:19 +1200 Subject: [PATCH 11/88] added design_id to user_group --- db/laconica_pg.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 92331181d7..e70573bfba 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,3 +1,4 @@ + design_id integer comment 'id of a design' references design(id), /* local and remote users have profiles */ create sequence profile_seq; @@ -390,6 +391,8 @@ create table user_group ( homepage_logo varchar(255) /* comment 'homepage (profile) size logo' */, stream_logo varchar(255) /* comment 'stream-sized logo' */, mini_logo varchar(255) /* comment 'mini logo' */, + design_id integer /*comment 'id of a design' */ references design(id), + created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */ From fc3b11bff954c90b93a240d39e5aea3462d0158a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 13:36:15 +1200 Subject: [PATCH 12/88] moved creation of design table earlier than user_group --- db/laconica_pg.sql | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index e70573bfba..78791adaa3 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,4 +1,3 @@ - design_id integer comment 'id of a design' references design(id), /* local and remote users have profiles */ create sequence profile_seq; @@ -376,6 +375,20 @@ create table profile_block ( ); +create sequence design_seq; +create table design ( + id bigint default nextval('design_seq') /* comment 'design ID'*/, + backgroundcolor integer /* comment 'main background color'*/ , + contentcolor integer /*comment 'content area background color'*/ , + sidebarcolor integer /*comment 'sidebar background color'*/ , + textcolor integer /*comment 'text color'*/ , + linkcolor integer /*comment 'link color'*/, + backgroundimage varchar(255) /*comment 'background image, if any'*/, + disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/, + primary key (id) +); + + create sequence user_group_seq; create table user_group ( @@ -489,19 +502,6 @@ create table file_to_post ( unique(file_id, post_id) ); -create sequence design_seq; -create table design ( - id bigint default nextval('design_seq') /* comment 'design ID'*/, - backgroundcolor integer /* comment 'main background color'*/ , - contentcolor integer /*comment 'content area background color'*/ , - sidebarcolor integer /*comment 'sidebar background color'*/ , - textcolor integer /*comment 'text color'*/ , - linkcolor integer /*comment 'link color'*/, - backgroundimage varchar(255) /*comment 'background image, if any'*/, - disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/, - primary key (id) -); - create table group_block ( group_id integer not null /* comment 'group profile is blocked from' */ references user_group (id), blocked integer not null /* comment 'profile that is blocked' */references profile (id), From 63ea2b7c451640910d4190c7c0d904af688a85d5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 20:25:52 +1200 Subject: [PATCH 13/88] changed to SQL standard of LIMIT 20 OFFSET 1 etc. --- classes/Fave.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Fave.php b/classes/Fave.php index c3ec62dcf0..4b28d06b46 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -79,7 +79,7 @@ class Fave extends Memcached_DataObject $qry .= 'ORDER BY modified DESC '; if (!is_null($offset)) { - $qry .= "LIMIT $offset, $limit"; + $qry .= "LIMIT $limit OFFSET $offset"; } $fav->query($qry); From 1b3c4f2c52e2f983470b8b4e0ffd911694ab2eb5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:49:44 +1200 Subject: [PATCH 14/88] quote identifiers and type='psql' needs to be written to config.php --- install.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 1b8b7655c6..e73e20ab63 100644 --- a/install.php +++ b/install.php @@ -332,7 +332,7 @@ function mysql_db_installer($host, $database, $username, $password, $sitename) { } updateStatus("Done!"); } -function writeConf($sitename, $sqlUrl, $fancy) +function writeConf($sitename, $sqlUrl, $fancy, $type='mysql') { $res = file_put_contents(INSTALLDIR.'/config.php', ""); return $res; } From d591e24eac5f37dbff7b17ac039c2e8bc0a33653 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:53:37 +1200 Subject: [PATCH 15/88] typo in config variable and pass type='pgsql' in to writeConf --- install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index e73e20ab63..096746d4ae 100644 --- a/install.php +++ b/install.php @@ -275,7 +275,7 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename) { else { $sqlUrl = "pgsql://$username:$password@$host/$database"; } - $res = writeConf($sitename, $sqlUrl, $fancy); + $res = writeConf($sitename, $sqlUrl, $fancy, 'pgsql'); if (!$res) { updateStatus("Can't write config file.", true); showForm(); @@ -341,7 +341,7 @@ function writeConf($sitename, $sqlUrl, $fancy, $type='mysql') ($fancy ? "\$config['site']['fancy'] = true;\n\n":''). "\$config['db']['database'] = \"$sqlUrl\";\n\n". ($type == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n" . - "\$config['db']['dbtype'] = \"$type\";\n\n" : ''). + "\$config['db']['type'] = \"$type\";\n\n" : ''). "?>"); return $res; } From 1a151ff6f686da198aac72a0adb5001f5d6dcd43 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 22:13:41 +1200 Subject: [PATCH 16/88] used SQL standard LIMIT/OFFSET, because every database can understand that --- lib/popularnoticesection.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php index e47c9b3855..167a6ff8df 100644 --- a/lib/popularnoticesection.php +++ b/lib/popularnoticesection.php @@ -74,11 +74,7 @@ class PopularNoticeSection extends NoticeSection $offset = 0; $limit = NOTICES_PER_SECTION + 1; - if (common_config('db', 'type') == 'pgsql') { - $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; - } else { - $qry .= ' LIMIT ' . $offset . ', ' . $limit; - } + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; $notice = Memcached_DataObject::cachedQuery('Notice', sprintf($qry, common_config('popular', 'dropoff')), From 15042ed50b72804eaeefd0c60aa63674bdefe8b4 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:24:59 +1200 Subject: [PATCH 17/88] added user_group.design_id into the group by clause --- lib/groupsbymemberssection.php | 2 +- lib/groupsbypostssection.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/groupsbymemberssection.php b/lib/groupsbymemberssection.php index 963e21f156..ad4884bf8b 100644 --- a/lib/groupsbymemberssection.php +++ b/lib/groupsbymemberssection.php @@ -48,7 +48,7 @@ class GroupsByMembersSection extends GroupSection $qry = 'SELECT user_group.*, count(*) as value ' . 'FROM user_group JOIN group_member '. 'ON user_group.id = group_member.group_id ' . - 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' . + 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' . 'ORDER BY value DESC '; $limit = GROUPS_PER_SECTION; diff --git a/lib/groupsbypostssection.php b/lib/groupsbypostssection.php index 325b4033f4..dc7925d5e5 100644 --- a/lib/groupsbypostssection.php +++ b/lib/groupsbypostssection.php @@ -48,7 +48,7 @@ class GroupsByPostsSection extends GroupSection $qry = 'SELECT user_group.*, count(*) as value ' . 'FROM user_group JOIN group_inbox '. 'ON user_group.id = group_inbox.group_id ' . - 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified ' . + 'GROUP BY user_group.id,user_group.nickname,user_group.fullname,user_group.homepage,user_group.description,user_group.location,user_group.original_logo,user_group.homepage_logo,user_group.stream_logo,user_group.mini_logo,user_group.created,user_group.modified,user_group.design_id ' . 'ORDER BY value DESC '; $limit = GROUPS_PER_SECTION; From 403bb38bcd191d7b4e9c62e7f5f4bbb3968729df Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:29:02 +1200 Subject: [PATCH 18/88] used single quotes in SQL --- classes/Notice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Notice.php b/classes/Notice.php index 08125cf7b0..4e244c6661 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -873,7 +873,7 @@ class Notice extends Memcached_DataObject if ($cnt > 0) { $qry .= ', '; } - $qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") '; + $qry .= '('.$id.', '.$this->id.', '.$source.", '".$this->created. "') "; $cnt++; if ($cnt >= MAX_BOXCARS) { $inbox = new Notice_inbox(); From 565dec0e213570b2cad3fa11ec42caf5b52ce1c8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:31:31 +1200 Subject: [PATCH 19/88] use quote identifiers on the user table --- classes/User_group.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/User_group.php b/classes/User_group.php index 27b444705d..b1ab1c2d31 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -275,11 +275,14 @@ class User_group extends Memcached_DataObject // XXX: cache this $user = new User(); + if(common_config('db','quote_identifiers')) + $user_table = '"user"'; + else $user_table = 'user'; $qry = 'SELECT id ' . - 'FROM user JOIN group_member '. - 'ON user.id = group_member.profile_id ' . + 'FROM '. $user_table .' JOIN group_member '. + 'ON '. $user_table .'.id = group_member.profile_id ' . 'WHERE group_member.group_id = %d '; $user->query(sprintf($qry, $this->id)); From 3722b90a27b2fd53d77c60d51c53cc3e548ffcf9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:32:50 +1200 Subject: [PATCH 20/88] use single quotes in sql --- lib/grouptagcloudsection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/grouptagcloudsection.php b/lib/grouptagcloudsection.php index 9b7a10f6b9..0e0cbdd63d 100644 --- a/lib/grouptagcloudsection.php +++ b/lib/grouptagcloudsection.php @@ -73,7 +73,7 @@ class GroupTagCloudSection extends TagCloudSection $quoted = array(); foreach ($names as $name) { - $quoted[] = "\"$name\""; + $quoted[] = "'$name'"; } $namestring = implode(',', $quoted); From 788dd66dbe75db5d09c0cd5b33bb3347233cbd15 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 20:23:52 +1200 Subject: [PATCH 21/88] add quotes around table named "user" when quote_identifiers is true --- classes/Notice.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 4e244c6661..8974e22f83 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -896,10 +896,14 @@ class Notice extends Memcached_DataObject { $user = new User(); + if(common_config('db','quote_identifiers')) + $user_table = '"user"'; + else $user_table = 'user'; + $qry = 'SELECT id ' . - 'FROM user JOIN subscription '. - 'ON user.id = subscription.subscriber ' . + 'FROM '. $user_table .' JOIN subscription '. + 'ON '. $user_table .'.id = subscription.subscriber ' . 'WHERE subscription.subscribed = %d '; $user->query(sprintf($qry, $this->profile_id)); From 0aeea42724b7eac2bd2cd78b9d740fe5491d8df4 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 15 Jul 2009 10:29:54 -0400 Subject: [PATCH 22/88] Added stub oembed api endpoint --- actions/api.php | 1 + actions/twitapilaconica.php | 8 ++++++++ lib/router.php | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/actions/api.php b/actions/api.php index 452ed8e824..fa5a7e7ae9 100644 --- a/actions/api.php +++ b/actions/api.php @@ -129,6 +129,7 @@ class ApiAction extends Action 'laconica/config', 'laconica/wadl', 'tags/timeline', + 'laconica/oembed', 'groups/timeline'); static $bareauth = array('statuses/user_timeline', diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php index 8cd7a64b9f..ec40bc6273 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapilaconica.php @@ -171,4 +171,12 @@ class TwitapilaconicaAction extends TwitterapiAction parent::handle($args); $this->serverError(_('API method under construction.'), 501); } + + function oembed($args, $apidata) + { + parent::handle($args); + $url = $args['url']; + print_r($apidata); + die("oembed!"); + } } diff --git a/lib/router.php b/lib/router.php index e121386370..652d2a2663 100644 --- a/lib/router.php +++ b/lib/router.php @@ -390,6 +390,10 @@ class Router // laconica + $m->connect('api/laconica/:method', + array('action' => 'api', + 'apiaction' => 'laconica')); + $m->connect('api/laconica/:method', array('action' => 'api', 'apiaction' => 'laconica')); From e637e5a8a97d5a30710046e70b1994007d65b939 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 15 Jul 2009 14:49:41 -0400 Subject: [PATCH 23/88] Support oembed for attachments and notices --- actions/twitapilaconica.php | 117 +++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php index ec40bc6273..114dff6eed 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapilaconica.php @@ -175,8 +175,121 @@ class TwitapilaconicaAction extends TwitterapiAction function oembed($args, $apidata) { parent::handle($args); + + common_debug("in oembed api action"); + + $this->auth_user = $apidata['user']; + $url = $args['url']; - print_r($apidata); - die("oembed!"); + if( substr(strtolower($url),0,strlen(common_root_url())) == strtolower(common_root_url()) ){ + $path = substr($url,strlen(common_root_url())); + + $r = Router::get(); + + $proxy_args = $r->map($path); + + if (!$proxy_args) { + $this->serverError(_("$path not found"), 404); + } + $oembed=array(); + $oembed['version']='1.0'; + $oembed['provider_name']=common_config('site', 'name'); + $oembed['provider_url']=common_root_url(); + switch($proxy_args['action']){ + case 'shownotice': + $oembed['type']='link'; + $id = $proxy_args['notice']; + $notice = Notice::staticGet($id); + if(empty($notice)){ + $this->serverError(_("notice $id not found"), 404); + } + $profile = $notice->getProfile(); + if (empty($profile)) { + $this->serverError(_('Notice has no profile'), 500); + } + if (!empty($profile->fullname)) { + $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; + } else { + $authorname = $profile->nickname; + } + $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), + $authorname, + common_exact_date($notice->created)); + $oembed['author_name']=$authorname; + $oembed['author_url']=$profile->profileurl; + $oembed['url']=($notice->url?$notice->url:$notice->uri); + $oembed['html']=$notice->rendered; + break; + case 'attachment': + $id = $proxy_args['attachment']; + $attachment = File::staticGet($id); + if(empty($attachment)){ + $this->serverError(_("attachment $id not found"), 404); + } + if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ + // Proxy the existing oembed information + $oembed['type']=$file_oembed->type; + $oembed['provider']=$file_oembed->provider; + $oembed['provider_url']=$file_oembed->provider_url; + $oembed['width']=$file_oembed->width; + $oembed['height']=$file_oembed->height; + $oembed['html']=$file_oembed->html; + $oembed['title']=$file_oembed->title; + $oembed['author_name']=$file_oembed->author_name; + $oembed['author_url']=$file_oembed->author_url; + $oembed['url']=$file_oembed->url; + }else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){ + $oembed['type']='photo'; + //TODO set width and height + //$oembed['width']= + //$oembed['height']= + $oembed['url']=$attachment->url; + }else{ + $oembed['type']='link'; + $oembed['url']=common_local_url('attachment', + array('attachment' => $attachment->id)); + } + if($attachment->title) $oembed['title']=$attachment->title; + break; + default: + $this->serverError(_("$path not supported for oembed requests"), 501); + } + + switch($apidata['content-type']){ + case 'xml': + $this->init_document('xml'); + $this->elementStart('oembed'); + $this->element('version',null,$oembed['version']); + $this->element('type',null,$oembed['type']); + if($oembed['provider_name']) $this->element('provider_name',null,$oembed['provider_name']); + if($oembed['provider_url']) $this->element('provider_url',null,$oembed['provider_url']); + if($oembed['title']) $this->element('title',null,$oembed['title']); + if($oembed['author_name']) $this->element('author_name',null,$oembed['author_name']); + if($oembed['author_url']) $this->element('author_url',null,$oembed['author_url']); + if($oembed['url']) $this->element('url',null,$oembed['url']); + if($oembed['html']) $this->element('html',null,$oembed['html']); + if($oembed['width']) $this->element('width',null,$oembed['width']); + if($oembed['height']) $this->element('height',null,$oembed['height']); + if($oembed['cache_age']) $this->element('cache_age',null,$oembed['cache_age']); + if($oembed['thumbnail_url']) $this->element('thumbnail_url',null,$oembed['thumbnail_url']); + if($oembed['thumbnail_width']) $this->element('thumbnail_width',null,$oembed['thumbnail_width']); + if($oembed['thumbnail_height']) $this->element('thumbnail_height',null,$oembed['thumbnail_height']); + + + $this->elementEnd('oembed'); + $this->end_document('xml'); + break; + case 'json': + $this->init_document('json'); + print(json_encode($oembed)); + $this->end_document('json'); + break; + default: + $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501); + } + + }else{ + $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404); + } } } From 6308539c1d669ad0b6072b48deeaa95969ebe318 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 15 Jul 2009 15:11:29 -0400 Subject: [PATCH 24/88] Added oEmbed discovery for attachments and notices --- actions/attachment.php | 22 ++++++++++++++++++++++ actions/shownotice.php | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/actions/attachment.php b/actions/attachment.php index ee4cd9640d..c9c416cb5b 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -98,6 +98,28 @@ class AttachmentAction extends Action return $a->title(); } + function extraHead() + { + $this->element('link',array('rel'=>'alternate', + 'type'=>'application/json+oembed', + 'href'=>common_local_url( + 'api', + array('apiaction'=>'laconica','method'=>'oembed.json'), + array('url'=> + common_local_url('attachment', + array('attachment' => $this->attachment->id)))), + 'title'=>'oEmbed'),null); + $this->element('link',array('rel'=>'alternate', + 'type'=>'text/xml+oembed', + 'href'=>common_local_url( + 'api', + array('apiaction'=>'laconica','method'=>'oembed.xml'), + array('url'=> + common_local_url('attachment', + array('attachment' => $this->attachment->id)))), + 'title'=>'oEmbed'),null); + } + /** * Handle input * diff --git a/actions/shownotice.php b/actions/shownotice.php index 1ec38a76bc..4cf226f1cf 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -275,6 +275,20 @@ class ShownoticeAction extends OwnerDesignAction $this->element('meta', array('name' => 'microid', 'content' => $id->toString())); } + $this->element('link',array('rel'=>'alternate', + 'type'=>'application/json+oembed', + 'href'=>common_local_url( + 'api', + array('apiaction'=>'laconica','method'=>'oembed.json'), + array('url'=>$this->notice->uri)), + 'title'=>'oEmbed'),null); + $this->element('link',array('rel'=>'alternate', + 'type'=>'text/xml+oembed', + 'href'=>common_local_url( + 'api', + array('apiaction'=>'laconica','method'=>'oembed.xml'), + array('url'=>$this->notice->uri)), + 'title'=>'oEmbed'),null); } } From 5d82b3e02a0d65ef6d2843873d18681cc7930111 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 15 Jul 2009 21:08:38 +0000 Subject: [PATCH 25/88] Reduced notice div.entry-content width so that in the case of super deep/crazy conversations the notice options don't misalign. --- theme/base/css/display.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 3604f193a0..eb4e88d02f 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -863,7 +863,7 @@ clear:left; float:left; font-size:0.95em; margin-left:59px; -width:60%; +width:50%; } #showstream .notice div.entry-content, #shownotice .notice div.entry-content { From f75932601c08cdbdf68fddc7b5f9871b64d841ec Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 15 Jul 2009 17:09:11 -0400 Subject: [PATCH 26/88] Fixed bugs in oEmbed library's discovery routines --- extlib/Services/oEmbed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extlib/Services/oEmbed.php b/extlib/Services/oEmbed.php index 5d38ed883d..7d507b6f62 100644 --- a/extlib/Services/oEmbed.php +++ b/extlib/Services/oEmbed.php @@ -162,7 +162,7 @@ class Services_oEmbed } if ($this->options[self::OPTION_API] === null) { - $this->options[self::OPTION_API] = $this->discover(); + $this->options[self::OPTION_API] = $this->discover($url); } } @@ -319,7 +319,7 @@ class Services_oEmbed } } - return (isset($ret['json']) ? $ret['json'] : array_pop($ret)); + return (isset($ret['application/json']) ? $ret['application/json'] : array_pop($ret)); } /** From a35794e3c3bd147d3344eaad4b669f45595a3df5 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 15 Jul 2009 17:10:36 -0400 Subject: [PATCH 27/88] Try oEmbed discovery before using oohembed --- classes/File.php | 5 ++-- classes/File_oembed.php | 55 +++++++++++++++++++++++--------------- classes/File_thumbnail.php | 6 ++--- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/classes/File.php b/classes/File.php index 56d9f98278..68d385d1ea 100644 --- a/classes/File.php +++ b/classes/File.php @@ -79,9 +79,8 @@ class File extends Memcached_DataObject if (isset($redir_data['type']) && ('text/html' === substr($redir_data['type'], 0, 9)) - && ($oembed_data = File_oembed::_getOembed($given_url)) - && isset($oembed_data['json'])) { - File_oembed::saveNew($oembed_data['json'], $file_id); + && ($oembed_data = File_oembed::_getOembed($given_url))) { + File_oembed::saveNew($oembed_data, $file_id); } return $x; } diff --git a/classes/File_oembed.php b/classes/File_oembed.php index 69230e4a48..bbf112729b 100644 --- a/classes/File_oembed.php +++ b/classes/File_oembed.php @@ -56,33 +56,46 @@ class File_oembed extends Memcached_DataObject return array(false, false, false); } - function _getOembed($url, $maxwidth = 500, $maxheight = 400, $format = 'json') { - $cmd = common_config('oohembed', 'endpoint') . '?url=' . urlencode($url); - if (is_int($maxwidth)) $cmd .= "&maxwidth=$maxwidth"; - if (is_int($maxheight)) $cmd .= "&maxheight=$maxheight"; - if (is_string($format)) $cmd .= "&format=$format"; - $oe = @file_get_contents($cmd); - if (false === $oe) return false; - return array($format => (('json' === $format) ? json_decode($oe, true) : $oe)); + function _getOembed($url, $maxwidth = 500, $maxheight = 400) { + require_once INSTALLDIR.'/extlib/Services/oEmbed.php'; + $parameters = array( + 'maxwidth'=>$maxwidth, + 'maxheight'=>$maxheight, + ); + try{ + $oEmbed = new Services_oEmbed($url); + $object = $oEmbed->getObject($parameters); + return $object; + }catch(Exception $e){ + try{ + $oEmbed = new Services_oEmbed($url, array( + Services_oEmbed::OPTION_API => common_config('oohembed', 'endpoint') + )); + $object = $oEmbed->getObject($parameters); + return $object; + }catch(Exception $ex){ + return false; + } + } } function saveNew($data, $file_id) { $file_oembed = new File_oembed; $file_oembed->file_id = $file_id; - $file_oembed->version = $data['version']; - $file_oembed->type = $data['type']; - if (!empty($data['provider_name'])) $file_oembed->provider = $data['provider_name']; - if (!isset($file_oembed->provider) && !empty($data['provide'])) $file_oembed->provider = $data['provider']; - if (!empty($data['provide_url'])) $file_oembed->provider_url = $data['provider_url']; - if (!empty($data['width'])) $file_oembed->width = intval($data['width']); - if (!empty($data['height'])) $file_oembed->height = intval($data['height']); - if (!empty($data['html'])) $file_oembed->html = $data['html']; - if (!empty($data['title'])) $file_oembed->title = $data['title']; - if (!empty($data['author_name'])) $file_oembed->author_name = $data['author_name']; - if (!empty($data['author_url'])) $file_oembed->author_url = $data['author_url']; - if (!empty($data['url'])) $file_oembed->url = $data['url']; + $file_oembed->version = $data->version; + $file_oembed->type = $data->type; + if (!empty($data->provider_name)) $file_oembed->provider = $data->provider_name; + if (!empty($data->provider)) $file_oembed->provider = $data->provider; + if (!empty($data->provide_url)) $file_oembed->provider_url = $data->provider_url; + if (!empty($data->width)) $file_oembed->width = intval($data->width); + if (!empty($data->height)) $file_oembed->height = intval($data->height); + if (!empty($data->html)) $file_oembed->html = $data->html; + if (!empty($data->title)) $file_oembed->title = $data->title; + if (!empty($data->author_name)) $file_oembed->author_name = $data->author_name; + if (!empty($data->author_url)) $file_oembed->author_url = $data->author_url; + if (!empty($data->url)) $file_oembed->url = $data->url; $file_oembed->insert(); - if (!empty($data['thumbnail_url'])) { + if (!empty($data->thumbnail_url)) { File_thumbnail::saveNew($data, $file_id); } } diff --git a/classes/File_thumbnail.php b/classes/File_thumbnail.php index 44b92a2fad..0b09c6af8c 100644 --- a/classes/File_thumbnail.php +++ b/classes/File_thumbnail.php @@ -51,9 +51,9 @@ class File_thumbnail extends Memcached_DataObject function saveNew($data, $file_id) { $tn = new File_thumbnail; $tn->file_id = $file_id; - $tn->url = $data['thumbnail_url']; - $tn->width = intval($data['thumbnail_width']); - $tn->height = intval($data['thumbnail_height']); + $tn->url = $data->thumbnail_url; + $tn->width = intval($data->thumbnail_width); + $tn->height = intval($data->thumbnail_height); $tn->insert(); } } From c055449ee086b617891f6efa31cfab487336ec44 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 10:56:46 -0400 Subject: [PATCH 28/88] update Piwik analytics code --- plugins/PiwikAnalyticsPlugin.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index d2c52354ed..dc3c7c37fe 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -87,18 +87,25 @@ class PiwikAnalyticsPlugin extends Plugin function onEndShowScripts($action) { - $js1 = 'var pkBaseURL = (("https:" == document.location.protocol) ? "https://'. - $this->piwikroot.'" : "http://'.$this->piwikroot. - '"); document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\''. - ' type=\'text/javascript\'%3E%3C/script%3E"));'; - $js2 = 'piwik_action_name = ""; piwik_idsite = '.$this->piwikid. - '; piwik_url = pkBaseURL + "piwik.php"; piwik_log(piwik_action_name, piwik_idsite, piwik_url);'; - $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw($js1); - $action->elementEnd('script'); - $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw($js2); - $action->elementEnd('script'); + $piwikCode = << + + + + +ENDOFPIWIK; + + $action->raw($piwikCode); return true; } } \ No newline at end of file From 0333caf421308a61e5f76f334653ceeb0577c6c9 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 16 Jul 2009 10:56:46 -0400 Subject: [PATCH 29/88] update Piwik analytics code --- plugins/PiwikAnalyticsPlugin.php | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/plugins/PiwikAnalyticsPlugin.php b/plugins/PiwikAnalyticsPlugin.php index d2c52354ed..dc3c7c37fe 100644 --- a/plugins/PiwikAnalyticsPlugin.php +++ b/plugins/PiwikAnalyticsPlugin.php @@ -87,18 +87,25 @@ class PiwikAnalyticsPlugin extends Plugin function onEndShowScripts($action) { - $js1 = 'var pkBaseURL = (("https:" == document.location.protocol) ? "https://'. - $this->piwikroot.'" : "http://'.$this->piwikroot. - '"); document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\''. - ' type=\'text/javascript\'%3E%3C/script%3E"));'; - $js2 = 'piwik_action_name = ""; piwik_idsite = '.$this->piwikid. - '; piwik_url = pkBaseURL + "piwik.php"; piwik_log(piwik_action_name, piwik_idsite, piwik_url);'; - $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw($js1); - $action->elementEnd('script'); - $action->elementStart('script', array('type' => 'text/javascript')); - $action->raw($js2); - $action->elementEnd('script'); + $piwikCode = << + + + + +ENDOFPIWIK; + + $action->raw($piwikCode); return true; } } \ No newline at end of file From 350a342509775ace6228074aa4bd514ad7dfc62d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 16 Jul 2009 19:58:24 +0000 Subject: [PATCH 30/88] Using bottom instead of top for form_note --- theme/base/css/display.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index eb4e88d02f..867dc0ef7c 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -482,7 +482,7 @@ height:16px; } #form_notice .form_note { position:absolute; -top:99px; +bottom:2px; right:98px; z-index:9; } From 9b372f5bb7638d5d9b4e48ae425d921bc8559235 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 16 Jul 2009 19:58:43 +0000 Subject: [PATCH 31/88] Added form_note for notice character count. http://laconi.ca/trac/ticket/1712 --- lib/messageform.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/messageform.php b/lib/messageform.php index b8878ec1f9..8ea2b36c27 100644 --- a/lib/messageform.php +++ b/lib/messageform.php @@ -140,6 +140,12 @@ class MessageForm extends Form 'rows' => 4, 'name' => 'content'), ($this->content) ? $this->content : ''); + $this->out->elementStart('dl', 'form_note'); + $this->out->element('dt', null, _('Available characters')); + $this->out->element('dd', array('id' => 'notice_text-count'), + '140'); + $this->out->elementEnd('dl'); + } /** From 5015505f16c9ce412e6f5535f80188f33d24c4ea Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 17 Jul 2009 16:44:14 +0800 Subject: [PATCH 32/88] Added failed auth logging (like in actions/api.php) --- lib/rssaction.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rssaction.php b/lib/rssaction.php index dceabcbec8..15c238bf90 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -112,6 +112,9 @@ class Rss10Action extends Action if (!common_check_user($nickname, $password)) { # basic authentication failed + list($proxy, $ip) = common_client_ip(); + + common_log(LOG_WARNING, "Failed RSS auth attempt, nickname = $nickname, proxy = $proxy, ip = $ip."); $this->show_basic_auth_error(); return; } From c6505c52965e08db5aaf8b4d5db07e00f19262dc Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 17 Jul 2009 23:13:30 +1200 Subject: [PATCH 33/88] postgres schema - removed not null constraint from nonce.tok, and copied the comment from the mysql schema --- db/laconica_pg.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index dae8b8fafe..2d8286c607 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,3 +1,4 @@ + /* local and remote users have profiles */ create sequence profile_seq; @@ -184,7 +185,7 @@ create table token ( create table nonce ( consumer_key varchar(255) not null /* comment 'unique identifier, root URL' */, - tok char(32) not null /* comment 'identifying value' */, + tok char(32) /* comment 'buggy old value, ignored' */, nonce char(32) null /* comment 'buggy old value, ignored */, ts integer not null /* comment 'timestamp sent' values are epoch, and only used internally */, From 9ed117dc3a405175359d0a541dddfb14cdf15d47 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 12:33:12 -0400 Subject: [PATCH 34/88] Move the oembed endpoint to /main/oembed --- actions/api.php | 2 +- actions/attachment.php | 4 +- actions/shownotice.php | 4 +- actions/twitapilaconica.php | 120 ------------------------------------ lib/router.php | 5 ++ 5 files changed, 10 insertions(+), 125 deletions(-) diff --git a/actions/api.php b/actions/api.php index fa5a7e7ae9..8b92889f8a 100644 --- a/actions/api.php +++ b/actions/api.php @@ -129,7 +129,7 @@ class ApiAction extends Action 'laconica/config', 'laconica/wadl', 'tags/timeline', - 'laconica/oembed', + 'oembed/oembed', 'groups/timeline'); static $bareauth = array('statuses/user_timeline', diff --git a/actions/attachment.php b/actions/attachment.php index c9c416cb5b..c6a5d0d523 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -104,7 +104,7 @@ class AttachmentAction extends Action 'type'=>'application/json+oembed', 'href'=>common_local_url( 'api', - array('apiaction'=>'laconica','method'=>'oembed.json'), + array('apiaction'=>'oembed','method'=>'oembed.json'), array('url'=> common_local_url('attachment', array('attachment' => $this->attachment->id)))), @@ -113,7 +113,7 @@ class AttachmentAction extends Action 'type'=>'text/xml+oembed', 'href'=>common_local_url( 'api', - array('apiaction'=>'laconica','method'=>'oembed.xml'), + array('apiaction'=>'oembed','method'=>'oembed.xml'), array('url'=> common_local_url('attachment', array('attachment' => $this->attachment->id)))), diff --git a/actions/shownotice.php b/actions/shownotice.php index 4cf226f1cf..8f73dc824a 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.php @@ -279,14 +279,14 @@ class ShownoticeAction extends OwnerDesignAction 'type'=>'application/json+oembed', 'href'=>common_local_url( 'api', - array('apiaction'=>'laconica','method'=>'oembed.json'), + array('apiaction'=>'oembed','method'=>'oembed.json'), array('url'=>$this->notice->uri)), 'title'=>'oEmbed'),null); $this->element('link',array('rel'=>'alternate', 'type'=>'text/xml+oembed', 'href'=>common_local_url( 'api', - array('apiaction'=>'laconica','method'=>'oembed.xml'), + array('apiaction'=>'oembed','method'=>'oembed.xml'), array('url'=>$this->notice->uri)), 'title'=>'oEmbed'),null); } diff --git a/actions/twitapilaconica.php b/actions/twitapilaconica.php index 114dff6eed..442fdbcef2 100644 --- a/actions/twitapilaconica.php +++ b/actions/twitapilaconica.php @@ -172,124 +172,4 @@ class TwitapilaconicaAction extends TwitterapiAction $this->serverError(_('API method under construction.'), 501); } - function oembed($args, $apidata) - { - parent::handle($args); - - common_debug("in oembed api action"); - - $this->auth_user = $apidata['user']; - - $url = $args['url']; - if( substr(strtolower($url),0,strlen(common_root_url())) == strtolower(common_root_url()) ){ - $path = substr($url,strlen(common_root_url())); - - $r = Router::get(); - - $proxy_args = $r->map($path); - - if (!$proxy_args) { - $this->serverError(_("$path not found"), 404); - } - $oembed=array(); - $oembed['version']='1.0'; - $oembed['provider_name']=common_config('site', 'name'); - $oembed['provider_url']=common_root_url(); - switch($proxy_args['action']){ - case 'shownotice': - $oembed['type']='link'; - $id = $proxy_args['notice']; - $notice = Notice::staticGet($id); - if(empty($notice)){ - $this->serverError(_("notice $id not found"), 404); - } - $profile = $notice->getProfile(); - if (empty($profile)) { - $this->serverError(_('Notice has no profile'), 500); - } - if (!empty($profile->fullname)) { - $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; - } else { - $authorname = $profile->nickname; - } - $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), - $authorname, - common_exact_date($notice->created)); - $oembed['author_name']=$authorname; - $oembed['author_url']=$profile->profileurl; - $oembed['url']=($notice->url?$notice->url:$notice->uri); - $oembed['html']=$notice->rendered; - break; - case 'attachment': - $id = $proxy_args['attachment']; - $attachment = File::staticGet($id); - if(empty($attachment)){ - $this->serverError(_("attachment $id not found"), 404); - } - if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ - // Proxy the existing oembed information - $oembed['type']=$file_oembed->type; - $oembed['provider']=$file_oembed->provider; - $oembed['provider_url']=$file_oembed->provider_url; - $oembed['width']=$file_oembed->width; - $oembed['height']=$file_oembed->height; - $oembed['html']=$file_oembed->html; - $oembed['title']=$file_oembed->title; - $oembed['author_name']=$file_oembed->author_name; - $oembed['author_url']=$file_oembed->author_url; - $oembed['url']=$file_oembed->url; - }else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){ - $oembed['type']='photo'; - //TODO set width and height - //$oembed['width']= - //$oembed['height']= - $oembed['url']=$attachment->url; - }else{ - $oembed['type']='link'; - $oembed['url']=common_local_url('attachment', - array('attachment' => $attachment->id)); - } - if($attachment->title) $oembed['title']=$attachment->title; - break; - default: - $this->serverError(_("$path not supported for oembed requests"), 501); - } - - switch($apidata['content-type']){ - case 'xml': - $this->init_document('xml'); - $this->elementStart('oembed'); - $this->element('version',null,$oembed['version']); - $this->element('type',null,$oembed['type']); - if($oembed['provider_name']) $this->element('provider_name',null,$oembed['provider_name']); - if($oembed['provider_url']) $this->element('provider_url',null,$oembed['provider_url']); - if($oembed['title']) $this->element('title',null,$oembed['title']); - if($oembed['author_name']) $this->element('author_name',null,$oembed['author_name']); - if($oembed['author_url']) $this->element('author_url',null,$oembed['author_url']); - if($oembed['url']) $this->element('url',null,$oembed['url']); - if($oembed['html']) $this->element('html',null,$oembed['html']); - if($oembed['width']) $this->element('width',null,$oembed['width']); - if($oembed['height']) $this->element('height',null,$oembed['height']); - if($oembed['cache_age']) $this->element('cache_age',null,$oembed['cache_age']); - if($oembed['thumbnail_url']) $this->element('thumbnail_url',null,$oembed['thumbnail_url']); - if($oembed['thumbnail_width']) $this->element('thumbnail_width',null,$oembed['thumbnail_width']); - if($oembed['thumbnail_height']) $this->element('thumbnail_height',null,$oembed['thumbnail_height']); - - - $this->elementEnd('oembed'); - $this->end_document('xml'); - break; - case 'json': - $this->init_document('json'); - print(json_encode($oembed)); - $this->end_document('json'); - break; - default: - $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501); - } - - }else{ - $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404); - } - } } diff --git a/lib/router.php b/lib/router.php index 652d2a2663..bf3895bf01 100644 --- a/lib/router.php +++ b/lib/router.php @@ -113,6 +113,11 @@ class Router $m->connect('main/tagother/:id', array('action' => 'tagother')); + $m->connect('main/:method', + array('action' => 'api', + 'method' => 'oembed(.xml|.json)?', + 'apiaction' => 'oembed')); + // these take a code foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) { From 6d839ae9927b1250aa5e2b497a65abd9d2259c5d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 11:40:38 -0700 Subject: [PATCH 35/88] Removed noisy debugging statements --- classes/Profile.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index 224b61bd2e..372005cddf 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -360,7 +360,6 @@ class Profile extends Memcached_DataObject $c->set(common_cache_key('profile:subscription_count:'.$this->id), $cnt); } - common_debug("subscriptionCount == $cnt"); return $cnt; } @@ -385,7 +384,6 @@ class Profile extends Memcached_DataObject $c->set(common_cache_key('profile:subscriber_count:'.$this->id), $cnt); } - common_debug("subscriberCount == $cnt"); return $cnt; } @@ -407,7 +405,6 @@ class Profile extends Memcached_DataObject $c->set(common_cache_key('profile:fave_count:'.$this->id), $cnt); } - common_debug("faveCount == $cnt"); return $cnt; } @@ -430,7 +427,6 @@ class Profile extends Memcached_DataObject $c->set(common_cache_key('profile:notice_count:'.$this->id), $cnt); } - common_debug("noticeCount == $cnt"); return $cnt; } From baec1320abf95cce4af49b92506de1402a95298a Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 12:33:51 -0700 Subject: [PATCH 36/88] Also show XML representation of attachments in the API --- lib/twitterapi.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 749083c7c5..66664334c8 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -369,6 +369,9 @@ class TwitterapiAction extends Action case 'text': $this->element($element, null, common_xml_safe_str($value)); break; + case 'attachments': + $this->show_xml_attachments($twitter_status['attachments']); + break; default: $this->element($element, null, $value); } @@ -389,6 +392,20 @@ class TwitterapiAction extends Action $this->elementEnd($role); } + function show_xml_attachments($attachments) { + if (!empty($attachments)) { + $this->elementStart('attachments', array('type' => 'array')); + foreach ($attachments as $attachment) { + $attrs = array(); + $attrs['url'] = $attachment['url']; + $attrs['mimetype'] = $attachment['mimetype']; + $attrs['size'] = $attachment['size']; + $this->element('enclosure', $attrs, ''); + } + $this->elementEnd('attachments'); + } + } + function show_twitter_rss_item($entry) { $this->elementStart('item'); From 9c670ba695d14068d1d159a91d0699f2677dad91 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 12:39:54 -0700 Subject: [PATCH 37/88] Only populate attachments array element if there are attachments --- lib/twitterapi.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 66664334c8..ab6c0d62c8 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -188,15 +188,18 @@ class TwitterapiAction extends Action # Enclosures $attachments = $notice->attachments(); - $twitter_status['attachments']=array(); - if($attachments){ - foreach($attachments as $attachment){ + + if (!empty($attachments)) { + + $twitter_status['attachments'] = array(); + + foreach ($attachments as $attachment) { if ($attachment->isEnclosure()) { - $enclosure=array(); - $enclosure['url']=$attachment->url; - $enclosure['mimetype']=$attachment->mimetype; - $enclosure['size']=$attachment->size; - $twitter_status['attachments'][]=$enclosure; + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $twitter_status['attachments'][] = $enclosure; } } } From f0d17afc7b69308b27dc48a43ed08947885d8225 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 17:11:26 -0400 Subject: [PATCH 38/88] Moved oembed endpointer so openid no longer incorrectly prompts for authentication --- lib/router.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/router.php b/lib/router.php index bf3895bf01..5e0fcfc946 100644 --- a/lib/router.php +++ b/lib/router.php @@ -113,11 +113,6 @@ class Router $m->connect('main/tagother/:id', array('action' => 'tagother')); - $m->connect('main/:method', - array('action' => 'api', - 'method' => 'oembed(.xml|.json)?', - 'apiaction' => 'oembed')); - // these take a code foreach (array('register', 'confirmaddress', 'recoverpassword') as $c) { @@ -134,6 +129,11 @@ class Router $m->connect('index.php?action=' . $action, array('action' => $action)); } + $m->connect('main/:method', + array('action' => 'api', + 'method' => 'oembed(.xml|.json)?', + 'apiaction' => 'oembed')); + // settings foreach (array('profile', 'avatar', 'password', 'openid', 'im', From 44f3f2bd2af07b6fb5eb8f2516e137e89db7d4a4 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 14:22:11 -0700 Subject: [PATCH 39/88] Only create attachment elements if attachment is an enclosure --- lib/twitterapi.php | 53 +++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/lib/twitterapi.php b/lib/twitterapi.php index ab6c0d62c8..79da82a194 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -186,24 +186,24 @@ class TwitterapiAction extends Action $twitter_status['favorited'] = false; } - # Enclosures + // Enclosures $attachments = $notice->attachments(); + $enclosures = array(); - if (!empty($attachments)) { - - $twitter_status['attachments'] = array(); - - foreach ($attachments as $attachment) { - if ($attachment->isEnclosure()) { - $enclosure = array(); - $enclosure['url'] = $attachment->url; - $enclosure['mimetype'] = $attachment->mimetype; - $enclosure['size'] = $attachment->size; - $twitter_status['attachments'][] = $enclosure; - } + foreach ($attachments as $attachment) { + if ($attachment->isEnclosure()) { + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $enclosures[] = $enclosure; } } + if (!empty($enclosures)) { + $twitter_status['attachments'] = $enclosures; + } + if ($include_user) { # Don't get notice (recursive!) $twitter_user = $this->twitter_user_array($profile, false); @@ -218,7 +218,7 @@ class TwitterapiAction extends Action $profile = $notice->getProfile(); $entry = array(); - # We trim() to avoid extraneous whitespace in the output + // We trim() to avoid extraneous whitespace in the output $entry['content'] = common_xml_safe_str(trim($notice->rendered)); $entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content)); @@ -231,7 +231,26 @@ class TwitterapiAction extends Action $entry['updated'] = $entry['published']; $entry['author'] = $profile->getBestName(); - # Enclosure + // Enclosures + $attachments = $notice->attachments(); + $enclosures = array(); + + foreach ($attachments as $attachment) { + if ($attachment->isEnclosure()) { + $enclosure = array(); + $enclosure['url'] = $attachment->url; + $enclosure['mimetype'] = $attachment->mimetype; + $enclosure['size'] = $attachment->size; + $enclosures[] = $enclosure; + } + } + + if (!empty($enclosures)) { + $entry['enclosures'] = $enclosures; + } + +/* + // Enclosure $attachments = $notice->attachments(); if($attachments){ $entry['enclosures']=array(); @@ -245,8 +264,8 @@ class TwitterapiAction extends Action } } } - - # RSS Item specific +*/ + // RSS Item specific $entry['description'] = $entry['content']; $entry['pubDate'] = common_date_rfc2822($notice->created); $entry['guid'] = $entry['link']; From 8894f957cdd7dc790d9413cfbef28cc4dc1655db Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 17:54:37 -0400 Subject: [PATCH 40/88] Require PHP 5.2.3 or later. http://laconi.ca/trac/ticket/1605 --- README | 2 +- install.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 0214e49315..b65a08d425 100644 --- a/README +++ b/README @@ -134,7 +134,7 @@ Prerequisites The following software packages are *required* for this software to run correctly. -- PHP 5.2.x. It may be possible to run this software on earlier +- PHP 5.2.3+. It may be possible to run this software on earlier versions of PHP, but many of the functions used are only available in PHP 5.2 or above. - MySQL 5.x. The Laconica database is stored, by default, in a MySQL diff --git a/install.php b/install.php index 570b08edf4..8f500259ef 100644 --- a/install.php +++ b/install.php @@ -43,8 +43,8 @@ function checkPrereqs() $pass = false; } - if (version_compare(PHP_VERSION, '5.0.0', '<')) { - ?>

    Require PHP version 5 or greater.

    Require PHP version 5.2.3 or greater.

    Date: Fri, 17 Jul 2009 18:07:53 -0700 Subject: [PATCH 41/88] Moved $_id from queuehandler to daemon, as other daemons need it too. --- lib/daemon.php | 11 +++++++++++ lib/queuehandler.php | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/daemon.php b/lib/daemon.php index 9d89c63e78..231f5414e9 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -24,6 +24,7 @@ if (!defined('LACONICA')) { class Daemon { var $daemonize = true; + var $_id = 'generic'; function __construct($daemonize = true) { @@ -35,6 +36,16 @@ class Daemon return null; } + function get_id() + { + return $this->_id; + } + + function set_id($id) + { + $this->_id = $id; + } + function background() { $pid = pcntl_fork(); diff --git a/lib/queuehandler.php b/lib/queuehandler.php index c2ff10f32f..f11e5bd90d 100644 --- a/lib/queuehandler.php +++ b/lib/queuehandler.php @@ -29,7 +29,6 @@ define('QUEUE_HANDLER_HIT_IDLE', 0); class QueueHandler extends Daemon { - var $_id = 'generic'; function __construct($id=null, $daemonize=true) { @@ -55,16 +54,6 @@ class QueueHandler extends Daemon return strtolower($this->class_name().'.'.$this->get_id()); } - function get_id() - { - return $this->_id; - } - - function set_id($id) - { - $this->_id = $id; - } - function transport() { return null; From 5d5401b371a7e88140219216f3daa9f9c6fecaaf Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 18:09:03 -0700 Subject: [PATCH 42/88] Fix setting id. --- scripts/twitterstatusfetcher.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 8b10bfbadd..248cf86f10 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -32,7 +32,7 @@ $helptext = <<set_id($id); + } + } + /** * Name of this daemon * @@ -640,6 +649,8 @@ if (have_option('i')) { $id = null; } +common_debug("id set to $id"); + $fetcher = new TwitterStatusFetcher($id); $fetcher->runOnce(); From 9e8bcff5ddfc7d3e5785161078c5b1eaafea2f1e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 17 Jul 2009 18:36:13 -0700 Subject: [PATCH 43/88] Allow -d (debug logging) command line argument --- scripts/twitterstatusfetcher.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 248cf86f10..e2ba1d0031 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -25,19 +25,18 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('MAXCHILDREN', 2); define('POLL_INTERVAL', 60); // in seconds -$shortoptions = 'i::'; -$longoptions = array('id::'); +$shortoptions = 'di::'; +$longoptions = array('id::', 'debug'); $helptext = <<name() . + ': debugging log output enabled.'); + } + do { $flinks = $this->refreshFlinks(); @@ -649,7 +653,9 @@ if (have_option('i')) { $id = null; } -common_debug("id set to $id"); +if (have_option('d') || have_option('debug')) { + define('SCRIPT_DEBUG', true); +} $fetcher = new TwitterStatusFetcher($id); $fetcher->runOnce(); From f1fc392e2d15479730385463a68b74eacb5cbbd0 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 22:55:59 -0400 Subject: [PATCH 44/88] Fix OpenId cancelled / error message Thanks jeff-themovie --- actions/finishopenidlogin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/finishopenidlogin.php b/actions/finishopenidlogin.php index e9f7c746bb..ff0b35218f 100644 --- a/actions/finishopenidlogin.php +++ b/actions/finishopenidlogin.php @@ -83,7 +83,7 @@ class FinishopenidloginAction extends Action function showContent() { if (!empty($this->message_text)) { - $this->element('p', null, $this->message); + $this->element('div', array('class' => 'error'), $this->message_text); return; } From 7237d59aabe9ce9edf372bf6fe6850fbe83bf699 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 22:59:58 -0400 Subject: [PATCH 45/88] Fix RDFS namespace declaration. Thanks tobyink --- lib/rssaction.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rssaction.php b/lib/rssaction.php index ffa1f9e99f..7686d06460 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -320,6 +320,8 @@ class Rss10Action extends Action 'http://rdfs.org/sioc/ns#', 'xmlns:sioct' => 'http://rdfs.org/sioc/types#', + 'xmlns:rdfs' => + 'http://www.w3.org/2000/01/rdf-schema#', 'xmlns:laconica' => 'http://laconi.ca/ont/', 'xmlns' => 'http://purl.org/rss/1.0/')); From 441c276859ff5d969d9b3a09b550f682b41088ac Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 23:06:14 -0400 Subject: [PATCH 46/88] Add link to conversation pages when possible. Thanks tobyink --- lib/rssaction.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rssaction.php b/lib/rssaction.php index 7686d06460..76d0db224f 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -234,6 +234,11 @@ class Rss10Action extends Action $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); $this->element('sioc:reply_of', array('rdf:resource' => $replyurl)); } + if (!empty($notice->conversation)) { + $conversationurl = common_local_url('conversation', + array('id' => $notice->conversation)); + $this->element('sioc:has_discussion', array('rdf:resource' => $conversationurl)); + } $attachments = $notice->attachments(); if($attachments){ foreach($attachments as $attachment){ From 8e7a8450d3e51533d6057b3110e4372cd13153fe Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 23:08:19 -0400 Subject: [PATCH 47/88] Make RSS 1.0 more efficient when the same hashtag is used in multiple notices. Thanks tobyink --- lib/rssaction.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/rssaction.php b/lib/rssaction.php index 76d0db224f..9015589439 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -39,6 +39,7 @@ class Rss10Action extends Action var $creators = array(); var $limit = DEFAULT_RSS_LIMIT; var $notices = null; + var $tags_already_output = array(); /** * Constructor @@ -273,6 +274,12 @@ class Rss10Action extends Action foreach ($tags as $tag) { $tagpage = common_local_url('tag', array('tag' => $tag)); + + if ( in_array($tag, $this->tags_already_output) ) { + $this->element('ctag:tagged', array('rdf:resource'=>$tagpage.'#concept')); + continue; + } + $tagrss = common_local_url('tagrss', array('tag' => $tag)); $this->elementStart('ctag:tagged'); $this->elementStart('ctag:Tag', array('rdf:about'=>$tagpage.'#concept', 'ctag:label'=>$tag)); @@ -280,6 +287,8 @@ class Rss10Action extends Action $this->element('rdfs:seeAlso', array('rdf:resource'=>$tagrss)); $this->elementEnd('ctag:Tag'); $this->elementEnd('ctag:tagged'); + + $this->tags_already_output[] = $tag; } } $this->elementEnd('item'); From c74943e5985c7a096db3c1fc8f34a6e97c8c1efa Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 17 Jul 2009 23:16:29 -0400 Subject: [PATCH 48/88] I can't believe I forgot to commit this as part of 9ed117d... wow. Epic fail. Epic. --- actions/twitapioembed.php | 173 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 actions/twitapioembed.php diff --git a/actions/twitapioembed.php b/actions/twitapioembed.php new file mode 100644 index 0000000000..3019e5878d --- /dev/null +++ b/actions/twitapioembed.php @@ -0,0 +1,173 @@ +. + * + * @category Twitter + * @package Laconica + * @author Evan Prodromou + * @copyright 2008 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/twitterapi.php'; + +/** + * Oembed provider implementation + * + * This class handles all /main/oembed(.xml|.json)/ requests. + * + * @category oEmbed + * @package Laconica + * @author Craig Andrews + * @copyright 2008 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/ + */ + +class TwitapioembedAction extends TwitterapiAction +{ + + function oembed($args, $apidata) + { + parent::handle($args); + + common_debug("in oembed api action"); + + $this->auth_user = $apidata['user']; + + $url = $args['url']; + if( substr(strtolower($url),0,strlen(common_root_url())) == strtolower(common_root_url()) ){ + $path = substr($url,strlen(common_root_url())); + + $r = Router::get(); + + $proxy_args = $r->map($path); + + if (!$proxy_args) { + $this->serverError(_("$path not found"), 404); + } + $oembed=array(); + $oembed['version']='1.0'; + $oembed['provider_name']=common_config('site', 'name'); + $oembed['provider_url']=common_root_url(); + switch($proxy_args['action']){ + case 'shownotice': + $oembed['type']='link'; + $id = $proxy_args['notice']; + $notice = Notice::staticGet($id); + if(empty($notice)){ + $this->serverError(_("notice $id not found"), 404); + } + $profile = $notice->getProfile(); + if (empty($profile)) { + $this->serverError(_('Notice has no profile'), 500); + } + if (!empty($profile->fullname)) { + $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; + } else { + $authorname = $profile->nickname; + } + $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), + $authorname, + common_exact_date($notice->created)); + $oembed['author_name']=$authorname; + $oembed['author_url']=$profile->profileurl; + $oembed['url']=($notice->url?$notice->url:$notice->uri); + $oembed['html']=$notice->rendered; + break; + case 'attachment': + $id = $proxy_args['attachment']; + $attachment = File::staticGet($id); + if(empty($attachment)){ + $this->serverError(_("attachment $id not found"), 404); + } + if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ + // Proxy the existing oembed information + $oembed['type']=$file_oembed->type; + $oembed['provider']=$file_oembed->provider; + $oembed['provider_url']=$file_oembed->provider_url; + $oembed['width']=$file_oembed->width; + $oembed['height']=$file_oembed->height; + $oembed['html']=$file_oembed->html; + $oembed['title']=$file_oembed->title; + $oembed['author_name']=$file_oembed->author_name; + $oembed['author_url']=$file_oembed->author_url; + $oembed['url']=$file_oembed->url; + }else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){ + $oembed['type']='photo'; + //TODO set width and height + //$oembed['width']= + //$oembed['height']= + $oembed['url']=$attachment->url; + }else{ + $oembed['type']='link'; + $oembed['url']=common_local_url('attachment', + array('attachment' => $attachment->id)); + } + if($attachment->title) $oembed['title']=$attachment->title; + break; + default: + $this->serverError(_("$path not supported for oembed requests"), 501); + } + + switch($apidata['content-type']){ + case 'xml': + $this->init_document('xml'); + $this->elementStart('oembed'); + $this->element('version',null,$oembed['version']); + $this->element('type',null,$oembed['type']); + if($oembed['provider_name']) $this->element('provider_name',null,$oembed['provider_name']); + if($oembed['provider_url']) $this->element('provider_url',null,$oembed['provider_url']); + if($oembed['title']) $this->element('title',null,$oembed['title']); + if($oembed['author_name']) $this->element('author_name',null,$oembed['author_name']); + if($oembed['author_url']) $this->element('author_url',null,$oembed['author_url']); + if($oembed['url']) $this->element('url',null,$oembed['url']); + if($oembed['html']) $this->element('html',null,$oembed['html']); + if($oembed['width']) $this->element('width',null,$oembed['width']); + if($oembed['height']) $this->element('height',null,$oembed['height']); + if($oembed['cache_age']) $this->element('cache_age',null,$oembed['cache_age']); + if($oembed['thumbnail_url']) $this->element('thumbnail_url',null,$oembed['thumbnail_url']); + if($oembed['thumbnail_width']) $this->element('thumbnail_width',null,$oembed['thumbnail_width']); + if($oembed['thumbnail_height']) $this->element('thumbnail_height',null,$oembed['thumbnail_height']); + + + $this->elementEnd('oembed'); + $this->end_document('xml'); + break; + case 'json': + $this->init_document('json'); + print(json_encode($oembed)); + $this->end_document('json'); + break; + default: + $this->serverError(_('content type ' . $apidata['content-type'] . ' not supported'), 501); + } + + }else{ + $this->serverError(_('Only ' . common_root_url() . ' urls over plain http please'), 404); + } + } +} + From 711ade9835f3523dcf83702834adef313f9cf54d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:01:51 +1200 Subject: [PATCH 49/88] look for full unicode when saving tags --- classes/Notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 101fadb674..12b47f3604 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -97,11 +97,11 @@ class Notice extends Memcached_DataObject function saveTags() { /* extract all #hastags */ - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match); + $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match); if (!$count) { return true; } - + /* Add them to the database */ foreach(array_unique($match[1]) as $hashtag) { /* elide characters we don't want in the tag */ From 590982612206acaa902d7bc87429ec4296bfa17f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:02:26 +1200 Subject: [PATCH 50/88] show full utf8 in tags --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 9e8ec41d25..edc396cc02 100644 --- a/lib/util.php +++ b/lib/util.php @@ -404,7 +404,7 @@ function common_render_text($text) $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r); $r = common_replace_urls_callback($r, 'common_linkify'); - $r = preg_replace('/(^|\(|\[|\s+)#([A-Za-z0-9_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); + $r = preg_replace('/(^|\(|\[|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); // XXX: machine tags return $r; } From 76dd061a34782010d5650d5513bd4d4873e0045c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:02:52 +1200 Subject: [PATCH 51/88] allow full unicode into links for tags --- lib/router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/router.php b/lib/router.php index 5e0fcfc946..8e48364979 100644 --- a/lib/router.php +++ b/lib/router.php @@ -211,7 +211,7 @@ class Router array('tag' => '[a-zA-Z0-9]+')); $m->connect('tag/:tag', array('action' => 'tag'), - array('tag' => '[a-zA-Z0-9]+')); + array('tag' => '[\pL\pN_\-\.]{1,64}')); $m->connect('peopletag/:tag', array('action' => 'peopletag'), From d95f45f0705467cfc7e3650db932e43f0a20e45f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:18:48 +1200 Subject: [PATCH 52/88] turn into canonical terms before checking for unique-ness of a tag in a notice --- classes/Notice.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 12b47f3604..7f002d838c 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -101,9 +101,17 @@ class Notice extends Memcached_DataObject if (!$count) { return true; } + + //turn each into their canonical tag + //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag + $hashtags = array(); + for($i=0; $isaveTag($hashtag); } @@ -112,8 +120,6 @@ class Notice extends Memcached_DataObject function saveTag($hashtag) { - $hashtag = common_canonical_tag($hashtag); - $tag = new Notice_tag(); $tag->notice_id = $this->id; $tag->tag = $hashtag; From e3ac43541a167668433947e10b44cea7115ff69e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 04:02:43 +0000 Subject: [PATCH 53/88] Updated pigeonthoughts theme --- theme/pigeonthoughts/css/base.css | 35 +++++++++++++++++++++++----- theme/pigeonthoughts/css/display.css | 3 ++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css index 9866e2d2cc..4921a9287c 100644 --- a/theme/pigeonthoughts/css/base.css +++ b/theme/pigeonthoughts/css/base.css @@ -993,13 +993,36 @@ font-weight:bold; padding:0; } #jOverlayContent h1 { -max-width:475px; +max-width:425px; } #jOverlayContent #content { border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; } +#jOverlayLoading { +top:5%; +left:40%; +} +#attachment_view img { +max-width:480px; +max-height:480px; +} +#attachment_view #oembed_info { +margin-top:11px; +} +#attachment_view #oembed_info dt, +#attachment_view #oembed_info dd { +float:left; +} +#attachment_view #oembed_info dt { +clear:left; +margin-right:11px; +font-weight:bold; +} +#attachment_view #oembed_info dt:after { +content: ":"; +} #usergroups #new_group { float: left; @@ -1058,8 +1081,6 @@ top:3px; left:3px; } - - .pagination { float:left; clear:both; @@ -1105,7 +1126,6 @@ padding-right:30px; } /* END: NOTICE */ - .hentry .entry-content p { margin-bottom:18px; } @@ -1122,7 +1142,6 @@ margin-bottom:18px; margin-left:18px; } - /* TOP_POSTERS */ .section tbody td { padding-right:11px; @@ -1150,7 +1169,6 @@ margin-right:0; display:none; } - /* tagcloud */ .tag-cloud { list-style-type:none; @@ -1233,6 +1251,11 @@ clear:both; margin-bottom:0; } +#form_settings_design #settings_design_background-image img { +max-width:480px; +max-height:480px; +} + #form_settings_design #settings_design_color .form_data, #form_settings_design #color-picker { float:left; diff --git a/theme/pigeonthoughts/css/display.css b/theme/pigeonthoughts/css/display.css index 01af500bfc..f113225fbf 100644 --- a/theme/pigeonthoughts/css/display.css +++ b/theme/pigeonthoughts/css/display.css @@ -14,7 +14,8 @@ background:url(../images/illustrations/illu_pigeons-01.png) no-repeat 0 100%; } body, -a:active { +a:active, +#content { background-color:#AEA187; } body { From 31307e6cdd21bbd7bb2290aeb64e7180fef87159 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 14:56:01 +0000 Subject: [PATCH 54/88] Updated pigeonthoughts content/aside_primary layout values --- theme/pigeonthoughts/css/base.css | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css index 4921a9287c..5d5eb9896c 100644 --- a/theme/pigeonthoughts/css/base.css +++ b/theme/pigeonthoughts/css/base.css @@ -383,7 +383,7 @@ margin-bottom:1em; } #content { -width:49.009%; +width:50%; min-height:259px; float:left; padding:0 18px; @@ -402,7 +402,7 @@ float:left; width:45.917%; min-height:259px; float:left; -margin-left:1.385%; +margin-left:0.25%; padding-bottom:47px; } @@ -736,11 +736,10 @@ margin-right:11px; .notice, .profile { position:relative; -padding-top:11px; -padding-bottom:11px; +padding:11px 2%; clear:both; float:left; -width:96.41%; +width:95.7%; border-width:1px; border-style:solid; margin-bottom:11px; From 6313cf5bfe00c2810f1cdc0ac558643543e5f02f Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 20 Jul 2009 14:02:42 -0400 Subject: [PATCH 55/88] Better handle multipart emails (especially those with multipart/alternative contents) --- scripts/maildaemon.php | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php index 11ddf06b75..3f5402becb 100755 --- a/scripts/maildaemon.php +++ b/scripts/maildaemon.php @@ -299,25 +299,37 @@ class MailerDaemon $attachments = array(); + $this->extract_part($parsed,$msg,$attachments); + + return array($from, $to, $msg, $attachments); + } + + function extract_part($parsed,&$msg,&$attachments){ if ($parsed->ctype_primary == 'multipart') { - foreach ($parsed->parts as $part) { - if ($part->ctype_primary == 'text' && - $part->ctype_secondary == 'plain') { - $msg = $part->body; - }else{ - if ($part->body) { - $attachment = tmpfile(); - fwrite($attachment, $part->body); - $attachments[] = $attachment; - } + if($parsed->ctype_secondary == 'alternative'){ + $altmsg = $this->extract_msg_from_multipart_alternative_part($parsed); + if(!empty($altmsg)) $msg = $altmsg; + }else{ + foreach($parsed->parts as $part){ + $this->extract_part($part,$msg,$attachments); } } - } else if ($type == 'text/plain') { + } else if ($parsed->ctype_primary == 'text' + && $parsed->ctype_secondary=='plain') { $msg = $parsed->body; - } else { - $this->unsupported_type($type); + }else if(!empty($parsed->body)){ + $attachment = tmpfile(); + fwrite($attachment, $parsed->body); + $attachments[] = $attachment; } - return array($from, $to, $msg, $attachments); + } + + function extract_msg_from_multipart_alternative_part($parsed){ + foreach ($parsed->parts as $part) { + $this->extract_part($part,$msg,$attachments); + } + //we don't want any attachments that are a result of this parsing + return $msg; } function unsupported_type($type) From b46961558ac3710fcaeeb13e288316e9d091fd49 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 23:11:23 +0000 Subject: [PATCH 56/88] Reduced content width slightly for IE6 --- theme/base/css/ie6.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/base/css/ie6.css b/theme/base/css/ie6.css index dde4d6fc77..eca240faae 100644 --- a/theme/base/css/ie6.css +++ b/theme/base/css/ie6.css @@ -12,7 +12,7 @@ margin:0 auto; } #content { -width:70%; +width:69%; } #aside_primary { padding:5%; From fbb0df9f5436e956c43ace372f625f08628c000f Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 10:12:37 -0400 Subject: [PATCH 57/88] Disable email attachment posting when $config['attachments']['uploads'] = false http://laconi.ca/trac/ticket/1721 --- scripts/maildaemon.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php index 3f5402becb..a4003b6b26 100755 --- a/scripts/maildaemon.php +++ b/scripts/maildaemon.php @@ -318,9 +318,12 @@ class MailerDaemon && $parsed->ctype_secondary=='plain') { $msg = $parsed->body; }else if(!empty($parsed->body)){ - $attachment = tmpfile(); - fwrite($attachment, $parsed->body); - $attachments[] = $attachment; + if(common_config('attachments', 'uploads')){ + //only save attachments if uploads are enabled + $attachment = tmpfile(); + fwrite($attachment, $parsed->body); + $attachments[] = $attachment; + } } } From a9613e999f0c55830269daaf0f76fddc6b26d329 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 13:52:59 -0400 Subject: [PATCH 58/88] Detect xmpp uri's and make them into hyperlinks http://laconi.ca/trac/ticket/1592 --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 9e8ec41d25..f23f10e2c0 100644 --- a/lib/util.php +++ b/lib/util.php @@ -414,9 +414,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) { $regex = '#'. '(?:'. '(?:'. - '(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://'. + '(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|irc)://'. '|'. - '(?:mailto|aim|tel):'. + '(?:mailto|aim|tel|xmpp):'. ')'. '[^.\s]+\.[^\s]+'. '|'. From 22466530eff42fa6b1e1ea2380227ad5f4b22923 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 13:59:34 -0400 Subject: [PATCH 59/88] Fixed: The installer checks if the avatar and background directories are writable, but fails to check the file directory used for attachments. Thanks brion http://laconi.ca/trac/ticket/1703 --- README | 11 +++++++---- install.php | 21 ++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README b/README index b65a08d425..0bf1319c6d 100644 --- a/README +++ b/README @@ -262,13 +262,16 @@ especially if you've previously installed PHP/MySQL packages. that user's default group instead. As a last resort, you can create a new group like "mublog" and add the Web server's user to the group. -4. You should also take this moment to make your avatar subdirectory - writeable by the Web server. An insecure way to do this is: +4. You should also take this moment to make your avatar, background, and + file subdirectories writeable by the Web server. An insecure way to do + this is: chmod a+w /var/www/mublog/avatar + chmod a+w /var/www/mublog/background + chmod a+w /var/www/mublog/file - You can also make the avatar directory writeable by the Web server - group, as noted above. + You can also make the avatar, background, and file directories + writeable by the Web server group, as noted above. 5. Create a database to hold your microblog data. Something like this should work: diff --git a/install.php b/install.php index bae296a350..1d3a531c5a 100644 --- a/install.php +++ b/install.php @@ -70,17 +70,16 @@ function checkPrereqs() $pass = false; } - if (!is_writable(INSTALLDIR.'/avatar/')) { - ?>

    Cannot write avatar directory: /avatar/

    -

    On your server, try this command: chmod a+w /avatar/

    -

    Cannot write background directory: /background/

    -

    On your server, try this command: chmod a+w /background/

    -

    Cannot write directory:

    +

    On your server, try this command: chmod a+w

    + Date: Tue, 21 Jul 2009 14:03:08 -0400 Subject: [PATCH 60/88] Fixed: If the site name contains "." or "@" (and perhaps others), then notification emails (such as the email confirmation email) fail with the error "LOG_ERR: PEAR error: Validation failed for: SITE_NAME :" Thanks jk3us http://laconi.ca/trac/ticket/1356 --- lib/mail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mail.php b/lib/mail.php index 90ee3c9928..262f788ee5 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -121,7 +121,7 @@ function mail_notify_from() $domain = mail_domain(); - $notifyfrom = common_config('site', 'name') .' '; + $notifyfrom = '"'.common_config('site', 'name') .'" '; } return $notifyfrom; From 84fb84693994ba05a642d105a57227df7b412466 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 21 Jul 2009 11:31:34 -0700 Subject: [PATCH 61/88] correctly gc sessions --- classes/Session.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/classes/Session.php b/classes/Session.php index 93fd99baa8..ac80279c5e 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -106,14 +106,11 @@ class Session extends Memcached_DataObject { self::logdeb("garbage collection (maxlifetime = $maxlifetime)"); - $epoch = time() - $maxlifetime; - - $qry = 'DELETE FROM session ' . - 'WHERE modified < "'.$epoch.'"'; + $epoch = common_sql_date(time() - $maxlifetime); $session = new Session(); - - $result = $session->query($qry); + $session->whereAdd('modified < "'.$epoch.'"'); + $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY); self::logdeb("garbage collection result = $result"); } From eb5679b0297738649b982dfb66af5021bb03be19 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 21 Jul 2009 11:31:34 -0700 Subject: [PATCH 62/88] correctly gc sessions --- classes/Session.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/classes/Session.php b/classes/Session.php index 93fd99baa8..ac80279c5e 100644 --- a/classes/Session.php +++ b/classes/Session.php @@ -106,14 +106,11 @@ class Session extends Memcached_DataObject { self::logdeb("garbage collection (maxlifetime = $maxlifetime)"); - $epoch = time() - $maxlifetime; - - $qry = 'DELETE FROM session ' . - 'WHERE modified < "'.$epoch.'"'; + $epoch = common_sql_date(time() - $maxlifetime); $session = new Session(); - - $result = $session->query($qry); + $session->whereAdd('modified < "'.$epoch.'"'); + $result = $session->delete(DB_DATAOBJECT_WHEREADD_ONLY); self::logdeb("garbage collection result = $result"); } From 4d17c8553c80a36978a225f2bbe829cabeefc693 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 14:45:48 -0400 Subject: [PATCH 63/88] Add Cellular South to list of SMS Carriers Thanks jacroe http://laconi.ca/trac/ticket/1520 --- db/sms_carrier.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/sms_carrier.sql b/db/sms_carrier.sql index 6879f20890..055606f582 100644 --- a/db/sms_carrier.sql +++ b/db/sms_carrier.sql @@ -60,4 +60,5 @@ VALUES (100112, 'Cincinnati Bell Wireless', '%s@gocbw.com', now()), (100113, 'T-Mobile Germany', '%s@t-mobile-sms.de', now()), (100114, 'Vodafone Germany', '%s@vodafone-sms.de', now()), - (100115, 'E-Plus', '%s@smsmail.eplus.de', now()); + (100115, 'E-Plus', '%s@smsmail.eplus.de', now()), + (100116, 'Cellular South', '%s@csouth1.com', now()); From 52d51fad3c4716a1978553921ececee571cf9971 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 15:10:00 -0400 Subject: [PATCH 64/88] Fixed: Browser language preference's not used when using Google Chrome Thanks bambeeq http://laconi.ca/trac/ticket/620 --- lib/language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/language.php b/lib/language.php index 3ea3dd2aa0..9ad2d31bd4 100644 --- a/lib/language.php +++ b/lib/language.php @@ -53,7 +53,7 @@ function client_prefered_language($httplang) if (!empty($httplang[2][$i])) { // if no q default to 1.0 $client_langs[$httplang[2][$i]] = - ($httplang[6][$i]? (float) $httplang[6][$i] : 1.0); + ($httplang[6][$i]? (float) $httplang[6][$i] : 1.0 - ($i*0.01)); } if (!empty($httplang[3][$i]) && empty($client_langs[$httplang[3][$i]])) { // if a catchall default 0.01 lower From 3649b9ffbc40c3695344597330ad9c35b26a4976 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 15:17:54 -0400 Subject: [PATCH 65/88] Set the global $_cur current user so that preferences are loaded. Thanks singpolyma http://laconi.ca/trac/ticket/1573 --- scripts/xmppdaemon.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php index 488b4b514c..69512f2438 100755 --- a/scripts/xmppdaemon.php +++ b/scripts/xmppdaemon.php @@ -175,6 +175,10 @@ class XMPPDaemon extends Daemon $user = $this->get_user($from); + // For common_current_user to work + global $_cur; + $_cur = $user; + if (!$user) { $this->from_site($from, 'Unknown user; go to ' . common_local_url('imsettings') . @@ -211,6 +215,7 @@ class XMPPDaemon extends Daemon $user->free(); unset($user); + unset($_cur); unset($pl['xml']); $pl['xml'] = null; From de987a9e63f38a3752491032d7a21759f2cc7560 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 21 Jul 2009 12:50:32 -0700 Subject: [PATCH 66/88] update dbqueuemanager to respect handler timeout values --- lib/dbqueuemanager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index 6e7172de00..a37a8ffdf6 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -55,7 +55,8 @@ class DBQueueManager extends QueueManager { while (true) { $this->_log(LOG_DEBUG, 'Checking for notices...'); - $notice = $this->_nextItem($queue, null); + $timeout = $handler->timeout(); + $notice = $this->_nextItem($queue, $timeout); if (empty($notice)) { $this->_log(LOG_DEBUG, 'No notices waiting; idling.'); // Nothing in the queue. Do you From 6467351e32d2fa3a838556725fbdaccfa907969d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 21 Jul 2009 12:50:32 -0700 Subject: [PATCH 67/88] update dbqueuemanager to respect handler timeout values --- lib/dbqueuemanager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index 6e7172de00..a37a8ffdf6 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -55,7 +55,8 @@ class DBQueueManager extends QueueManager { while (true) { $this->_log(LOG_DEBUG, 'Checking for notices...'); - $notice = $this->_nextItem($queue, null); + $timeout = $handler->timeout(); + $notice = $this->_nextItem($queue, $timeout); if (empty($notice)) { $this->_log(LOG_DEBUG, 'No notices waiting; idling.'); // Nothing in the queue. Do you From 185d08282b5df141d38a88604b7d8cab00ce0cfd Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 22:13:50 +1200 Subject: [PATCH 68/88] Check if mod_rewrite is installed before trying to use it stops those apache 500 errors when it's not installed --- htaccess.sample | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htaccess.sample b/htaccess.sample index 634900dbf6..942e98334a 100644 --- a/htaccess.sample +++ b/htaccess.sample @@ -1,12 +1,14 @@ -RewriteEngine On + + RewriteEngine On -# NOTE: change this to your actual Laconica path; may be "/". + # NOTE: change this to your actual Laconica path; may be "/". -RewriteBase /mublog/ + RewriteBase /mublog/ -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule (.*) index.php?p=$1 [L,QSA] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule (.*) index.php?p=$1 [L,QSA] + Order allow,deny From 0adaaa1b9de61eaa8f7e4c622cda27fb634b53a5 Mon Sep 17 00:00:00 2001 From: Steve Winton Date: Thu, 11 Jun 2009 15:32:16 +0100 Subject: [PATCH 69/88] Added hidden input to showRecoverForm() so form can be submitted without error in IE by pressing --- actions/recoverpassword.php | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 actions/recoverpassword.php diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php old mode 100644 new mode 100755 index 2afd052a78..721edea7f4 --- a/actions/recoverpassword.php +++ b/actions/recoverpassword.php @@ -194,6 +194,9 @@ class RecoverpasswordAction extends Action 'or your registered email address.')); $this->elementEnd('li'); $this->elementEnd('ul'); + $this->element('input', array('name' => 'recover', + 'type' => 'hidden', + 'value' => _('Recover'))); $this->submit('recover', _('Recover')); $this->elementEnd('fieldset'); $this->elementEnd('form'); From 38d70f13865b197e17773ba24d67ea1148c32ab3 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 18:01:22 -0400 Subject: [PATCH 70/88] Add to RSS 2.0, use the same tag finding method for RSS 1.0 as for Atom and RSS 2.0. http://laconi.ca/trac/ticket/864 --- lib/rssaction.php | 36 ++++++++++-------------------------- lib/twitterapi.php | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/lib/rssaction.php b/lib/rssaction.php index 9015589439..9898894edd 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -193,24 +193,6 @@ class Rss10Action extends Action } } - // XXX: Surely there should be a common function to do this? - function extract_tags ($string) - { - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($string), $match); - if (!count) - { - return array(); - } - - $rv = array(); - foreach ($match[1] as $tag) - { - $rv[] = common_canonical_tag($tag); - } - - return array_unique($rv); - } - function showItem($notice) { $profile = Profile::staticGet($notice->profile_id); @@ -269,26 +251,28 @@ class Rss10Action extends Action $this->element('sioc:links_to', array('rdf:resource'=>$attachment->url)); } } - $tags = $this->extract_tags($notice->content); - if (!empty($tags)) { - foreach ($tags as $tag) - { - $tagpage = common_local_url('tag', array('tag' => $tag)); + + $tag = new Notice_tag(); + $tag->notice_id = $notice->id; + if ($tag->find()) { + $entry['tags']=array(); + while ($tag->fetch()) { + $tagpage = common_local_url('tag', array('tag' => $tag->tag)); if ( in_array($tag, $this->tags_already_output) ) { $this->element('ctag:tagged', array('rdf:resource'=>$tagpage.'#concept')); continue; } - $tagrss = common_local_url('tagrss', array('tag' => $tag)); + $tagrss = common_local_url('tagrss', array('tag' => $tag->tag)); $this->elementStart('ctag:tagged'); - $this->elementStart('ctag:Tag', array('rdf:about'=>$tagpage.'#concept', 'ctag:label'=>$tag)); + $this->elementStart('ctag:Tag', array('rdf:about'=>$tagpage.'#concept', 'ctag:label'=>$tag->tag)); $this->element('foaf:page', array('rdf:resource'=>$tagpage)); $this->element('rdfs:seeAlso', array('rdf:resource'=>$tagrss)); $this->elementEnd('ctag:Tag'); $this->elementEnd('ctag:tagged'); - $this->tags_already_output[] = $tag; + $this->tags_already_output[] = $tag->tag; } } $this->elementEnd('item'); diff --git a/lib/twitterapi.php b/lib/twitterapi.php index 79da82a194..b2602e77ca 100644 --- a/lib/twitterapi.php +++ b/lib/twitterapi.php @@ -265,6 +265,18 @@ class TwitterapiAction extends Action } } */ + + // Tags/Categories + $tag = new Notice_tag(); + $tag->notice_id = $notice->id; + if ($tag->find()) { + $entry['tags']=array(); + while ($tag->fetch()) { + $entry['tags'][]=$tag->tag; + } + } + $tag->free(); + // RSS Item specific $entry['description'] = $entry['content']; $entry['pubDate'] = common_date_rfc2822($notice->created); @@ -442,6 +454,12 @@ class TwitterapiAction extends Action $enclosure = $entry['enclosures'][0]; $this->element('enclosure', array('url'=>$enclosure['url'],'type'=>$enclosure['mimetype'],'length'=>$enclosure['size']), null); } + + if($entry['tags']){ + foreach($entry['tags'] as $tag){ + $this->element('category', null,$tag); + } + } $this->elementEnd('item'); } From 2aa47096b82fd224008d901584f09931c0432c2b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 13:45:38 +1200 Subject: [PATCH 71/88] missing AND in the SQL --- classes/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/File.php b/classes/File.php index 68d385d1ea..7ee8f6e084 100644 --- a/classes/File.php +++ b/classes/File.php @@ -136,7 +136,7 @@ class File extends Memcached_DataObject return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - $query .= ' month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND month(modified) = month(now()) and year(modified) = year(now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; From 36754f8323fbd200a97ccdc31e2c148104c7ba66 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 16:46:32 +1200 Subject: [PATCH 72/88] added missing columns in file table --- db/laconica_pg.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index f5d35f9858..71c99f24fe 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -441,7 +441,6 @@ create table group_inbox ( group_id integer not null /* comment 'group receiving the message' references user_group (id) */, notice_id integer not null /* comment 'notice received' references notice (id) */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date the notice was created' */, - primary key (group_id, notice_id) ); create index group_inbox_created_idx on group_inbox using btree(created); @@ -456,7 +455,9 @@ create table file ( size integer, title varchar(255), date integer, - protected integer + protected integer, + filename text /* comment 'if a local file, name of the file' */, + modified timestamp default CURRENT_TIMESTAMP /* comment 'date this record was modified'*/ ); create sequence file_oembed_seq; From 28b62f357d80d86e17f9688d65809cb959f4be6c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 17:05:44 +1200 Subject: [PATCH 73/88] fixed SQL in checking for monthly quota - works in postgres and mysql --- classes/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/File.php b/classes/File.php index 7ee8f6e084..0c4fbf7e69 100644 --- a/classes/File.php +++ b/classes/File.php @@ -122,6 +122,7 @@ class File extends Memcached_DataObject } function isRespectsQuota($user,$fileSize) { + if ($fileSize > common_config('attachments', 'file_quota')) { return sprintf(_('No file may be larger than %d bytes ' . 'and the file you sent was %d bytes. Try to upload a smaller version.'), @@ -135,8 +136,7 @@ class File extends Memcached_DataObject if ($total > common_config('attachments', 'user_quota')) { return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - - $query .= ' AND month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND EXTRACT(month FROM file.modified) = EXTRACT(month FROM now()) and EXTRACT(year FROM file.modified) = EXTRACT(year FROM now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; From 9ab07b4468048d20b2b826ef6595a862d5a21ffd Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 17:52:43 +1200 Subject: [PATCH 74/88] Fixed "User" table - added design_id and viewdesigns --- db/laconica_pg.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index f5d35f9858..55a103ee07 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -72,6 +72,8 @@ create table "user" ( autosubscribe integer default 0 /* comment 'automatically subscribe to users who subscribe to us' */, urlshorteningservice varchar(50) default 'ur1.ca' /* comment 'service to use for auto-shortening URLs' */, inboxed integer default 0 /* comment 'has an inbox been created for this user?' */, + design_id integer /* comment 'id of a design' */references design(id), + viewdesigns integer default 1 /* comment 'whether to view user-provided designs'*/, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date this record was created' */, modified timestamp /* comment 'date this record was modified' */ From be5f9ca0e1e4d3a2d1a06c39aa24874821b91cd1 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 22 Jul 2009 09:25:27 +0100 Subject: [PATCH 75/88] Stop daemons using 100% CPU and hammering the DB server when the queue is empty (DBQueueManager-based only) --- lib/dbqueuemanager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dbqueuemanager.php b/lib/dbqueuemanager.php index a37a8ffdf6..1df5af6c11 100644 --- a/lib/dbqueuemanager.php +++ b/lib/dbqueuemanager.php @@ -88,7 +88,9 @@ class DBQueueManager extends QueueManager do { $qi = Queue_item::top($queue); - if (!empty($qi)) { + if (empty($qi)) { + sleep(1); + } else { $notice = Notice::staticGet('id', $qi->notice_id); if (!empty($notice)) { $result = $notice; From c34875421ac97be26533bd494c048256136b8c1f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 16:46:32 +1200 Subject: [PATCH 76/88] added missing columns in file table --- db/laconica_pg.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 55a103ee07..172b64cf4b 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -443,7 +443,6 @@ create table group_inbox ( group_id integer not null /* comment 'group receiving the message' references user_group (id) */, notice_id integer not null /* comment 'notice received' references notice (id) */, created timestamp not null default CURRENT_TIMESTAMP /* comment 'date the notice was created' */, - primary key (group_id, notice_id) ); create index group_inbox_created_idx on group_inbox using btree(created); @@ -458,7 +457,9 @@ create table file ( size integer, title varchar(255), date integer, - protected integer + protected integer, + filename text /* comment 'if a local file, name of the file' */, + modified timestamp default CURRENT_TIMESTAMP /* comment 'date this record was modified'*/ ); create sequence file_oembed_seq; From 6eaa91db1c80afa0811c0f465a18250ee63b490a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 21:28:47 +1200 Subject: [PATCH 77/88] Fixes file_oembed to march mysql schema change that happened in commit 05e51228020fecaa894523b5159bc412d48e5b19 --- db/laconica_pg.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 172b64cf4b..f0a0aef4ac 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -464,8 +464,7 @@ create table file ( 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, + file_id bigint default nextval('file_oembed_seq') primary key /* comment 'unique identifier' */, version varchar(20), type varchar(20), provider varchar(50), From 91f3ddca55ae3ea32aeeb75c797e6c81bb9fd1a0 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 21:33:59 +1200 Subject: [PATCH 78/88] fixes file_redirection table to match mysql schema change in commit 05e51228020fecaa894523b5159bc412d48e5b19 --- db/laconica_pg.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index f0a0aef4ac..de4fab03e2 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -480,8 +480,7 @@ create table file_oembed ( 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, + url varchar(255) primary key, file_id bigint, redirections integer, httpcode integer From 57f53869e20a61cb8adfdbe5e607bb07c9ea685f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 21:39:53 +1200 Subject: [PATCH 79/88] more changes to file_id copied from mysql schema change in 05e51228020fecaa894523b5159bc412d48e5b19 --- db/laconica_pg.sql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index de4fab03e2..1059da3c99 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -488,8 +488,7 @@ create table file_redirection ( 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, + file_id bigint primary key, url varchar(255) unique, width integer, height integer @@ -497,11 +496,10 @@ create table file_thumbnail ( 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) + primary key (file_id, post_id) ); create table group_block ( From 47b2f1e08262341664ed782f5b9ecaa4e504b40c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 21:46:23 +1200 Subject: [PATCH 80/88] moved design table earlier - needs to be before "user" becuase of the foreign key --- db/laconica_pg.sql | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql index 1059da3c99..31210fd1e4 100644 --- a/db/laconica_pg.sql +++ b/db/laconica_pg.sql @@ -1,4 +1,3 @@ - /* local and remote users have profiles */ create sequence profile_seq; @@ -41,6 +40,19 @@ create table sms_carrier ( modified timestamp /* comment 'date this record was modified ' */ ); +create sequence design_seq; +create table design ( + id bigint default nextval('design_seq') /* comment 'design ID'*/, + backgroundcolor integer /* comment 'main background color'*/ , + contentcolor integer /*comment 'content area background color'*/ , + sidebarcolor integer /*comment 'sidebar background color'*/ , + textcolor integer /*comment 'text color'*/ , + linkcolor integer /*comment 'link color'*/, + backgroundimage varchar(255) /*comment 'background image, if any'*/, + disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/, + primary key (id) +); + /* local users */ create table "user" ( @@ -378,20 +390,6 @@ create table profile_block ( ); -create sequence design_seq; -create table design ( - id bigint default nextval('design_seq') /* comment 'design ID'*/, - backgroundcolor integer /* comment 'main background color'*/ , - contentcolor integer /*comment 'content area background color'*/ , - sidebarcolor integer /*comment 'sidebar background color'*/ , - textcolor integer /*comment 'text color'*/ , - linkcolor integer /*comment 'link color'*/, - backgroundimage varchar(255) /*comment 'background image, if any'*/, - disposition int default 1 /*comment 'bit 1 = hide background image, bit 2 = display background image, bit 4 = tile background image'*/, - primary key (id) -); - - create sequence user_group_seq; create table user_group ( From db4ffca5350a11835c2c990f8d77d7cabb365a43 Mon Sep 17 00:00:00 2001 From: CiaranG Date: Wed, 22 Jul 2009 11:21:49 +0100 Subject: [PATCH 81/88] Fix help text for getvaliddaemons.php --- scripts/getvaliddaemons.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/getvaliddaemons.php b/scripts/getvaliddaemons.php index 97c230784f..1e4546dff1 100755 --- a/scripts/getvaliddaemons.php +++ b/scripts/getvaliddaemons.php @@ -28,7 +28,8 @@ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $helptext = << Date: Wed, 22 Jul 2009 10:21:49 -0500 Subject: [PATCH 82/88] Changed file back to 0644. Blame: 0adaaa1b9de61eaa8f7e4c622cda27fb634b53a5 --- actions/recoverpassword.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 actions/recoverpassword.php diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php old mode 100755 new mode 100644 From 27e525dbbc126b4fce91c89f25153dfe2b771ee9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 23 Jul 2009 15:07:28 +1200 Subject: [PATCH 83/88] fixed up a limit offset to be ANSI SQL compliant --- classes/Profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Profile.php b/classes/Profile.php index 224b61bd2e..32de608cff 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -199,7 +199,7 @@ class Profile extends Memcached_DataObject $query .= ' order by id DESC'; if (!is_null($offset)) { - $query .= " limit $offset, $limit"; + $query .= " LIMIT $limit OFFSET $offset"; } $notice->query($query); From a33ffe1357c93b4bf1a717c3ed4883170431575d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 23 Jul 2009 21:46:20 +1200 Subject: [PATCH 84/88] Call $this->getNotices() always, becuase $this will be the right class. e.g. TagrssAction or PublicrssAction --- lib/rssaction.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/rssaction.php b/lib/rssaction.php index 9898894edd..23653e4062 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -98,11 +98,7 @@ class Rss10Action extends Action // Parent handling, including cache check parent::handle($args); // Get the list of notices - if (empty($this->tag)) { - $this->notices = $this->getNotices($this->limit); - } else { - $this->notices = $this->getTaggedNotices($this->tag, $this->limit); - } + $this->notices = $this->getNotices($this->limit); $this->showRss(); } From 90bc755821ce768104df059d4928f7e131a5eb74 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 23 Jul 2009 15:01:42 +0000 Subject: [PATCH 85/88] Updated cloudy theme --- theme/cloudy/css/display.css | 222 ++++++++++++++++++++++++++++++----- theme/cloudy/css/ie.css | 20 ++++ 2 files changed, 212 insertions(+), 30 deletions(-) diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index 12f186a560..af5836e198 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -12,12 +12,12 @@ img { display:block; border:0; } a abbr { cursor: pointer; border-bottom:0; } table { border-collapse:collapse; } ol { list-style-position:inside; } -html { font-size: 100%; background-color:#fff; } +html { font-size: 87.5%; } body { background-color:#fff; color:#000; font-family:sans-serif; -font-size:0.75em; +font-size:1em; line-height:normal; position:relative; height:100%; @@ -471,6 +471,24 @@ margin-bottom:7px; #form_notice #notice_submit label { display:none; } +#form_notice label[for=notice_data-attach], +#form_notice #notice_data-attach { +position:absolute; +top:85px; +cursor:pointer; +} +#form_notice label[for=notice_data-attach] { +text-indent:-9999px; +left:82%; +width:16px; +height:16px; +} +#form_notice #notice_data-attach { +left:34.6%; +padding:0; +height:16px; +} + #form_notice .form_note { position:absolute; top:-10px; @@ -488,6 +506,7 @@ font-weight:bold; line-height:1.15; padding:1px 2px; } + #form_notice #notice_action-submit { width:14%; height:35px; @@ -505,6 +524,26 @@ margin-bottom:7px; margin-left:18px; float:left; } +#form_notice .error, +#form_notice .success { +float:left; +clear:both; +width:81.5%; +margin-bottom:0; +line-height:1.618; +} +#form_notice #notice_data-attach_selected code { +float:left; +width:90%; +display:block; +font-size:1.1em; +line-height:1.8; +overflow:auto; +} +#form_notice #notice_data-attach_selected button { +float:right; +font-size:0.8em; +} /* entity_profile */ @@ -746,17 +785,18 @@ float:left; width:100%; border-top-width:1px; border-top-style:dotted; -font-size:1.2em; } .notices li { list-style-type:none; line-height:1.1; -width:94%; -padding-right:5%; -padding-left:1%; min-height:47px; } - +.notices .notices { +margin-top:7px; +margin-left:2%; +width:98%; +float:left; +} /* NOTICES */ #notices_primary { @@ -805,13 +845,17 @@ text-decoration:underline; .notice .entry-title { float:none; -display:inline; -width:100%; overflow:hidden; +display:inline; } #shownotice .notice .entry-title { font-size:2.2em; } +#conversation .notice .entry-title { +display:block; +width:90%; +} + .notice p.entry-content { display:inline; @@ -887,13 +931,12 @@ outline:none; .notice-options { padding-left:2%; float:left; -width:50%; font-size:0.95em; -width:12.5%; +width:16px; float:right; display:none; } -.notices li.hover div.notice-options { +.notices li:hover div.notice-options { display:block; } @@ -917,7 +960,7 @@ top:30px; right:7px; } .notice-options .notice_delete { -bottom:7px; +top:47px; right:7px; } .notice-options .notice_reply dt { @@ -958,6 +1001,97 @@ border:0; padding:0; } +.notice .attachment { +position:relative; +padding-left:16px; +} +#attachments .attachment { +padding-left:0; +} +.notice .attachment img { +position:absolute; +top:18px; +left:0; +z-index:99; +} +#shownotice .notice .attachment img { +position:static; +} + +#attachments { +clear:both; +float:left; +width:100%; +margin-top:18px; +} +#attachments dt { +font-weight:bold; +font-size:1.3em; +margin-bottom:4px; +} + +#attachments ol li { +margin-bottom:18px; +list-style-type:decimal; +float:left; +clear:both; +} + +#jOverlayContent, +#jOverlayContent #content, +#jOverlayContent #content_inner { +width: auto !important; +margin-bottom:0; +} +#jOverlayContent #content { +padding:11px; +min-height:auto; +} +#jOverlayContent .external span { +display:block; +margin-bottom:11px; +} +#jOverlayContent button { +position:absolute; +top:0; +right:0; +width:29px; +height:29px; +text-align:center; +font-weight:bold; +padding:0; +} +#jOverlayContent h1 { +max-width:425px; +} +#jOverlayContent #content { +border-radius:7px; +-moz-border-radius:7px; +-webkit-border-radius:7px; +} +#jOverlayLoading { +top:5%; +left:40%; +} +#attachment_view img { +max-width:480px; +max-height:480px; +} +#attachment_view #oembed_info { +margin-top:11px; +} +#attachment_view #oembed_info dt, +#attachment_view #oembed_info dd { +float:left; +} +#attachment_view #oembed_info dt { +clear:left; +margin-right:11px; +font-weight:bold; +} +#attachment_view #oembed_info dt:after { +content: ":"; +} #usergroups #new_group { float: left; @@ -1218,7 +1352,8 @@ clear:both; #outbox.user_in #content, #subscriptions.user_in #content, #subscribers.user_in #content, -#showgroup.user_in #content { +#showgroup.user_in #content, +#conversation.user_in #content { padding-top:160px; } @@ -1243,6 +1378,14 @@ padding-top:160px; display:none; } +#jOverlayContent #core #content { +padding-top:11px; +} +#jOverlayContent #core { +background:none; +padding-top:0; +} + html, body, @@ -1311,24 +1454,23 @@ border-top-color:#87B4C8; } -#content .notice p.entry-content a:visited { -background-color:#fcfcfc; -} -#content .notice p.entry-content .vcard a { -background-color:#fcfffc; -} - #aside_primary { background-color:#DDFFCC; } - #notice_text-count { -color:#333; +color:#000000; } #form_notice.warning #notice_text-count { -color:#000; +color:#000000; } +#form_notice label[for=notice_data-attach] { +background:transparent url(../../base/images/icons/twotone/green/clip-01.gif) no-repeat 0 45%; +} +#form_notice #notice_data-attach { +opacity:0; +} + #form_notice.processing #notice_action-submit { background:#fff url(../../base/images/icons/icon_processing.gif) no-repeat 47% 47%; cursor:wait; @@ -1426,8 +1568,11 @@ background-image:url(../images/icons/twotone/green/shield.gif); /* NOTICES */ -.notices li.over { -background-color:#fcfcfc; +.notice .attachment { +background:transparent url(../../base/images/icons/twotone/green/clip-02.gif) no-repeat 0 45%; +} +#attachments .attachment { +background:none; } .notice-options .notice_reply a, @@ -1451,10 +1596,24 @@ background:transparent url(../images/icons/icon_trash.gif) no-repeat 0 45%; .notices div.notice-options { opacity:0.4; } -.notices li.hover div.entry-content, -.notices li.hover div.notice-options { +.notices li:hover div.entry-content, +.notices li:hover div.notice-options { opacity:1; } +.notices .notices { +background-color:rgba(200, 200, 200, 0.01); +} +.notices .notices .notices { +background-color:rgba(200, 200, 200, 0.02); +} +.notices .notices .notices .notices { +background-color:rgba(200, 200, 200, 0.03); +} +.notices .notices .notices .notices .notices { +background-color:rgba(200, 200, 200, 0.04); +} + + div.entry-content { color:#333; } @@ -1462,8 +1621,11 @@ div.notice-options a, div.notice-options input { font-family:sans-serif; } -.notices li.hover { -background-color:#fcfcfc; +#content .notices li:hover { +background-color:rgba(240, 240, 240, 0.2); +} +#conversation .notices li:hover { +background-color:transparent; } /*END: NOTICES */ diff --git a/theme/cloudy/css/ie.css b/theme/cloudy/css/ie.css index 0951221009..94c2093b19 100644 --- a/theme/cloudy/css/ie.css +++ b/theme/cloudy/css/ie.css @@ -8,6 +8,16 @@ color:#fff; background-color:#ddffcc; } +#form_notice .form_note + label { +position:absolute; +top:25px; +left:83%; +text-indent:-9999px; +height:16px; +width:16px; +display:block; +} + #aside_primary { width:181px; } @@ -32,3 +42,13 @@ top:158px; #subscribers #content { padding-top:138px; } + +.notice { +z-index:1; +} +.notice:hover { +z-index:9999; +} +.notice .thumbnail img { +z-index:9999; +} From fa332c8c85a140f9f85b5c094c4266475742d27e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 23 Jul 2009 15:07:33 +0000 Subject: [PATCH 86/88] Minor top value for cloudy theme --- theme/cloudy/css/display.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index af5836e198..82a1a1e4e0 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -474,7 +474,7 @@ display:none; #form_notice label[for=notice_data-attach], #form_notice #notice_data-attach { position:absolute; -top:85px; +top:87px; cursor:pointer; } #form_notice label[for=notice_data-attach] { From 7fff454ff931635dc1aca6a67af194b25567a65b Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 23 Jul 2009 13:00:34 -0400 Subject: [PATCH 87/88] Revert "0.9.0 dev version" This reverts commit 7cfb2f569dbda8ef84149604cec88b2349d95306. This should have never been committed to the 0.8.x branch. --- lib/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common.php b/lib/common.php index 764c5a0770..9d7954fa98 100644 --- a/lib/common.php +++ b/lib/common.php @@ -19,7 +19,7 @@ if (!defined('LACONICA')) { exit(1); } -define('LACONICA_VERSION', '0.9.0dev'); +define('LACONICA_VERSION', '0.8.1dev'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); From 5f7fb994471e4326f6aea5e29157a6236de4001f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 23 Jul 2009 14:22:22 -0700 Subject: [PATCH 88/88] change NOTICE_GATEWAY to Notice::GATEWAY so autoloading works --- classes/Fave.php | 2 +- classes/Notice.php | 3 ++- classes/User.php | 2 +- scripts/twitterstatusfetcher.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/classes/Fave.php b/classes/Fave.php index c3ec62dcf0..d1e3b01b38 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -59,7 +59,7 @@ class Fave extends Memcached_DataObject $qry = 'SELECT fave.* FROM fave '; $qry .= 'INNER JOIN notice ON fave.notice_id = notice.id '; $qry .= 'WHERE fave.user_id = ' . $user_id . ' '; - $qry .= 'AND notice.is_local != ' . NOTICE_GATEWAY . ' '; + $qry .= 'AND notice.is_local != ' . Notice::GATEWAY . ' '; } if ($since_id != 0) { diff --git a/classes/Notice.php b/classes/Notice.php index 08125cf7b0..4b9a866b02 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -32,7 +32,6 @@ define('NOTICE_CACHE_WINDOW', 61); define('NOTICE_LOCAL_PUBLIC', 1); define('NOTICE_REMOTE_OMB', 0); define('NOTICE_LOCAL_NONPUBLIC', -1); -define('NOTICE_GATEWAY', -2); define('MAX_BOXCARS', 128); @@ -63,6 +62,8 @@ class Notice extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + const GATEWAY = -2; + function getProfile() { return Profile::staticGet('id', $this->profile_id); diff --git a/classes/User.php b/classes/User.php index 6c1f149e4d..bea47a3b05 100644 --- a/classes/User.php +++ b/classes/User.php @@ -443,7 +443,7 @@ class User extends Memcached_DataObject 'SELECT notice.* ' . 'FROM notice JOIN subscription ON notice.profile_id = subscription.subscribed ' . 'WHERE subscription.subscriber = %d ' . - 'AND notice.is_local != ' . NOTICE_GATEWAY; + 'AND notice.is_local != ' . Notice::GATEWAY; return Notice::getStream(sprintf($qry, $this->id), 'user:notices_with_friends:' . $this->id, $offset, $limit, $since_id, $before_id, diff --git a/scripts/twitterstatusfetcher.php b/scripts/twitterstatusfetcher.php index 8b10bfbadd..4a1ed89779 100755 --- a/scripts/twitterstatusfetcher.php +++ b/scripts/twitterstatusfetcher.php @@ -32,7 +32,7 @@ $helptext = <<rendered = common_render_content($notice->content, $notice); $notice->source = 'twitter'; $notice->reply_to = null; // XXX lookup reply - $notice->is_local = NOTICE_GATEWAY; + $notice->is_local = Notice::GATEWAY; if (Event::handle('StartNoticeSave', array(&$notice))) { $id = $notice->insert();