textdomain("statusnet");
}
-
function common_timezone()
{
if (common_logged_in()) {
$value,
$expiration,
$cookiepath,
- $server);
+ $server,
+ common_config('site', 'ssl')=='always');
}
define('REMEMBERME', 'rememberme');
$longurl = $url;
}
}
- $attrs = array('href' => $canon, 'title' => $longurl, 'rel' => 'external');
+
+ $attrs = array('href' => $canon, 'title' => $longurl);
$is_attachment = false;
$attachment_id = null;
}
if (!empty($f)) {
- if ($f->getEnclosure() || File_oembed::staticGet('file_id',$f->id)) {
+ if ($f->getEnclosure()) {
$is_attachment = true;
$attachment_id = $f->id;
$attrs['id'] = "attachment-{$attachment_id}";
}
+ // Whether to nofollow
+
+ $nf = common_config('nofollow', 'external');
+
+ if ($nf == 'never') {
+ $attrs['rel'] = 'external';
+ } else {
+ $attrs['rel'] = 'nofollow external';
+ }
+
return XMLStringer::estring('a', $attrs, $url);
}
function common_validate_utf8($str)
{
// preg_replace will return NULL on invalid UTF-8 input.
- return preg_replace('//u', '', $str);
+ //
+ // Note: empty regex //u also caused NULL return on some
+ // production machines, but none of our test machines.
+ //
+ // This should be replaced with a more reliable check.
+ return preg_replace('/\x00/u', '', $str);
}
/**
$canonical = common_canonical_tag($tag);
if (common_config('singleuser', 'enabled')) {
// regular TagAction isn't set up in 1user mode
+ $user = User::singleUser();
$url = common_local_url('showstream',
- array('nickname' => common_config('singleuser', 'nickname'),
+ array('nickname' => $user->nickname,
'tag' => $canonical));
} else {
$url = common_local_url('tag', array('tag' => $canonical));
$attrs = array('href' => $group->permalink(),
'class' => 'url');
if (!empty($group->fullname)) {
- $attrs['title'] = $group->fullname . ' (' . $group->nickname . ')';
+ $attrs['title'] = $group->getFancyName();
}
$xs = new XMLStringer();
$xs->elementStart('span', 'vcard');
function common_is_sensitive($action)
{
- static $sensitive = array('login', 'register', 'passwordsettings', 'api');
+ static $sensitive = array(
+ 'login',
+ 'register',
+ 'passwordsettings',
+ 'api',
+ 'ApiOauthRequestToken',
+ 'ApiOauthAccessToken',
+ 'ApiOauthAuthorize',
+ 'ApiOauthPin',
+ 'showapplication'
+ );
$ssl = null;
if (Event::handle('SensitiveAction', array($action, &$ssl))) {
function common_log($priority, $msg, $filename=null)
{
if(Event::handle('StartLog', array(&$priority, &$msg, &$filename))){
+ $msg = (empty($filename)) ? $msg : basename($filename) . ' - ' . $msg;
$msg = '[' . common_request_id() . '] ' . $msg;
$logfile = common_config('site', 'logfile');
if ($logfile) {