aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-08-12 20:56:23 -0700
committerfriendica <info@friendica.com>2012-08-12 20:56:23 -0700
commit184cf51d2f21782d8fa78d833b1439ed692126ff (patch)
treecc2d74b87c5ac94fe7aa7c97382b6f982810298b
parent9899cfb5c75b6855e158d855ca0dba1344ca6262 (diff)
downloadvolse-hubzilla-184cf51d2f21782d8fa78d833b1439ed692126ff.tar.gz
volse-hubzilla-184cf51d2f21782d8fa78d833b1439ed692126ff.tar.bz2
volse-hubzilla-184cf51d2f21782d8fa78d833b1439ed692126ff.zip
reduce duplication - only provide one system language setting
-rw-r--r--include/api.php9
-rw-r--r--include/bbcode.php2
-rw-r--r--include/html2plain.php1
-rwxr-xr-xinclude/items.php9
-rw-r--r--include/language.php17
-rw-r--r--include/text.php37
-rw-r--r--index.php8
-rw-r--r--version.inc2
8 files changed, 36 insertions, 49 deletions
diff --git a/include/api.php b/include/api.php
index 7d230629b..456d984de 100644
--- a/include/api.php
+++ b/include/api.php
@@ -755,6 +755,15 @@
$ret = api_format_items($r,$user_info);
+ // We aren't going to try to figure out at the item, group, and page
+ // level which items you've seen and which you haven't. If you're looking
+ // at the network timeline just mark everything seen.
+
+ $r = q("UPDATE `item` SET `unseen` = 0
+ WHERE `unseen` = 1 AND `uid` = %d",
+ intval($user_info['uid'])
+ );
+
$data = array('$statuses' => $ret);
switch($type){
diff --git a/include/bbcode.php b/include/bbcode.php
index 7a88225f0..0889e76ce 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -323,6 +323,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism",'<br/><img src="' .$a->get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br />', $Text);
+
// Try to Oembed
if ($tryoembed) {
$Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);
diff --git a/include/html2plain.php b/include/html2plain.php
index 839dd70a7..5631e4954 100644
--- a/include/html2plain.php
+++ b/include/html2plain.php
@@ -100,7 +100,6 @@ function collecturls($message) {
function html2plain($html, $wraplength = 75, $compact = false)
{
- global $lang;
$message = str_replace("\r", "", $html);
diff --git a/include/items.php b/include/items.php
index 4c84b32f8..9c72d5359 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2094,7 +2094,7 @@ function local_delivery($importer,$data) {
}
}
- if((is_array($contact)) && ($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) {
+ if(($photo_timestamp) && (strlen($photo_url)) && ($photo_timestamp > $importer['avatar-date'])) {
logger('local_delivery: Updating photo for ' . $importer['name']);
require_once("Photo.php");
$photo_failure = false;
@@ -2152,7 +2152,7 @@ function local_delivery($importer,$data) {
}
}
- if((is_array($contact)) && ($name_updated) && (strlen($new_name)) && ($name_updated > $contact['name-date'])) {
+ if(($name_updated) && (strlen($new_name)) && ($name_updated > $importer['name-date'])) {
$r = q("select * from contact where uid = %d and id = %d limit 1",
intval($importer['importer_uid']),
intval($importer['id'])
@@ -2971,7 +2971,8 @@ function local_delivery($importer,$data) {
$datarray['uid'] = $importer['importer_uid'];
$datarray['contact-id'] = $importer['id'];
- if(! link_compare($datarray['owner-link'],$contact['url'])) {
+
+ if(! link_compare($datarray['owner-link'],$importer['url'])) {
// The item owner info is not our contact. It's OK and is to be expected if this is a tgroup delivery,
// but otherwise there's a possible data mixup on the sender's system.
// the tgroup delivery code called from item_store will correct it if it's a forum,
@@ -3246,7 +3247,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
if(strlen($item['owner-name']))
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
- if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || ($item['thr-parent'])) {
+ if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
$o .= '<thr:in-reply-to ref="' . xmlify($parent_item) . '" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['parent']) . '" />' . "\r\n";
}
diff --git a/include/language.php b/include/language.php
index dc54fbd2e..899375dcf 100644
--- a/include/language.php
+++ b/include/language.php
@@ -68,11 +68,11 @@ function get_best_language() {
function push_lang($language) {
- global $lang, $a;
+ global $a;
- $a->langsave = $lang;
+ $a->langsave = $a->language;
- if($language === $lang)
+ if($language === $a->language)
return;
if(isset($a->strings) && count($a->strings)) {
@@ -80,14 +80,14 @@ function push_lang($language) {
}
$a->strings = array();
load_translation_table($language);
- $a->language = $lang = $language;
+ $a->language = $language;
}
function pop_lang() {
- global $lang, $a;
+ global $a;
- if($lang === $a->langsave)
+ if($a->language === $a->langsave)
return;
if(isset($a->stringsave))
@@ -95,7 +95,7 @@ function pop_lang() {
else
$a->strings = array();
- $a->language = $lang = $a->langsave;
+ $a->language = $a->langsave;
}
@@ -136,12 +136,11 @@ function t($s) {
if(! function_exists('tt')){
function tt($singular, $plural, $count){
- global $lang;
$a = get_app();
if(x($a->strings,$singular)) {
$t = $a->strings[$singular];
- $f = 'string_plural_select_' . str_replace('-','_',$lang);
+ $f = 'string_plural_select_' . str_replace('-','_',$a->language);
if(! function_exists($f))
$f = 'string_plural_select_default';
$k = $f($count);
diff --git a/include/text.php b/include/text.php
index 569a4f8db..bddded7ee 100644
--- a/include/text.php
+++ b/include/text.php
@@ -387,38 +387,15 @@ function photo_new_resource() {
}}
-// wrapper to load a view template, checking for alternate
-// languages before falling back to the default
-
-// obsolete, deprecated.
-
-if(! function_exists('load_view_file')) {
-function load_view_file($s) {
- global $lang, $a;
- if(! isset($lang))
- $lang = 'en';
- $b = basename($s);
- $d = dirname($s);
- if(file_exists("$d/$lang/$b"))
- return file_get_contents("$d/$lang/$b");
-
- $theme = current_theme();
-
- if(file_exists("$d/theme/$theme/$b"))
- return file_get_contents("$d/theme/$theme/$b");
-
- return file_get_contents($s);
-}}
-
if(! function_exists('get_intltext_template')) {
function get_intltext_template($s) {
- global $lang;
+ global $a;
- if(! isset($lang))
- $lang = 'en';
+ if(! isset($a->language))
+ $a->language = 'en';
- if(file_exists("view/$lang/$s"))
- return file_get_contents("view/$lang/$s");
+ if(file_exists("view/{$a->language}/$s"))
+ return file_get_contents("view/{$a->language}/$s");
elseif(file_exists("view/en/$s"))
return file_get_contents("view/en/$s");
else
@@ -1117,7 +1094,7 @@ function unamp($s) {
if(! function_exists('lang_selector')) {
function lang_selector() {
- global $lang;
+ global $a;
$langs = glob('view/*/strings.php');
@@ -1136,7 +1113,7 @@ function lang_selector() {
}
$ll = substr($l,5);
$ll = substr($ll,0,strrpos($ll,'/'));
- $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? $ll : $selected);
+ $selected = (($ll === $a->language && (x($_SESSION, 'language'))) ? $ll : $selected);
$lang_options[$ll]=$ll;
}
}
diff --git a/index.php b/index.php
index 35f10239d..bd88da68d 100644
--- a/index.php
+++ b/index.php
@@ -27,9 +27,9 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
@include(".htconfig.php");
-$a->language = $lang = get_best_language();
+$a->language = get_best_language();
-load_translation_table($lang);
+load_translation_table($a->language);
/**
*
@@ -81,8 +81,8 @@ if(array_key_exists('system_language',$_POST)) {
unset($_SESSION['language']);
}
if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
- $lang = $_SESSION['language'];
- load_translation_table($lang);
+ $a->language = $_SESSION['language'];
+ load_translation_table($a->language);
}
if((x($_GET,'zrl')) && (! $install)) {
diff --git a/version.inc b/version.inc
index 09e05beee..d16fcf9ac 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2012-08-11.43
+2012-08-12.44