]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
change language dynamically - bound to F8 key
[friendica.git] / boot.php
index f1e02901108daf2e7d0210a5f6c3b6c8d9288da1..8a2706252a6996062ff8e877d7f9b569c4247aaa 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -2,8 +2,8 @@
 
 set_time_limit(0);
 
-define ( 'FRIENDIKA_VERSION',      '2.1.929' );
-define ( 'DFRN_PROTOCOL_VERSION',  '2.1'  );
+define ( 'FRIENDIKA_VERSION',      '2.1.934' );
+define ( 'DFRN_PROTOCOL_VERSION',  '2.2'  );
 define ( 'DB_UPDATE_VERSION',      1045   );
 
 define ( 'EOL',                    "<br />\r\n"     );
@@ -352,10 +352,12 @@ class App {
 
        function init_pagehead() {
                $this->page['title'] = $this->config['sitename'];
-               $tpl = load_view_file("view/head.tpl");
+               $tpl = load_view_file('view/head.tpl');
                $this->page['htmlhead'] = replace_macros($tpl,array(
                        '$baseurl' => $this->get_baseurl() . '/',
-                       '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION
+                       '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION,
+                       '$delitem' => t('Delete this item?'),
+                       '$comment' => t('Comment')
                ));
        }
 
@@ -1068,6 +1070,7 @@ function paginate(&$a) {
        $stripped = preg_replace('/(&page=[0-9]*)/','',$a->query_string);
        $stripped = str_replace('q=','',$stripped);
        $stripped = trim($stripped,'/');
+       $pagenum = $a->pager['page'];
        $url = $a->get_baseurl() . '/' . $stripped;
 
 
@@ -1080,7 +1083,7 @@ function paginate(&$a) {
 
                $numpages = $a->pager['total'] / $a->pager['itemspage'];
 
-               $numstart = 1;
+                       $numstart = 1;
                $numstop = $numpages;
 
                if($numpages > 14) {
@@ -2666,3 +2669,23 @@ function extract_item_authors($arr,$uid) {
        }
        return array();         
 }}
+
+if(! function_exists('lang_selector')) {
+function lang_selector() {
+       global $lang;
+       $o .= '<div id="language-selector" style="display: none;" >';
+       $o .= '<form action="" method="post" ><select name="system_language" onchange="this.form.submit();" >';
+       $langs = glob('view/*/strings.php');
+       if(is_array($langs) && count($langs)) {
+               if(! in_array('view/en/strings.php',$langs))
+                       $langs[] = 'view/en/';
+               foreach($langs as $l) {
+                       $ll = substr($l,5);
+                       $ll = substr($ll,0,strrpos($ll,'/'));
+                       $selected = (($ll === $lang) ? ' selected="selected" ' : '');
+                       $o .= '<option value="' . $ll . '"' . $selected . '>' . $ll . '</option>';
+               }
+       }
+       $o .= '</select></form></div>';
+       return $o;
+}}