aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boot.php7
-rw-r--r--include/js_strings.php30
-rw-r--r--include/plugin.php26
-rw-r--r--include/text.php36
-rw-r--r--index.php25
-rw-r--r--js/main.js113
-rw-r--r--version.inc2
-rw-r--r--view/tpl/head.tpl102
-rw-r--r--view/tpl/js_strings.tpl31
9 files changed, 196 insertions, 176 deletions
diff --git a/boot.php b/boot.php
index 30d49539c..88b31efc8 100644
--- a/boot.php
+++ b/boot.php
@@ -749,9 +749,14 @@ if(! function_exists('check_config')) {
// than the currently visited url, store the current value accordingly.
// "Radically different" ignores common variations such as http vs https
// and www.example.com vs example.com.
+ // We will only change the url to an ip address if there is no existing setting
- if((! x($url)) || (! link_compare($url,$a->get_baseurl())))
+ if(! x($url))
$url = set_config('system','url',$a->get_baseurl());
+ if((! link_compare($url,$a->get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname)))
+ $url = set_config('system','url',$a->get_baseurl());
+
+
if($build != DB_UPDATE_VERSION) {
$stored = intval($build);
diff --git a/include/js_strings.php b/include/js_strings.php
new file mode 100644
index 000000000..8de789b33
--- /dev/null
+++ b/include/js_strings.php
@@ -0,0 +1,30 @@
+<?php
+
+function js_strings() {
+ return replace_macros(get_markup_template('js_strings.tpl'), array(
+ '$delitem' => t('Delete this item?'),
+ '$comment' => t('Comment'),
+ '$showmore' => t('show more'),
+ '$showfewer' => t('show fewer'),
+
+ '$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : 'null'),
+ '$t02' => ((t('timeago.suffixAgo') != 'timeago.suffixAgo') ? t('timeago.suffixAgo') : 'null'),
+ '$t03' => t('ago'),
+ '$t04' => t('from now'),
+ '$t05' => t('less than a minute'),
+ '$t06' => t('about a minute'),
+ '$t07' => t('%d minutes'),
+ '$t08' => t('about an hour'),
+ '$t09' => t('about %d hours'),
+ '$t10' => t('a day'),
+ '$t11' => t('%d days'),
+ '$t12' => t('about a month'),
+ '$t13' => t('%d months'),
+ '$t14' => t('about a year'),
+ '$t15' => t('%d years'),
+ '$t16' => t(' '), // wordSeparator
+ '$t17' => ((t('timeago.numbers') != 'timeago.numbers') ? t('timeago.numbers') : '[]')
+
+
+ ));
+} \ No newline at end of file
diff --git a/include/plugin.php b/include/plugin.php
index 2460e8ad6..9555268f7 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -485,3 +485,29 @@ function theme_include($file) {
}
return '';
}
+
+
+
+if(! function_exists('get_intltext_template')) {
+function get_intltext_template($s) {
+ global $a;
+
+ if(! isset($a->language))
+ $a->language = 'en';
+
+ 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
+ return file_get_contents("view/$s");
+}}
+
+if(! function_exists('get_markup_template')) {
+function get_markup_template($s) {
+
+ $x = theme_include($s);
+ if($x)
+ return file_get_contents($x);
+}}
+
diff --git a/include/text.php b/include/text.php
index bddded7ee..f6c403388 100644
--- a/include/text.php
+++ b/include/text.php
@@ -387,42 +387,6 @@ function photo_new_resource() {
}}
-if(! function_exists('get_intltext_template')) {
-function get_intltext_template($s) {
- global $a;
-
- if(! isset($a->language))
- $a->language = 'en';
-
- 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
- return file_get_contents("view/$s");
-}}
-
-if(! function_exists('get_markup_template')) {
-function get_markup_template($s) {
- $a=get_app();
- $theme = current_theme();
-
- if(file_exists("view/theme/$theme/tpl/$s"))
- return file_get_contents("view/theme/$theme/tpl/$s");
- elseif(file_exists("view/theme/$theme/$s"))
- return file_get_contents("view/theme/$theme/$s");
- elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/tpl/$s"))
- return file_get_contents("view/theme/".$a->theme_info["extends"]."/tpl/$s");
- elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/$s"))
- return file_get_contents("view/theme/".$a->theme_info["extends"]."/$s");
- elseif(file_exists("view/tpl/$s"))
- return file_get_contents("view/tpl/$s");
- else
- return file_get_contents("view/$s");
-
-}}
-
-
diff --git a/index.php b/index.php
index bd88da68d..15458e631 100644
--- a/index.php
+++ b/index.php
@@ -324,6 +324,7 @@ if($a->module != 'install') {
require_once(theme_include('theme_init.php'));
+require_once('include/js_strings.php');
head_add_css(((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.css');
head_add_css('mod_' . $a->module . '.css');
@@ -350,29 +351,7 @@ head_add_js('mod_' . $a->module . '.js');
'$update_interval' => $interval,
'$head_css' => head_get_css(),
'$head_js' => head_get_js(),
-
-
-// localisations for jquery.timeago.js, see https://github.com/rmm5t/jquery-timeago
-// TRANSLATORS - only translate the conditionals if you require them!
-
- '$t01' => ((t('timeago.prefixAgo') != 'timeago.prefixAgo') ? t('timeago.prefixAgo') : 'null'),
- '$t02' => ((t('timeago.suffixAgo') != 'timeago.suffixAgo') ? t('timeago.suffixAgo') : 'null'),
- '$t03' => t('ago'),
- '$t04' => t('from now'),
- '$t05' => t('less than a minute'),
- '$t06' => t('about a minute'),
- '$t07' => t('%d minutes'),
- '$t08' => t('about an hour'),
- '$t09' => t('about %d hours'),
- '$t10' => t('a day'),
- '$t11' => t('%d days'),
- '$t12' => t('about a month'),
- '$t13' => t('%d months'),
- '$t14' => t('about a year'),
- '$t15' => t('%d years'),
- '$t16' => t(' '), // wordSeparator
- '$t17' => ((t('timeago.numbers') != 'timeago.numbers') ? t('timeago.numbers') : '[]')
-
+ '$js_strings' => js_strings()
));
$page = $a->page;
diff --git a/js/main.js b/js/main.js
index b31261065..b1ebd80e0 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,4 +1,83 @@
+ function confirmDelete() { return confirm(aStr['delitem']); }
+ function commentOpen(obj,id) {
+ if(obj.value == aStr['comment']) {
+ obj.value = '';
+ $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
+ $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
+ $("#mod-cmnt-wrap-" + id).show();
+ openMenu("comment-edit-submit-wrapper-" + id);
+ return true;
+ }
+ return false;
+ }
+ function commentClose(obj,id) {
+ if(obj.value == '') {
+ obj.value = aStr['comment'];
+ $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
+ $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
+ $("#mod-cmnt-wrap-" + id).hide();
+ closeMenu("comment-edit-submit-wrapper-" + id);
+ return true;
+ }
+ return false;
+ }
+
+ function showHideCommentBox(id) {
+ if( $('#comment-edit-form-' + id).is(':visible')) {
+ $('#comment-edit-form-' + id).hide();
+ }
+ else {
+ $('#comment-edit-form-' + id).show();
+ }
+ }
+
+
+ function commentInsert(obj,id) {
+ var tmpStr = $("#comment-edit-text-" + id).val();
+ if(tmpStr == '$comment') {
+ tmpStr = '';
+ $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
+ $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
+ openMenu("comment-edit-submit-wrapper-" + id);
+ }
+ var ins = $(obj).html();
+ ins = ins.replace('&lt;','<');
+ ins = ins.replace('&gt;','>');
+ ins = ins.replace('&amp;','&');
+ ins = ins.replace('&quot;','"');
+ $("#comment-edit-text-" + id).val(tmpStr + ins);
+ }
+
+ function qCommentInsert(obj,id) {
+ var tmpStr = $("#comment-edit-text-" + id).val();
+ if(tmpStr == aStr['comment']) {
+ tmpStr = '';
+ $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
+ $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
+ openMenu("comment-edit-submit-wrapper-" + id);
+ }
+ var ins = $(obj).val();
+ ins = ins.replace('&lt;','<');
+ ins = ins.replace('&gt;','>');
+ ins = ins.replace('&amp;','&');
+ ins = ins.replace('&quot;','"');
+ $("#comment-edit-text-" + id).val(tmpStr + ins);
+ $(obj).val('');
+ }
+
+ function showHideComments(id) {
+ if( $('#collapsed-comments-' + id).is(':visible')) {
+ $('#collapsed-comments-' + id).hide();
+ $('#hide-comments-' + id).html(aStr['showmore']);
+ }
+ else {
+ $('#collapsed-comments-' + id).show();
+ $('#hide-comments-' + id).html(aStr['showfewer']);
+ }
+ }
+
+
function openClose(theID) {
if(document.getElementById(theID).style.display == "block") {
document.getElementById(theID).style.display = "none"
@@ -745,23 +824,23 @@ function previewTheme(elm) {
$(document).ready(function() {
jQuery.timeago.settings.strings = {
- prefixAgo: tago01,
- prefixFromNow: tago02,
- suffixAgo: tago03,
- suffixFromNow: tago04,
- seconds: tago05,
- minute: tago06,
- minutes: tago07,
- hour: tago08,
- hours: tago09,
- day: tago10,
- days: tago11,
- month: tago12,
- months: tago13,
- year: tago14,
- years: tago15,
- wordSeparator: tago16,
- numbers: tago17
+ prefixAgo : aStr['t01'],
+ prefixFromNow : aStr['t02'],
+ suffixAgo : aStr['t03'],
+ suffixFromNow : aStr['t04'],
+ seconds : aStr['t05'],
+ minute : aStr['t06'],
+ minutes : aStr['t07'],
+ hour : aStr['t08'],
+ hours : aStr['t09'],
+ day : aStr['t10'],
+ days : aStr['t11'],
+ month : aStr['t12'],
+ months : aStr['t13'],
+ year : aStr['t14'],
+ years : aStr['t15'],
+ wordSeparator : aStr['t16'],
+ numbers : aStr['t17'],
};
diff --git a/version.inc b/version.inc
index d16fcf9ac..ecc830b90 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2012-08-12.44
+2012-08-13.45
diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl
index ba2850c0e..c12871924 100644
--- a/view/tpl/head.tpl
+++ b/view/tpl/head.tpl
@@ -8,6 +8,8 @@
$head_css
+$js_strings
+
$head_js
<link rel="shortcut icon" href="$baseurl/images/friendica-32.png" />
@@ -16,109 +18,13 @@ $head_js
type="application/opensearchdescription+xml"
title="Search in Friendica" />
+
<script>
var updateInterval = $update_interval;
var localUser = {{ if $local_user }}$local_user{{ else }}false{{ endif }};
- function confirmDelete() { return confirm("$delitem"); }
- function commentOpen(obj,id) {
- if(obj.value == '$comment') {
- obj.value = '';
- $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
- $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
- $("#mod-cmnt-wrap-" + id).show();
- openMenu("comment-edit-submit-wrapper-" + id);
- return true;
- }
- return false;
- }
- function commentClose(obj,id) {
- if(obj.value == '') {
- obj.value = '$comment';
- $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
- $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
- $("#mod-cmnt-wrap-" + id).hide();
- closeMenu("comment-edit-submit-wrapper-" + id);
- return true;
- }
- return false;
- }
-
- function showHideCommentBox(id) {
- if( $('#comment-edit-form-' + id).is(':visible')) {
- $('#comment-edit-form-' + id).hide();
- }
- else {
- $('#comment-edit-form-' + id).show();
- }
- }
-
-
- function commentInsert(obj,id) {
- var tmpStr = $("#comment-edit-text-" + id).val();
- if(tmpStr == '$comment') {
- tmpStr = '';
- $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
- $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
- openMenu("comment-edit-submit-wrapper-" + id);
- }
- var ins = $(obj).html();
- ins = ins.replace('&lt;','<');
- ins = ins.replace('&gt;','>');
- ins = ins.replace('&amp;','&');
- ins = ins.replace('&quot;','"');
- $("#comment-edit-text-" + id).val(tmpStr + ins);
- }
-
- function qCommentInsert(obj,id) {
- var tmpStr = $("#comment-edit-text-" + id).val();
- if(tmpStr == '$comment') {
- tmpStr = '';
- $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
- $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
- openMenu("comment-edit-submit-wrapper-" + id);
- }
- var ins = $(obj).val();
- ins = ins.replace('&lt;','<');
- ins = ins.replace('&gt;','>');
- ins = ins.replace('&amp;','&');
- ins = ins.replace('&quot;','"');
- $("#comment-edit-text-" + id).val(tmpStr + ins);
- $(obj).val('');
- }
-
- function showHideComments(id) {
- if( $('#collapsed-comments-' + id).is(':visible')) {
- $('#collapsed-comments-' + id).hide();
- $('#hide-comments-' + id).html('$showmore');
- }
- else {
- $('#collapsed-comments-' + id).show();
- $('#hide-comments-' + id).html('$showfewer');
- }
- }
-
- // jquery.timeago localisations
-
- var tago01 = $t01 ;
- var tago02 = $t02 ;
- var tago03 = "$t03" ;
- var tago04 = "$t04" ;
- var tago05 = "$t05" ;
- var tago06 = "$t06" ;
- var tago07 = "$t07" ;
- var tago08 = "$t08" ;
- var tago09 = "$t09" ;
- var tago10 = "$t10" ;
- var tago11 = "$t11" ;
- var tago12 = "$t12" ;
- var tago13 = "$t13" ;
- var tago14 = "$t14" ;
- var tago15 = "$t15" ;
- var tago16 = "$t16" ;
- var tago17 = $t17 ;
-
</script>
+
diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl
new file mode 100644
index 000000000..db3bb7d7c
--- /dev/null
+++ b/view/tpl/js_strings.tpl
@@ -0,0 +1,31 @@
+
+<script>
+
+ var aStr = {
+
+ 'delitem' : '$delitem',
+ 'comment' : '$comment',
+ 'showmore' : '$showmore',
+ 'showfewer' : '$showfewer',
+
+ 't01' : $t01,
+ 't02' : $t02,
+ 't03' : '$t03',
+ 't04' : '$t04',
+ 't05' : '$t05',
+ 't06' : '$t06',
+ 't07' : '$t07',
+ 't08' : '$t08',
+ 't09' : '$t09',
+ 't10' : '$t10',
+ 't11' : '$t11',
+ 't12' : '$t12',
+ 't13' : '$t13',
+ 't14' : '$t14',
+ 't15' : '$t15',
+ 't16' : '$t16',
+ 't17' : '$t17',
+ };
+
+</script>
+