]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
file attachments
[friendica.git] / boot.php
index eb70dd8f601775065907f3495e92d95a6817be3c..25c7fd14d0cbc29919ebe00e8c21fbfe4dc8ac2c 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.979' );
+define ( 'FRIENDIKA_VERSION',      '2.2.990' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1054      );
+define ( 'DB_UPDATE_VERSION',      1058      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
@@ -1007,6 +1007,13 @@ function notice($s) {
        if($a->interactive)
                $_SESSION['sysmsg'] .= $s;
 }}
+if(! function_exists('info')) {
+function info($s) {
+       $a = get_app();
+       if($a->interactive)
+               $_SESSION['sysmsg_info'] .= $s;
+}}
+
 
 // wrapper around config to limit the text length of an incoming message
 
@@ -1508,6 +1515,8 @@ function lrdd($uri) {
        logger('lrdd: host_meta: ' . $xml, LOGGER_DATA);
 
        $h = parse_xml_string($xml);
+       if(! $h)
+               return array();
 
        $arr = convert_xml_element_to_array($h);
 
@@ -1672,6 +1681,9 @@ function fetch_xrd_links($url) {
 
        logger('fetch_xrd_links: ' . $xml, LOGGER_DATA);
        $h = parse_xml_string($xml);
+       if(! $h)
+               return array();
+
        $arr = convert_xml_element_to_array($h);
 
        $links = array();
@@ -1971,15 +1983,15 @@ function get_tags($s) {
        $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
 
        if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) {
-               foreach($match[1] as $match) {
-                       if(strstr($match,"]")) {
+               foreach($match[1] as $mtch) {
+                       if(strstr($mtch,"]")) {
                                // we might be inside a bbcode color tag - leave it alone
                                continue;
                        }
-                       if(substr($match,-1,1) === '.')
-                               $ret[] = substr($match,0,-1);
+                       if(substr($mtch,-1,1) === '.')
+                               $ret[] = substr($mtch,0,-1);
                        else
-                               $ret[] = $match;
+                               $ret[] = $mtch;
                }
        }
 
@@ -2349,6 +2361,10 @@ function profile_sidebar($profile) {
 
        $homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
 
+       if($profile['hidewall'] && (! local_user()) && (! remote_user())) {
+               $location = $gender = $marital = $homepage = '';
+       }
+
        $tpl = get_markup_template('profile_vcard.tpl');
 
        $o .= replace_macros($tpl, array(
@@ -2524,8 +2540,41 @@ function link_compare($a,$b) {
 
 
 if(! function_exists('prepare_body')) {
-function prepare_body($item) {
-       return prepare_text($item['body']);
+function prepare_body($item,$attach = false) {
+
+       $s = prepare_text($item['body']);
+       if(! $attach)
+               return $s;
+
+       $arr = explode(',',$item['attach']);
+       $s .= '<div class="body-attach">';
+       if(count($arr)) {
+               foreach($arr as $r) {
+                       $matches = false;
+                       $icon = '';
+                       $cnt = preg_match('|\[attach\]href=\"(.+?)\" size=\"(.+?)\" type=\"(.+?)\" title=\"(.+?)\"\[\/attach\]|',$r,$matches);
+                       if($cnt) {
+                               $icontype = strtolower(substr($matches[3],0,strpos($matches[3],'/')));
+                               switch($icontype) {
+                                       case 'video':
+                                       case 'audio':
+                                       case 'image':
+                                       case 'text':
+                                               $icon = '<div class="attachtype type-' . $icontype . '"></div>';
+                                               break;
+                                       default:
+                                               $icon = '<div class="attachtype type-unkn"></div>';
+                                               break;
+                               }
+                               $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1]));
+                               $title .= ' ' . $matches[2] . ' ' . t('bytes');
+
+                               $s .= '<a href="' . strip_tags($matches[1]) . '" title="' . $title . '" class="attachlink" target="external-link" >' . $icon . '</a>';
+                       }
+               }
+       }
+       $s .= '<div class="clear"></div></div>';
+       return $s;
 }}
 
 if(! function_exists('prepare_text')) {
@@ -2702,6 +2751,8 @@ function unamp($s) {
 }}
 
 
+
+
 if(! function_exists('lang_selector')) {
 function lang_selector() {
        global $lang;
@@ -2736,3 +2787,12 @@ function parse_xml_string($s) {
        libxml_clear_errors();
        return $x;
 }}
+
+if(! function_exists('is_site_admin')) {
+function is_site_admin() {
+       $a = get_app();
+       if(local_user() && x($a->user,'email') && x($a->config,'admin_email') && ($a->user['email'] === $a->config['admin_email']))
+               return true;
+       return false;
+}}
+