]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
use icon for language selector instead of hotkey
[friendica.git] / boot.php
index 79e520150a52476772560b965c01c70a7ea7d8ac..a67b96a085ca114371e66237144e96062f764a61 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -4,9 +4,9 @@ set_time_limit(0);
 ini_set('pcre.backtrack_limit', 250000);
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.991' );
+define ( 'FRIENDIKA_VERSION',      '2.2.1002' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1058      );
+define ( 'DB_UPDATE_VERSION',      1060      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -481,17 +481,26 @@ function check_config(&$a) {
                $stored = intval($build);
                $current = intval(DB_UPDATE_VERSION);
                if(($stored < $current) && file_exists('update.php')) {
+
                        // We're reporting a different version than what is currently installed.
                        // Run any existing update scripts to bring the database up to current.
 
                        require_once('update.php');
-                       for($x = $stored; $x < $current; $x ++) {
-                               if(function_exists('update_' . $x)) {
-                                       $func = 'update_' . $x;
-                                       $func($a);
+
+                       // make sure that boot.php and update.php are the same release, we might be
+                       // updating right this very second and the correct version of the update.php
+                       // file may not be here yet. This can happen on a very busy site.
+
+                       if(DB_UPDATE_VERSION == UPDATE_VERSION) {
+
+                               for($x = $stored; $x < $current; $x ++) {
+                                       if(function_exists('update_' . $x)) {
+                                               $func = 'update_' . $x;
+                                               $func($a);
+                                       }
                                }
+                               set_config('system','build', DB_UPDATE_VERSION);
                        }
-                       set_config('system','build', DB_UPDATE_VERSION);
                }
        }
 
@@ -682,7 +691,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
                $s = substr($s,strlen($header)+4);
                $header = substr($s,0,strpos($s,"\r\n\r\n"));
        }
-       if($http_code == 301 || $http_code == 302 || $http_code == 303) {
+       if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) {
         $matches = array();
         preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
         $url = trim(array_pop($matches));
@@ -2106,10 +2115,10 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
 
 
 if(! function_exists('search')) {
-function search($s) {
+function search($s,$id='search-box',$url='/search') {
        $a = get_app();
-       $o  = '<div id="search-box">';
-       $o .= '<form action="' . $a->get_baseurl() . '/search' . '" method="get" >';
+       $o  = '<div id="' . $id . '">';
+       $o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >';
        $o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />';
        $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; 
        $o .= '</form></div>';
@@ -2196,12 +2205,13 @@ function smilies($s) {
        $a = get_app();
 
        return str_replace(
-       array( '&lt;3', '&lt;/3', '&lt;\\3', ':-)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
+       array( '&lt;3', '&lt;/3', '&lt;\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O'),
        array(
                '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":-)" />',
+               '<img src="' . $a->get_baseurl() . '/images/smiley-smile.gif" alt=":)" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-wink.gif" alt=";-)" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":-(" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-frown.gif" alt=":(" />',
@@ -2547,8 +2557,8 @@ function prepare_body($item,$attach = false) {
                return $s;
 
        $arr = explode(',',$item['attach']);
-       $s .= '<div class="body-attach">';
        if(count($arr)) {
+               $s .= '<div class="body-attach">';
                foreach($arr as $r) {
                        $matches = false;
                        $icon = '';
@@ -2572,8 +2582,8 @@ function prepare_body($item,$attach = false) {
                                $s .= '<a href="' . strip_tags($matches[1]) . '" title="' . $title . '" class="attachlink" target="external-link" >' . $icon . '</a>';
                        }
                }
+               $s .= '<div class="clear"></div></div>';
        }
-       $s .= '<div class="clear"></div></div>';
        return $s;
 }}
 
@@ -2756,6 +2766,7 @@ function unamp($s) {
 if(! function_exists('lang_selector')) {
 function lang_selector() {
        global $lang;
+       $o .= '<div id="lang-select-icon" class="icon language" title="' . t('Select an alternate language') . '" onclick="openClose(\'language-selector\');" ></div>';
        $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');