]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
rework autocomplete: some cleanup and docu
[friendica.git] / include / text.php
index 89a58cccc07f5b8e381f93f363907e8e17d61b75..fc5e79294f261bfbe1942b42a7daad69f46f3aeb 100644 (file)
@@ -20,10 +20,10 @@ function replace_macros($s,$r) {
        $stamp1 = microtime(true);
 
        $a = get_app();
-       
+
        // pass $baseurl to all templates
        $r['$baseurl'] = z_root();
-       
+
 
        $t = $a->template_engine();
        try {
@@ -895,9 +895,9 @@ function contact_block() {
                $micropro = Null;
 
        } else {
-               $r = q("SELECT * FROM `contact`
-                               WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0
-                                       AND `hidden` = 0 AND `archive` = 0
+               $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `micro`, `network` FROM `contact`
+                               WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending`
+                                       AND NOT `hidden` AND NOT `archive`
                                AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d",
                                intval($a->profile['uid']),
                                dbesc(NETWORK_DFRN),
@@ -1415,7 +1415,14 @@ function prepare_body(&$item,$attach = false, $preview = false) {
        $item['hashtags'] = $hashtags;
        $item['mentions'] = $mentions;
 
-       put_item_in_cache($item, true);
+       // Update the cached values if there is no "zrl=..." on the links
+       $update = (!local_user() and !remote_user() and ($item["uid"] == 0));
+
+       // Or update it if the current viewer is the intented viewer
+       if (($item["uid"] == local_user()) AND ($item["uid"] != 0))
+               $update = true;
+
+       put_item_in_cache($item, $update);
        $s = $item["rendered-html"];
 
        $prep_arr = array('item' => $item, 'html' => $s, 'preview' => $preview);
@@ -2288,37 +2295,6 @@ function formatBytes($bytes, $precision = 2) {
        return round($bytes, $precision) . ' ' . $units[$pow];
 }
 
-/**
- * @brief Translate the PAGE type flags in human readable string
- * 
- * @param int $page_type
- * @return string $trans_type
- */
-function page_type_translate($page_type) {
-
-       // ToDo: we need a good interpretable translation for PAGE_SOAPBOX
-       // and PAGE_PRVGROUP
-       switch ($page_type) {
-               case PAGE_NORMAL:
-                       $trans_type = t('Normal Account');
-                       break;
-               case PAGE_SOAPBOX:
-                       $trans_type = t('Fan Page');
-                       break;
-               case PAGE_COMMUNITY:
-                       $trans_type = t('Community Forum');
-                       break;
-               case PAGE_FREELOVE:
-                       $trans_type = t('Open Forum');
-                       break;
-               case PAGE_PRVGROUP:
-                       $trans_type = t('Private Forum');
-                       break;
-       }
-
-       return $trans_type;
-}
-
 /**
  * @brief translate and format the networkname of a contact
  *