summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php1
-rw-r--r--lib/command.php105
-rw-r--r--lib/commandinterpreter.php20
-rw-r--r--lib/common.php9
-rw-r--r--lib/designsettings.php3
-rw-r--r--lib/galleryaction.php5
-rw-r--r--lib/htmloutputter.php31
-rw-r--r--lib/mail.php16
-rw-r--r--lib/noticeform.php11
-rw-r--r--lib/noticelist.php18
-rw-r--r--lib/omb.php2
-rw-r--r--lib/router.php4
-rw-r--r--lib/searchaction.php12
-rw-r--r--lib/twitteroauthclient.php8
-rw-r--r--lib/util.php23
15 files changed, 223 insertions, 45 deletions
diff --git a/lib/action.php b/lib/action.php
index fafb2c6fc..670eb498c 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -881,6 +881,7 @@ class Action extends HTMLOutputter // lawsuit
*/
function handle($argarray=null)
{
+ header('Vary: Accept-Encoding,Cookie');
$lm = $this->lastModified();
$etag = $this->etag();
if ($etag) {
diff --git a/lib/command.php b/lib/command.php
index 91a20b810..01b14f83e 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -114,7 +114,6 @@ class StatsCommand extends Command
class FavCommand extends Command
{
-
var $other = null;
function __construct($user, $other)
@@ -158,6 +157,108 @@ class FavCommand extends Command
$channel->output($this->user, _('Notice marked as fave.'));
}
+
+}
+class JoinCommand extends Command
+{
+ var $other = null;
+
+ function __construct($user, $other)
+ {
+ parent::__construct($user);
+ $this->other = $other;
+ }
+
+ function execute($channel)
+ {
+
+ $nickname = common_canonical_nickname($this->other);
+ $group = User_group::staticGet('nickname', $nickname);
+ $cur = $this->user;
+
+ if (!$group) {
+ $channel->error($cur, _('No such group.'));
+ return;
+ }
+
+ if ($cur->isMember($group)) {
+ $channel->error($cur, _('You are already a member of that group'));
+ return;
+ }
+ if (Group_block::isBlocked($group, $cur->getProfile())) {
+ $channel->error($cur, _('You have been blocked from that group by the admin.'));
+ return;
+ }
+
+ $member = new Group_member();
+
+ $member->group_id = $group->id;
+ $member->profile_id = $cur->id;
+ $member->created = common_sql_now();
+
+ $result = $member->insert();
+ if (!$result) {
+ common_log_db_error($member, 'INSERT', __FILE__);
+ $channel->error($cur, sprintf(_('Could not join user %s to group %s'),
+ $cur->nickname, $group->nickname));
+ return;
+ }
+
+ $channel->output($cur, sprintf(_('%s joined group %s'),
+ $cur->nickname,
+ $group->nickname));
+ }
+
+}
+class DropCommand extends Command
+{
+ var $other = null;
+
+ function __construct($user, $other)
+ {
+ parent::__construct($user);
+ $this->other = $other;
+ }
+
+ function execute($channel)
+ {
+
+ $nickname = common_canonical_nickname($this->other);
+ $group = User_group::staticGet('nickname', $nickname);
+ $cur = $this->user;
+
+ if (!$group) {
+ $channel->error($cur, _('No such group.'));
+ return;
+ }
+
+ if (!$cur->isMember($group)) {
+ $channel->error($cur, _('You are not a member of that group.'));
+ return;
+ }
+
+ $member = new Group_member();
+
+ $member->group_id = $group->id;
+ $member->profile_id = $cur->id;
+
+ if (!$member->find(true)) {
+ $channel->error($cur,_('Could not find membership record.'));
+ return;
+ }
+ $result = $member->delete();
+ if (!$result) {
+ common_log_db_error($member, 'INSERT', __FILE__);
+ $channel->error($cur, sprintf(_('Could not remove user %s to group %s'),
+ $cur->nickname, $group->nickname));
+ return;
+ }
+
+ $channel->output($cur, sprintf(_('%s left group %s'),
+ $cur->nickname,
+ $group->nickname));
+ }
+
}
class WhoisCommand extends Command
@@ -392,6 +493,8 @@ class HelpCommand extends Command
"get <nickname> - get last notice from user\n".
"whois <nickname> - get profile info on user\n".
"fav <nickname> - add user's last notice as a 'fave'\n".
+ "join <group> - join group\n".
+ "drop <group> - leave group\n".
"stats - get your stats\n".
"stop - same as 'off'\n".
"quit - same as 'off'\n".
diff --git a/lib/commandinterpreter.php b/lib/commandinterpreter.php
index ac6bf73c8..6e4340e5d 100644
--- a/lib/commandinterpreter.php
+++ b/lib/commandinterpreter.php
@@ -70,6 +70,26 @@ class CommandInterpreter
} else {
return new OffCommand($user);
}
+ case 'join':
+ if (!$arg) {
+ return null;
+ }
+ list($other, $extra) = explode(' ', $arg, 2);
+ if ($extra) {
+ return null;
+ } else {
+ return new JoinCommand($user, $other);
+ }
+ case 'drop':
+ if (!$arg) {
+ return null;
+ }
+ list($other, $extra) = explode(' ', $arg, 2);
+ if ($extra) {
+ return null;
+ } else {
+ return new DropCommand($user, $other);
+ }
case 'follow':
case 'sub':
if (!$arg) {
diff --git a/lib/common.php b/lib/common.php
index 39d4ffc9b..3de567cd9 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -19,10 +19,10 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-define('STATUSNET_VERSION', '0.8.1');
+define('STATUSNET_VERSION', '0.8.2dev');
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
-define('STATUSNET_CODENAME', 'Second Guessing');
+define('STATUSNET_CODENAME', 'Life and How to Live It');
define('AVATAR_PROFILE_SIZE', 96);
define('AVATAR_STREAM_SIZE', 48);
@@ -196,15 +196,14 @@ $config =
array('enabled' => true),
'sms' =>
array('enabled' => true),
- 'twitter' =>
- array('enabled' => true),
'twitterbridge' =>
array('enabled' => false),
'integration' =>
array('source' => 'StatusNet', # source attribute for Twitter
'taguri' => $_server.',2009'), # base for tag URIs
'twitter' =>
- array('consumer_key' => null,
+ array('enabled' => true,
+ 'consumer_key' => null,
'consumer_secret' => null),
'memcached' =>
array('enabled' => false,
diff --git a/lib/designsettings.php b/lib/designsettings.php
index fe4222597..820d534f2 100644
--- a/lib/designsettings.php
+++ b/lib/designsettings.php
@@ -325,8 +325,9 @@ class DesignSettingsAction extends AccountSettingsAction
parent::showScripts();
$this->script('js/farbtastic/farbtastic.js');
- $this->script('js/farbtastic/farbtastic.go.js');
$this->script('js/userdesign.go.js');
+
+ $this->autofocus('design_background-image_file');
}
/**
diff --git a/lib/galleryaction.php b/lib/galleryaction.php
index 18cc7b929..31e36803a 100644
--- a/lib/galleryaction.php
+++ b/lib/galleryaction.php
@@ -132,13 +132,16 @@ class GalleryAction extends OwnerDesignAction
$this->elementEnd('li');
$this->elementStart('li', array('id'=>'filter_tags_item'));
$this->elementStart('form', array('name' => 'bytag',
- 'id' => 'bytag',
+ 'id' => 'form_filter_bytag',
'action' => common_path('?action=' . $this->trimmed('action')),
'method' => 'post'));
+ $this->elementStart('fieldset');
+ $this->element('legend', null, _('Select tag to filter'));
$this->dropdown('tag', _('Tag'), $content,
_('Choose a tag to narrow list'), false, $tag);
$this->hidden('nickname', $this->user->nickname);
$this->submit('submit', _('Go'));
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementEnd('li');
$this->elementEnd('ul');
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php
index 8ad7dc20f..2ff9380cc 100644
--- a/lib/htmloutputter.php
+++ b/lib/htmloutputter.php
@@ -106,14 +106,16 @@ class HTMLOutputter extends XMLOutputter
}
}
- header('Content-Type: '.$type);
+ header('Content-Type: '.$type.'; charset=UTF-8');
$this->extraHeaders();
- if( ! substr($type,0,strlen('text/html'))=='text/html' ){
- // Browsers don't like it when <?xml it output for non-xhtml documents
+ if (preg_match("/.*\/.*xml/", $type)) {
+ // Required for XML documents
$this->xw->startDocument('1.0', 'UTF-8');
}
- $this->xw->writeDTD('html');
+ $this->xw->writeDTD('html',
+ '-//W3C//DTD XHTML 1.0 Strict//EN',
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
$language = $this->getLanguage();
@@ -412,4 +414,25 @@ class HTMLOutputter extends XMLOutputter
$this->element('p', 'form_guide', $instructions);
}
}
+
+
+ /**
+ * Internal script to autofocus the given element on page onload.
+ *
+ * @param string $id element ID, must refer to an existing element
+ *
+ * @return void
+ *
+ */
+ function autofocus($id)
+ {
+ $this->elementStart('script', array('type' => 'text/javascript'));
+ $this->raw('/*<![CDATA[*/'.
+ ' $(document).ready(function() {'.
+ ' var el = $("#' . $id . '");'.
+ ' if (el.length) { el.focus(); }'.
+ ' });'.
+ ' /*]]>*/');
+ $this->elementEnd('script');
+ }
}
diff --git a/lib/mail.php b/lib/mail.php
index df585406c..5bf4d7425 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -551,9 +551,9 @@ function mail_notify_fave($other, $user, $notice)
common_init_locale($other->language);
- $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
+ $subject = sprintf(_('%s (@%s) added your notice as a favorite'), $bestname, $user->nickname);
- $body = sprintf(_("%1\$s just added your notice from %2\$s".
+ $body = sprintf(_("%1\$s (@%7\$s) just added your notice from %2\$s".
" as one of their favorites.\n\n" .
"The URL of your notice is:\n\n" .
"%3\$s\n\n" .
@@ -570,7 +570,8 @@ function mail_notify_fave($other, $user, $notice)
$notice->content,
common_local_url('showfavorites',
array('nickname' => $user->nickname)),
- common_config('site', 'name'));
+ common_config('site', 'name'),
+ $user->nickname);
common_init_locale();
mail_to_user($other, $subject, $body);
@@ -607,9 +608,9 @@ function mail_notify_attn($user, $notice)
$conversationUrl = null;
}
- $subject = sprintf(_('%s sent a notice to your attention'), $bestname);
+ $subject = sprintf(_('%s (@%s) sent a notice to your attention'), $bestname, $sender->nickname);
- $body = sprintf(_("%1\$s just sent a notice to your attention (an '@-reply') on %2\$s.\n\n".
+ $body = sprintf(_("%1\$s (@%9\$s) just sent a notice to your attention (an '@-reply') on %2\$s.\n\n".
"The notice is here:\n\n".
"\t%3\$s\n\n" .
"It reads:\n\n".
@@ -629,10 +630,11 @@ function mail_notify_attn($user, $notice)
$notice->content,//%4
$conversationUrl,//%5
common_local_url('newnotice',
- array('replyto' => $sender->nickname)),//%6
+ array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)),//%6
common_local_url('replies',
array('nickname' => $user->nickname)),//%7
- common_local_url('emailsettings'));//%8
+ common_local_url('emailsettings'), //%8
+ $sender->nickname); //%9
common_init_locale();
mail_to_user($user, $subject, $body);
diff --git a/lib/noticeform.php b/lib/noticeform.php
index 1e3a45142..350e37db8 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -70,6 +70,12 @@ class NoticeForm extends Form
var $user = null;
/**
+ * The notice being replied to
+ */
+
+ var $inreplyto = null;
+
+ /**
* Constructor
*
* @param HTMLOutputter $out output channel
@@ -77,12 +83,13 @@ class NoticeForm extends Form
* @param string $content content to pre-fill
*/
- function __construct($out=null, $action=null, $content=null, $user=null)
+ function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null)
{
parent::__construct($out);
$this->action = $action;
$this->content = $content;
+ $this->inreplyto = $inreplyto;
if ($user) {
$this->user = $user;
@@ -161,7 +168,7 @@ class NoticeForm extends Form
if ($this->action) {
$this->out->hidden('notice_return-to', $this->action, 'returnto');
}
- $this->out->hidden('notice_in-reply-to', $this->action, 'inreplyto');
+ $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
}
/**
diff --git a/lib/noticelist.php b/lib/noticelist.php
index ec85e4a5c..d4cd3ff6e 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -261,7 +261,7 @@ class NoticeListItem extends Widget
$attrs = array('href' => $this->profile->profileurl,
'class' => 'url');
if (!empty($this->profile->fullname)) {
- $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
+ $attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')';
}
$this->out->elementStart('a', $attrs);
$this->showAvatar();
@@ -418,9 +418,17 @@ class NoticeListItem extends Widget
function showContext()
{
- // XXX: also show context if there are replies to this notice
- if (!empty($this->notice->conversation)
- && $this->notice->conversation != $this->notice->id) {
+ $hasConversation = false;
+ if( !empty($this->notice->conversation)
+ && $this->notice->conversation != $this->notice->id){
+ $hasConversation = true;
+ }else{
+ $conversation = Notice::conversationStream($this->notice->id, 1, 1);
+ if($conversation->N > 0){
+ $hasConversation = true;
+ }
+ }
+ if ($hasConversation){
$convurl = common_local_url('conversation',
array('id' => $this->notice->conversation));
$this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id,
@@ -442,7 +450,7 @@ class NoticeListItem extends Widget
{
if (common_logged_in()) {
$reply_url = common_local_url('newnotice',
- array('replyto' => $this->profile->nickname));
+ array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id));
$this->out->elementStart('a', array('href' => $reply_url,
'class' => 'notice_reply',
'title' => _('Reply to this notice')));
diff --git a/lib/omb.php b/lib/omb.php
index 0d6244599..7dca760c6 100644
--- a/lib/omb.php
+++ b/lib/omb.php
@@ -135,7 +135,7 @@ function omb_broadcast_remote_subscribers($notice)
$posted = array();
while ($rp->fetch()) {
- if (!$posted[$rp->postnoticeurl]) {
+ if (!array_key_exists($rp->postnoticeurl, $posted)) {
common_log(LOG_DEBUG, 'Posting to ' . $rp->postnoticeurl);
if (omb_post_notice_keys($notice, $rp->postnoticeurl, $rp->token, $rp->secret)) {
common_log(LOG_DEBUG, 'Finished to ' . $rp->postnoticeurl);
diff --git a/lib/router.php b/lib/router.php
index 5309fe753..5529e60ac 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -175,6 +175,10 @@ class Router
$m->connect('notice/new?replyto=:replyto',
array('action' => 'newnotice'),
array('replyto' => '[A-Za-z0-9_-]+'));
+ $m->connect('notice/new?replyto=:replyto&inreplyto=:inreplyto',
+ array('action' => 'newnotice'),
+ array('replyto' => '[A-Za-z0-9_-]+'),
+ array('inreplyto' => '[0-9]+'));
$m->connect('notice/:notice/file',
array('action' => 'file'),
diff --git a/lib/searchaction.php b/lib/searchaction.php
index 0d9f85a8f..130b28ff5 100644
--- a/lib/searchaction.php
+++ b/lib/searchaction.php
@@ -135,16 +135,21 @@ class SearchAction extends Action
}
function searchSuggestions($q) {
- $qe = urlencode($q);
- $message = sprintf(_(<<<E_O_T
+ $message = _(<<<E_O_T
* Make sure all words are spelled correctly.
* Try different keywords.
* Try more general keywords.
* Try fewer keywords.
+E_O_T
+);
+ if (!common_config('site', 'private')) {
+ $qe = urlencode($q);
+ $message .= sprintf(_(<<<E_O_T
+
You can also try your search on other engines:
-* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
+* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=%%%%site.server%%%%)
* [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)
@@ -152,6 +157,7 @@ You can also try your search on other engines:
E_O_T
), $qe, $qe, $qe, $qe, $qe);
+ }
$this->elementStart('dl', array('id' => 'help_search', 'class' => 'help'));
$this->element('dt', null, _('Search help'));
$this->elementStart('dd', 'instructions');
diff --git a/lib/twitteroauthclient.php b/lib/twitteroauthclient.php
index e37fa05f0..bad2b74ca 100644
--- a/lib/twitteroauthclient.php
+++ b/lib/twitteroauthclient.php
@@ -118,7 +118,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
- * Calls Twitter's /stutuses/update API method
+ * Calls Twitter's /statuses/update API method
*
* @param string $status text of the status
* @param int $in_reply_to_status_id optional id of the status it's
@@ -137,7 +137,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
- * Calls Twitter's /stutuses/friends_timeline API method
+ * Calls Twitter's /statuses/friends_timeline API method
*
* @param int $since_id show statuses after this id
* @param int $max_id show statuses before this id
@@ -167,7 +167,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
- * Calls Twitter's /stutuses/friends API method
+ * Calls Twitter's /statuses/friends API method
*
* @param int $id id of the user whom you wish to see friends of
* @param int $user_id numerical user id
@@ -197,7 +197,7 @@ class TwitterOAuthClient extends OAuthClient
}
/**
- * Calls Twitter's /stutuses/friends/ids API method
+ * Calls Twitter's /statuses/friends/ids API method
*
* @param int $id id of the user whom you wish to see friends of
* @param int $user_id numerical user id
diff --git a/lib/util.php b/lib/util.php
index 0bb943ad8..047faeef0 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -59,7 +59,7 @@ function common_init_language()
textdomain("statusnet");
setlocale(LC_CTYPE, 'C');
if(!$locale_set) {
- common_log(LOG_INFO,'Language requested:'.$language.' - locale could not be set:',__FILE__);
+ common_log(LOG_INFO, 'Language requested:' . $language . ' - locale could not be set. Perhaps that system locale is not installed.', __FILE__);
}
}
@@ -391,7 +391,7 @@ function common_render_content($text, $notice)
{
$r = common_render_text($text);
$id = $notice->profile_id;
- $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
+ $r = preg_replace('/(^|\s+)@(['.NICKNAME_FMT.']{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r);
$r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r);
$r = preg_replace('/(^|\s+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r);
$r = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/e', "'\\1!'.common_group_link($id, '\\2')", $r);
@@ -432,7 +432,7 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
')'.
'|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'. //IPv4
'|(?:'. //IPv6
- '\[?(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}(?:(?:[0-9A-Fa-f]{1,4})|:))|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?::|(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(?::[0-9A-Fa-f]{1,4})))|(?:(?:[0-9A-Fa-f]{1,4}:){5}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|(?:(?::[0-9A-Fa-f]{1,4}){1,2})))|(?:(?:[0-9A-Fa-f]{1,4}:){4}(?::[0-9A-Fa-f]{1,4}){0,1}(?:(?::(?:(?:25[0-5]|2[0-4]\d|[01]?\d{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'[\pN\pL\-\_]+(?:\.[\pN\pL\-\_]+)*\.'.
@@ -442,13 +442,13 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
')'.
'(?:'.
'(?:\:\d+)?'. //:port
- '(?:/[\pN\pL$\[\]\,\!\(\)\.\-\_\+\/\=\&\;\%\~]*)?'. // /path
- '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\-\_\+\/\=\&\;\%\~\/]*)?'. // ?query string
- '(?:\#[\pN\pL$\[\]\,\!\(\)\.\-\_\+\/\=\&\;\%\~\/\?\#]*)?'. // #fragment
+ '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path
+ '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string
+ '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment
')(?<![\?\.\,\#\,])'.
')'.
'#ixu';
- preg_match_all($regex,$text,$matches);
+ //preg_match_all($regex,$text,$matches);
//print_r($matches);
return preg_replace_callback($regex, curry('callback_helper',$callback,$notice_id) ,$text);
}
@@ -552,12 +552,13 @@ function common_linkify($url) {
}
if (!empty($f)) {
- if (isset($f->filename)) {
+ if ($f->isEnclosure()) {
$is_attachment = true;
$attachment_id = $f->id;
- } else { // if it has OEmbed info, it's an attachment, too
+ } else {
$foe = File_oembed::staticGet('file_id', $f->id);
if (!empty($foe)) {
+ // if it has OEmbed info, it's an attachment, too
$is_attachment = true;
$attachment_id = $f->id;
@@ -980,7 +981,7 @@ function common_set_returnto($url)
function common_get_returnto()
{
common_ensure_session();
- return $_SESSION['returnto'];
+ return (array_key_exists('returnto', $_SESSION)) ? $_SESSION['returnto'] : null;
}
function common_timestamp()
@@ -1147,7 +1148,7 @@ function common_negotiate_type($cprefs, $sprefs)
}
if ('text/html' === $besttype) {
- return "text/html; charset=utf-8";
+ return "text/html";
}
return $besttype;
}