From 1c2cf108118b3d5cfebd0e266099505810e6d850 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 19 Jun 2009 15:54:24 +0000 Subject: Includes a sioc:reply_to link between notices. It helps with things like http://danbri.org/words/2009/06/16/415 Thanks to Toby Inkster for the patch: http://buzzword.org.uk/2009/laconica-0.7.3-sioc-reply_to.patch --- lib/rssaction.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/rssaction.php b/lib/rssaction.php index eafdbf131..08b333d97 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -212,6 +212,11 @@ class Rss10Action extends Action $this->element('sioc:has_creator', array('rdf:resource' => $creator_uri.'#acct')); $this->element('laconica:postIcon', array('rdf:resource' => $profile->avatarUrl())); $this->element('cc:licence', array('rdf:resource' => common_config('license', 'url'))); + if ($notice->reply_to) { + $replyurl = common_local_url('shownotice', + array('notice' => $notice->reply_to)); + $this->element('sioc:reply_to', array('rdf:resource' => $replyurl)); + } $this->elementEnd('item'); $this->creators[$creator_uri] = $profile; } -- cgit v1.2.3-54-g00ecf From 9be54a3dcf6520781c1c64897a28cfaca6fd66fb Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 19 Jun 2009 16:04:14 +0000 Subject: Minor indenting --- lib/rssaction.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rssaction.php b/lib/rssaction.php index 08b333d97..6f6c9a8cb 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -213,8 +213,7 @@ class Rss10Action extends Action $this->element('laconica:postIcon', array('rdf:resource' => $profile->avatarUrl())); $this->element('cc:licence', array('rdf:resource' => common_config('license', 'url'))); if ($notice->reply_to) { - $replyurl = common_local_url('shownotice', - array('notice' => $notice->reply_to)); + $replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to)); $this->element('sioc:reply_to', array('rdf:resource' => $replyurl)); } $this->elementEnd('item'); -- cgit v1.2.3-54-g00ecf From b8f3f32f3f12339c3838fcfc883815d63a36dca7 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 19 Jun 2009 20:21:57 -0700 Subject: Keep Twitter gateway notices from leaking thru MySQL notice search --- lib/search_engines.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/search_engines.php b/lib/search_engines.php index 7b9dbb618..0f405afbd 100644 --- a/lib/search_engines.php +++ b/lib/search_engines.php @@ -118,12 +118,20 @@ class MySQLSearch extends SearchEngine } return true; } else if ('identica_notices' === $this->table) { - $this->target->whereAdd('MATCH(content) ' . - 'AGAINST (\''.addslashes($q).'\' IN BOOLEAN MODE)'); + + // Don't show imported notices + $this->target->whereAdd('notice.is_local != ' . NOTICE_GATEWAY); + if (strtolower($q) != $q) { + $this->target->whereAdd("( MATCH(content) AGAINST ('" . addslashes($q) . + "' IN BOOLEAN MODE)) OR ( MATCH(content) " . + "AGAINST ('" . addslashes(strtolower($q)) . + "' IN BOOLEAN MODE))"); + } else { $this->target->whereAdd('MATCH(content) ' . - 'AGAINST (\''.addslashes(strtolower($q)).'\' IN BOOLEAN MODE)', 'OR'); + 'AGAINST (\''.addslashes($q).'\' IN BOOLEAN MODE)'); } + return true; } else { throw new ServerException('Unknown table: ' . $this->table); @@ -138,6 +146,9 @@ class PGSearch extends SearchEngine if ('identica_people' === $this->table) { return $this->target->whereAdd('textsearch @@ plainto_tsquery(\''.addslashes($q).'\')'); } else if ('identica_notices' === $this->table) { + + // XXX: We need to filter out gateway notices (notice.is_local = -2) --Zach + return $this->target->whereAdd('to_tsvector(\'english\', content) @@ plainto_tsquery(\''.addslashes($q).'\')'); } else { throw new ServerException('Unknown table: ' . $this->table); -- cgit v1.2.3-54-g00ecf From 054e4459b2b2701158cd183dc1eb04c454e04bff Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 20 Jun 2009 18:22:05 +0000 Subject: Position of max_file_size position helps IE --- lib/noticeform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/noticeform.php b/lib/noticeform.php index a36b7f31f..4e2a2edd6 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -151,12 +151,12 @@ class NoticeForm extends Form '140'); $this->out->elementEnd('dl'); if (common_config('attachments', 'uploads')) { - $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach')); $this->out->element('input', array('id' => 'notice_data-attach', 'type' => 'file', 'name' => 'attach', 'title' => _('Attach a file'))); + $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); } if ($this->action) { $this->out->hidden('notice_return-to', $this->action, 'returnto'); -- cgit v1.2.3-54-g00ecf From 793a6a1155996a7bcdc068fc891e7063934bdb19 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 20 Jun 2009 16:00:04 -0700 Subject: change Controlez-Vous to Control Yourself --- actions/accesstoken.php | 2 +- actions/all.php | 2 +- actions/allrss.php | 2 +- actions/api.php | 2 +- actions/avatarbynickname.php | 2 +- actions/block.php | 2 +- actions/disfavor.php | 2 +- actions/doc.php | 2 +- actions/facebookhome.php | 2 +- actions/facebookinvite.php | 2 +- actions/facebooklogin.php | 2 +- actions/facebookremove.php | 2 +- actions/facebooksettings.php | 2 +- actions/favor.php | 2 +- actions/favoritesrss.php | 2 +- actions/file.php | 2 +- actions/finishopenidlogin.php | 2 +- actions/finishremotesubscribe.php | 2 +- actions/foaf.php | 2 +- actions/groupblock.php | 2 +- actions/groupsearch.php | 2 +- actions/groupunblock.php | 2 +- actions/invite.php | 2 +- actions/logout.php | 2 +- actions/makeadmin.php | 2 +- actions/microsummary.php | 2 +- actions/noticesearch.php | 2 +- actions/noticesearchrss.php | 2 +- actions/nudge.php | 2 +- actions/openidlogin.php | 2 +- actions/opensearch.php | 2 +- actions/peoplesearch.php | 2 +- actions/postnotice.php | 2 +- actions/publicrss.php | 2 +- actions/publicxrds.php | 2 +- actions/recoverpassword.php | 2 +- actions/remotesubscribe.php | 2 +- actions/repliesrss.php | 2 +- actions/requesttoken.php | 2 +- actions/subedit.php | 2 +- actions/subscribe.php | 2 +- actions/sup.php | 2 +- actions/tag.php | 2 +- actions/tagother.php | 2 +- actions/tagrss.php | 2 +- actions/twitapiaccount.php | 2 +- actions/twitapiblocks.php | 2 +- actions/twitapidirect_messages.php | 2 +- actions/twitapifavorites.php | 2 +- actions/twitapifriendships.php | 2 +- actions/twitapihelp.php | 2 +- actions/twitapinotifications.php | 2 +- actions/twitapistatuses.php | 2 +- actions/twitapiusers.php | 2 +- actions/unblock.php | 2 +- actions/unsubscribe.php | 2 +- actions/updateprofile.php | 2 +- actions/userauthorization.php | 2 +- actions/userbyid.php | 2 +- actions/userrss.php | 2 +- actions/xrds.php | 2 +- classes/File.php | 2 +- classes/File_oembed.php | 2 +- classes/File_redirection.php | 2 +- classes/File_thumbnail.php | 2 +- classes/File_to_post.php | 2 +- classes/Group_block.php | 2 +- classes/Memcached_DataObject.php | 2 +- classes/Notice.php | 2 +- classes/Notice_tag.php | 2 +- classes/Profile.php | 2 +- classes/Profile_block.php | 2 +- classes/Remote_profile.php | 2 +- classes/Subscription.php | 2 +- index.php | 2 +- install.php | 2 +- lib/Shorturl_api.php | 2 +- lib/arraywrapper.php | 2 +- lib/channel.php | 2 +- lib/clienterroraction.php | 2 +- lib/command.php | 2 +- lib/commandinterpreter.php | 2 +- lib/common.php | 2 +- lib/daemon.php | 2 +- lib/dberroraction.php | 2 +- lib/error.php | 2 +- lib/facebookutil.php | 2 +- lib/galleryaction.php | 2 +- lib/oauthstore.php | 2 +- lib/omb.php | 2 +- lib/openid.php | 2 +- lib/peoplesearchresults.php | 2 +- lib/queuehandler.php | 2 +- lib/search_engines.php | 2 +- lib/searchaction.php | 2 +- lib/servererroraction.php | 2 +- lib/subs.php | 2 +- lib/twitter.php | 2 +- lib/twitterapi.php | 2 +- lib/util.php | 2 +- lib/xmppqueuehandler.php | 2 +- scripts/enjitqueuehandler.php | 2 +- scripts/facebookqueuehandler.php | 2 +- scripts/fixup_hashtags.php | 2 +- scripts/fixup_inboxes.php | 2 +- scripts/fixup_notices_rendered.php | 2 +- scripts/fixup_replies.php | 2 +- scripts/getpiddir.php | 2 +- scripts/getvaliddaemons.php | 2 +- scripts/inbox_users.php | 2 +- scripts/jabberqueuehandler.php | 2 +- scripts/maildaemon.php | 2 +- scripts/ombqueuehandler.php | 2 +- scripts/pingqueuehandler.php | 2 +- scripts/publicqueuehandler.php | 2 +- scripts/setpassword.php | 2 +- scripts/smsqueuehandler.php | 2 +- scripts/sphinx-cron.sh | 2 +- scripts/sphinx-indexer.sh | 2 +- scripts/startdaemons.sh | 2 +- scripts/stopdaemons.sh | 2 +- scripts/synctwitterfriends.php | 2 +- scripts/twitterqueuehandler.php | 2 +- scripts/twitterstatusfetcher.php | 2 +- scripts/uncache_users.php | 2 +- scripts/xmppconfirmhandler.php | 2 +- scripts/xmppdaemon.php | 2 +- 127 files changed, 127 insertions(+), 127 deletions(-) (limited to 'lib') diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 46b43c702..01aa77574 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -12,7 +12,7 @@ * @link http://laconi.ca/ * * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Controlez-Vous, Inc. + * Copyright (C) 2008, Control Yourself, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/actions/all.php b/actions/all.php index 80fc9d54b..f436fabd1 100644 --- a/actions/all.php +++ b/actions/all.php @@ -1,7 +1,7 @@ Date: Sat, 20 Jun 2009 16:12:55 -0700 Subject: Update copyright dates in files modified in 2009 --- actions/accesstoken.php | 2 +- actions/all.php | 2 +- actions/allrss.php | 2 +- actions/api.php | 2 +- actions/avatarbynickname.php | 2 +- actions/block.php | 2 +- actions/disfavor.php | 2 +- actions/doc.php | 2 +- actions/facebookhome.php | 2 +- actions/facebookinvite.php | 2 +- actions/facebooklogin.php | 2 +- actions/facebookremove.php | 2 +- actions/facebooksettings.php | 2 +- actions/favor.php | 2 +- actions/favoritesrss.php | 2 +- actions/file.php | 2 +- actions/finishopenidlogin.php | 2 +- actions/finishremotesubscribe.php | 2 +- actions/foaf.php | 2 +- actions/groupblock.php | 2 +- actions/groupsearch.php | 2 +- actions/groupunblock.php | 2 +- actions/invite.php | 2 +- actions/logout.php | 2 +- actions/makeadmin.php | 2 +- actions/microsummary.php | 2 +- actions/noticesearch.php | 2 +- actions/noticesearchrss.php | 2 +- actions/nudge.php | 2 +- actions/openidlogin.php | 2 +- actions/opensearch.php | 2 +- actions/peoplesearch.php | 2 +- actions/postnotice.php | 2 +- actions/publicrss.php | 2 +- actions/publicxrds.php | 2 +- actions/recoverpassword.php | 2 +- actions/remotesubscribe.php | 2 +- actions/repliesrss.php | 2 +- actions/requesttoken.php | 2 +- actions/subedit.php | 2 +- actions/subscribe.php | 2 +- actions/sup.php | 2 +- actions/tag.php | 2 +- actions/tagother.php | 2 +- actions/tagrss.php | 2 +- actions/twitapiaccount.php | 2 +- actions/twitapiblocks.php | 2 +- actions/twitapidirect_messages.php | 2 +- actions/twitapifavorites.php | 2 +- actions/twitapifriendships.php | 2 +- actions/twitapihelp.php | 2 +- actions/twitapinotifications.php | 2 +- actions/twitapistatuses.php | 2 +- actions/twitapiusers.php | 2 +- actions/unblock.php | 2 +- actions/unsubscribe.php | 2 +- actions/updateprofile.php | 2 +- actions/userauthorization.php | 2 +- actions/userbyid.php | 2 +- actions/userrss.php | 2 +- actions/xrds.php | 2 +- classes/File.php | 2 +- classes/File_oembed.php | 2 +- classes/File_redirection.php | 2 +- classes/File_thumbnail.php | 2 +- classes/File_to_post.php | 2 +- classes/Group_block.php | 2 +- classes/Memcached_DataObject.php | 2 +- classes/Notice.php | 2 +- classes/Notice_tag.php | 2 +- classes/Profile.php | 2 +- classes/Profile_block.php | 2 +- classes/Remote_profile.php | 2 +- classes/Subscription.php | 2 +- index.php | 2 +- lib/Shorturl_api.php | 2 +- lib/arraywrapper.php | 2 +- lib/channel.php | 2 +- lib/clienterroraction.php | 2 +- lib/command.php | 2 +- lib/commandinterpreter.php | 2 +- lib/common.php | 2 +- lib/daemon.php | 2 +- lib/dberroraction.php | 2 +- lib/error.php | 2 +- lib/facebookutil.php | 2 +- lib/galleryaction.php | 2 +- lib/oauthstore.php | 2 +- lib/omb.php | 2 +- lib/openid.php | 2 +- lib/peoplesearchresults.php | 2 +- lib/queuehandler.php | 2 +- lib/search_engines.php | 2 +- lib/searchaction.php | 2 +- lib/servererroraction.php | 2 +- lib/subs.php | 2 +- lib/twitter.php | 2 +- lib/twitterapi.php | 2 +- lib/util.php | 2 +- lib/xmppqueuehandler.php | 2 +- scripts/enjitqueuehandler.php | 2 +- scripts/facebookqueuehandler.php | 2 +- scripts/fixup_hashtags.php | 2 +- scripts/fixup_inboxes.php | 2 +- scripts/fixup_notices_rendered.php | 2 +- scripts/fixup_replies.php | 2 +- scripts/getpiddir.php | 2 +- scripts/getvaliddaemons.php | 2 +- scripts/inbox_users.php | 2 +- scripts/jabberqueuehandler.php | 2 +- scripts/maildaemon.php | 2 +- scripts/ombqueuehandler.php | 2 +- scripts/pingqueuehandler.php | 2 +- scripts/publicqueuehandler.php | 2 +- scripts/setpassword.php | 2 +- scripts/smsqueuehandler.php | 2 +- scripts/sphinx-cron.sh | 2 +- scripts/sphinx-indexer.sh | 2 +- scripts/startdaemons.sh | 2 +- scripts/stopdaemons.sh | 2 +- scripts/synctwitterfriends.php | 2 +- scripts/twitterqueuehandler.php | 2 +- scripts/twitterstatusfetcher.php | 2 +- scripts/uncache_users.php | 2 +- scripts/xmppconfirmhandler.php | 2 +- scripts/xmppdaemon.php | 2 +- 126 files changed, 126 insertions(+), 126 deletions(-) (limited to 'lib') diff --git a/actions/accesstoken.php b/actions/accesstoken.php index 01aa77574..2a8cd1713 100644 --- a/actions/accesstoken.php +++ b/actions/accesstoken.php @@ -12,7 +12,7 @@ * @link http://laconi.ca/ * * Laconica - a distributed open-source microblogging tool - * Copyright (C) 2008, Control Yourself, Inc. + * Copyright (C) 2008, 2009, Control Yourself, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/actions/all.php b/actions/all.php index f436fabd1..f06ead2a8 100644 --- a/actions/all.php +++ b/actions/all.php @@ -1,7 +1,7 @@ Date: Sun, 21 Jun 2009 11:11:12 -0700 Subject: add collecta.com link --- lib/searchaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/searchaction.php b/lib/searchaction.php index bb2d50572..34fe9373f 100644 --- a/lib/searchaction.php +++ b/lib/searchaction.php @@ -148,10 +148,10 @@ You can also try your search on other engines: * [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s) * [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s) * [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s) - +* [Collecta](http://collecta.com/#q=%s) E_O_T -), $qe, $qe, $qe, $qe); +), $qe, $qe, $qe, $qe, $qe); $this->elementStart('dl', array('id' => 'help_search', 'class' => 'help')); $this->element('dt', null, _('Search help')); $this->elementStart('dd', 'instructions'); -- cgit v1.2.3-54-g00ecf From 02a4ca9e2ea46cb82829dc65e76efc36b0ec470b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 21 Jun 2009 21:38:16 -0700 Subject: got rid of 'skin' concept a while ago --- lib/common.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/common.php b/lib/common.php index a4da25157..361759d0a 100644 --- a/lib/common.php +++ b/lib/common.php @@ -83,7 +83,6 @@ $config = array('name' => 'Just another Laconica microblog', 'server' => $_server, 'theme' => 'default', - 'skin' => 'default', 'design' => array('backgroundcolor' => '#F0F2F5', 'contentcolor' => '#FFFFFF', -- cgit v1.2.3-54-g00ecf From 876ab059273a5f223170d6b2c0b9b4342b06c50f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 21 Jun 2009 21:50:35 -0700 Subject: Add like for search --- README | 13 ++++++++++++- classes/Memcached_DataObject.php | 9 ++++++++- lib/common.php | 4 +++- lib/search_engines.php | 22 ++++++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/README b/README index 5aa7270ee..0c500acb8 100644 --- a/README +++ b/README @@ -1247,7 +1247,6 @@ Options for group functionality. maxaliases: maximum number of aliases a group can have. Default 3. Set to 0 or less to prevent aliases in a group. - oohembed -------- @@ -1255,6 +1254,18 @@ oEmbed endpoint for multimedia attachments (links in posts). endpoint: oohembed endpoint using http://oohembed.com/ software. +search +------ + +Some stuff for search. + +type: type of search. Ignored if PostgreSQL or Sphinx are enabled. Can either + be 'fulltext' (default) or 'like'. The former is faster and more efficient + but requires the lame old MyISAM engine for MySQL. The latter + will work with InnoDB but could be miserably slow on large + systems. We'll probably add another type sometime in the future, + with our own indexing system (maybe like MediaWiki's). + Troubleshooting =============== diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php index 2d5a73554..f7cbb9d5b 100644 --- a/classes/Memcached_DataObject.php +++ b/classes/Memcached_DataObject.php @@ -193,7 +193,14 @@ class Memcached_DataObject extends DB_DataObject // unable to connect to sphinx' search daemon if (!$connected) { if ('mysql' === common_config('db', 'type')) { - $search_engine = new MySQLSearch($this, $table); + $type = common_config('search', 'type'); + if ($type == 'like') { + $search_engine = new MySQLLikeSearch($this, $table); + } else if ($type == 'fulltext') { + $search_engine = new MySQLSearch($this, $table); + } else { + throw new ServerException('Unknown search type: ' . $type); + } } else { $search_engine = new PGSearch($this, $table); } diff --git a/lib/common.php b/lib/common.php index 361759d0a..14f5c7a7f 100644 --- a/lib/common.php +++ b/lib/common.php @@ -228,7 +228,9 @@ $config = ), 'group' => array('maxaliases' => 3), - 'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/') + 'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/'), + 'search' => + array('type' => 'fulltext'), ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); diff --git a/lib/search_engines.php b/lib/search_engines.php index c98e8ed87..5c84d7c6b 100644 --- a/lib/search_engines.php +++ b/lib/search_engines.php @@ -131,6 +131,28 @@ class MySQLSearch extends SearchEngine } } +class MySQLLikeSearch extends SearchEngine +{ + function query($q) + { + if ('identica_people' === $this->table) { + $qry = sprintf('(nickname LIKE "%%%1$s%%" OR '. + ' fullname LIKE "%%%1$s%%" OR '. + ' location LIKE "%%%1$s%%" OR '. + ' bio LIKE "%%%1$s%%" OR '. + ' homepage LIKE "%%%1$s%%")', addslashes($q)); + } else if ('identica_notices' === $this->table) { + $qry = sprintf('content LIKE "%%%1$s%%"', addslashes($q)); + } else { + throw new ServerException('Unknown table: ' . $this->table); + } + + $this->target->whereAdd($qry); + + return true; + } +} + class PGSearch extends SearchEngine { function query($q) -- cgit v1.2.3-54-g00ecf From 7cf0a4c6472ab05a0963c003d8c3ecb59237ee67 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 22 Jun 2009 09:31:55 -0700 Subject: theme dir, path configurable --- README | 13 ++++++++++--- lib/common.php | 4 +++- lib/theme.php | 36 +++++++++++++++++++++++++++++------- 3 files changed, 42 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/README b/README index 0c500acb8..cd663d931 100644 --- a/README +++ b/README @@ -1039,9 +1039,16 @@ theme ----- server: Like avatars, you can speed up page loading by pointing the - theme file lookup to another server (virtual or real). The - theme server's root path should map to the Laconica "theme" - subdirectory. Defaults to NULL. + theme file lookup to another server (virtual or real). + Defaults to NULL, meaning to use the site server. +dir: Directory where theme files are stored. Used to determine + whether to show parts of a theme file. Defaults to the theme + subdirectory of the install directory. +path: Path part of theme URLs, before the theme name. Relative to the + theme server. It may make sense to change this path when upgrading, + (using version numbers as the path) to make sure that all files are + reloaded by caching clients or proxies. Defaults to null, + which means to use the site path + '/theme'. xmpp ---- diff --git a/lib/common.php b/lib/common.php index 14f5c7a7f..0333030e1 100644 --- a/lib/common.php +++ b/lib/common.php @@ -140,7 +140,9 @@ $config = 'blacklist' => array(), 'autosource' => array()), 'theme' => - array('server' => null), + array('server' => null, + 'dir' => null, + 'path'=> null), 'throttle' => array('enabled' => false, // whether to throttle edits; false by default 'count' => 20, // number of allowed messages in timespan diff --git a/lib/theme.php b/lib/theme.php index 0d8824822..2fe6ab69b 100644 --- a/lib/theme.php +++ b/lib/theme.php @@ -43,10 +43,14 @@ if (!defined('LACONICA')) { function theme_file($relative, $theme=null) { - if (!$theme) { + if (empty($theme)) { $theme = common_config('site', 'theme'); } - return INSTALLDIR.'/theme/'.$theme.'/'.$relative; + $dir = common_config('theme', 'dir'); + if (empty($dir)) { + $dir = INSTALLDIR.'/theme'; + } + return $dir.'/'.$theme.'/'.$relative; } /** @@ -60,13 +64,31 @@ function theme_file($relative, $theme=null) function theme_path($relative, $theme=null) { - if (!$theme) { + if (empty($theme)) { $theme = common_config('site', 'theme'); } + + $path = common_config('theme', 'path'); + + if (empty($path)) { + $path = common_config('site', 'path') . '/theme/'; + } + + if ($path[strlen($path)-1] != '/') { + $path .= '/'; + } + + if ($path[0] != '/') { + $path = '/'.$path; + } + $server = common_config('theme', 'server'); - if ($server) { - return 'http://'.$server.'/'.$theme.'/'.$relative; - } else { - return common_path('theme/'.$theme.'/'.$relative); + + if (empty($server)) { + $server = common_config('site', 'server'); } + + // XXX: protocol + + return 'http://'.$server.$path.$theme.'/'.$relative; } -- cgit v1.2.3-54-g00ecf