From 8f1b1ffcf04da08193da51544487afa6647ad225 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 24 Jun 2009 04:04:28 +1200 Subject: 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 570b08edf..4e54ba870 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:

-- cgit v1.2.3-54-g00ecf From 4d42bc7690da6cb87b4526c25e5447d06ba12212 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 24 Jun 2009 04:07:15 +1200 Subject: missing word (find) added --- install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.php b/install.php index 4e54ba870..103c367c3 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: 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 103c367c3..233a05550 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

  • -- cgit v1.2.3-54-g00ecf From 3fe182e86503a9e95183fe6d641e511a4d3eb0f1 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 17:37:01 +1200 Subject: 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 233a05550..61156e937 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', -- cgit v1.2.3-54-g00ecf From 343e2010ae276fa4ca5e56c40eb6f06cd01a6136 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 17:43:46 +1200 Subject: connect to pg working --- install.php | 97 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/install.php b/install.php index 61156e937..9f48c919d 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"; -- cgit v1.2.3-54-g00ecf From 4f9c3b50e7103498f06f7c9b0a232bcda5bf17b8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 23 Jun 2009 18:01:03 +1200 Subject: install.php works for postgres --- install.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index 9f48c919d..1b8b7655c 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; } } -- cgit v1.2.3-54-g00ecf From 6b710092061d885a358dc07c8153324e36677965 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 25 Jun 2009 21:59:33 +1200 Subject: 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 dae8b8faf..3683273a3 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); -- cgit v1.2.3-54-g00ecf From b5fa0ac1d1b6b3e4ecd0f39fe086702cf19eccdf Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 18:48:39 +1200 Subject: 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 3683273a3..dae8b8faf 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); -- cgit v1.2.3-54-g00ecf From f22ed5dc807392889a910d491b614c5d33efa8af Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:55:43 +1200 Subject: 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 dae8b8faf..92331181d 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); -- cgit v1.2.3-54-g00ecf From 186b5a1674ae345829b57c495f590140424e04ad Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 22:39:19 +1200 Subject: 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 92331181d..e70573bfb 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' */ -- cgit v1.2.3-54-g00ecf From fc3b11bff954c90b93a240d39e5aea3462d0158a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 13:36:15 +1200 Subject: 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 e70573bfb..78791adaa 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), -- cgit v1.2.3-54-g00ecf From 63ea2b7c451640910d4190c7c0d904af688a85d5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 20:25:52 +1200 Subject: 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 c3ec62dcf..4b28d06b4 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); -- cgit v1.2.3-54-g00ecf From 1b3c4f2c52e2f983470b8b4e0ffd911694ab2eb5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:49:44 +1200 Subject: 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 1b8b7655c..e73e20ab6 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; } -- cgit v1.2.3-54-g00ecf From d591e24eac5f37dbff7b17ac039c2e8bc0a33653 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 21:53:37 +1200 Subject: 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 e73e20ab6..096746d4a 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; } -- cgit v1.2.3-54-g00ecf From 1a151ff6f686da198aac72a0adb5001f5d6dcd43 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Fri, 26 Jun 2009 22:13:41 +1200 Subject: 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 e47c9b385..167a6ff8d 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')), -- cgit v1.2.3-54-g00ecf From 15042ed50b72804eaeefd0c60aa63674bdefe8b4 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:24:59 +1200 Subject: 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 963e21f15..ad4884bf8 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 325b4033f..dc7925d5e 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; -- cgit v1.2.3-54-g00ecf From 403bb38bcd191d7b4e9c62e7f5f4bbb3968729df Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:29:02 +1200 Subject: 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 08125cf7b..4e244c666 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(); -- cgit v1.2.3-54-g00ecf From 565dec0e213570b2cad3fa11ec42caf5b52ce1c8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:31:31 +1200 Subject: 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 27b444705..b1ab1c2d3 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)); -- cgit v1.2.3-54-g00ecf From 3722b90a27b2fd53d77c60d51c53cc3e548ffcf9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 27 Jun 2009 10:32:50 +1200 Subject: 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 9b7a10f6b..0e0cbdd63 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); -- cgit v1.2.3-54-g00ecf From 788dd66dbe75db5d09c0cd5b33bb3347233cbd15 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 15 Jul 2009 20:23:52 +1200 Subject: 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 4e244c666..8974e22f8 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)); -- cgit v1.2.3-54-g00ecf From e3ac43541a167668433947e10b44cea7115ff69e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 04:02:43 +0000 Subject: 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 9866e2d2c..4921a9287 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 01af500bf..f113225fb 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 { -- cgit v1.2.3-54-g00ecf From 31307e6cdd21bbd7bb2290aeb64e7180fef87159 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 14:56:01 +0000 Subject: 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 4921a9287..5d5eb9896 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; -- cgit v1.2.3-54-g00ecf From 6313cf5bfe00c2810f1cdc0ac558643543e5f02f Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 20 Jul 2009 14:02:42 -0400 Subject: 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 11ddf06b7..3f5402bec 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) -- cgit v1.2.3-54-g00ecf From b46961558ac3710fcaeeb13e288316e9d091fd49 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 20 Jul 2009 23:11:23 +0000 Subject: 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 dde4d6fc7..eca240faa 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%; -- cgit v1.2.3-54-g00ecf From fbb0df9f5436e956c43ace372f625f08628c000f Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 10:12:37 -0400 Subject: 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 3f5402bec..a4003b6b2 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; + } } } -- cgit v1.2.3-54-g00ecf From a9613e999f0c55830269daaf0f76fddc6b26d329 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 13:52:59 -0400 Subject: 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 9e8ec41d2..f23f10e2c 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]+'. '|'. -- cgit v1.2.3-54-g00ecf From 22466530eff42fa6b1e1ea2380227ad5f4b22923 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 13:59:34 -0400 Subject: 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 b65a08d42..0bf1319c6 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 bae296a35..1d3a531c5 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: 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 90ee3c992..262f788ee 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; -- cgit v1.2.3-54-g00ecf From 4d17c8553c80a36978a225f2bbe829cabeefc693 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 14:45:48 -0400 Subject: 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 6879f2089..055606f58 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()); -- cgit v1.2.3-54-g00ecf From 52d51fad3c4716a1978553921ececee571cf9971 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 15:10:00 -0400 Subject: 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 3ea3dd2aa..9ad2d31bd 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 -- cgit v1.2.3-54-g00ecf From 3649b9ffbc40c3695344597330ad9c35b26a4976 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Tue, 21 Jul 2009 15:17:54 -0400 Subject: 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 488b4b514..69512f243 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; -- cgit v1.2.3-54-g00ecf