]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #1426 from annando/1503-term-search
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 12 Mar 2015 06:15:05 +0000 (07:15 +0100)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 12 Mar 2015 06:15:05 +0000 (07:15 +0100)
The index for the term search is now massively improved

boot.php
include/items.php
mod/contacts.php
view/templates/vcard-widget.tpl
view/theme/vier/screenshot.png

index c44465b10cabddf783c15e8073654140e41617bb..5a5437175ef26a9cdd26d541b41be75b23a6096a 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1196,35 +1196,24 @@ if(! function_exists('check_plugins')) {
        }
 }
 
-function get_guid($size=16) {
-       $exists = true; // assume by default that we don't have a unique guid
-       do {
-               $prefix = "";
-               while (strlen($prefix) < ($size - 13))
-                       $prefix .= mt_rand();
-
-               $s = substr(uniqid($prefix), -$size);
-
-               $r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
-               if(! count($r))
-                       $exists = false;
-       } while($exists);
-       q("insert into guid (guid) values ('%s') ", dbesc($s));
-       return $s;
-}
+function get_guid($size=16, $prefix = "") {
 
-/*function get_guid($size=16) {
-       $exists = true; // assume by default that we don't have a unique guid
-       do {
-               $s = random_string($size);
-               $r = q("select id from guid where guid = '%s' limit 1", dbesc($s));
-               if(! count($r))
-                       $exists = false;
-       } while($exists);
-       q("insert into guid ( guid ) values ( '%s' ) ", dbesc($s));
-       return $s;
-}*/
+       if ($prefix == "") {
+               $a = get_app();
+               $prefix = hash("crc32", $a->get_hostname());
+       }
 
+       while (strlen($prefix) < ($size - 13))
+               $prefix .= mt_rand();
+
+       if ($size >= 24) {
+               $prefix = substr($prefix, 0, $size - 22);
+               return(str_replace(".", "", uniqid($prefix, true)));
+       } else {
+               $prefix = substr($prefix, 0, $size - 13);
+               return(uniqid($prefix));
+       }
+}
 
 // wrapper for adding a login box. If $register == true provide a registration
 // link. This will most always depend on the value of $a->config['register_policy'].
index 3ec476ad6bab9ea1aaa69609dcc3f42cbfbdc731..95ff40714f0e2d2809130ddcc3334909e85b21cd 100644 (file)
@@ -1210,8 +1210,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        $arr['attach']        = ((x($arr,'attach'))        ? notags(trim($arr['attach']))        : '');
        $arr['app']           = ((x($arr,'app'))           ? notags(trim($arr['app']))           : '');
        $arr['origin']        = ((x($arr,'origin'))        ? intval($arr['origin'])              : 0 );
-       $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(30));
        $arr['network']       = ((x($arr,'network'))       ? trim($arr['network'])               : '');
+       $arr['guid']          = ((x($arr,'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $arr['network']));
        $arr['postopts']      = ((x($arr,'postopts'))      ? trim($arr['postopts'])              : '');
        $arr['resource-id']   = ((x($arr,'resource-id'))   ? trim($arr['resource-id'])           : '');
        $arr['event-id']      = ((x($arr,'event-id'))      ? intval($arr['event-id'])            : 0 );
index a3263f39599bbce886c5b444f8ab036edaef6597..570672d4ea97176435791b1a11325f613450bf2c 100644 (file)
@@ -32,7 +32,8 @@ function contacts_init(&$a) {
                        $a->data['contact'] = $r[0];
                        $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
                                '$name' => $a->data['contact']['name'],
-                               '$photo' => $a->data['contact']['photo']
+                               '$photo' => $a->data['contact']['photo'],
+                               '$url' => $a->data['contact']['url']
                        ));
                        $follow_widget = '';
        }
index 983a8e9e3fe2de90ef21141d13b95be2edcdaa95..bc1a571bea5adb619b39f8ff97a24dda3ecf1bb3 100644 (file)
@@ -1,6 +1,6 @@
 
        <div class="vcard">
-               <div class="fn">{{$name}}</div>
-               <div id="profile-photo-wrapper"><img class="photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
+               <div class="fn"><a href="{{$url}}">{{$name}}</a></div>
+               <div id="profile-photo-wrapper"><a href="{{$url}}"><img class="photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></a></div>
        </div>
 
index 224f6a03b4fb1c4f1e56eace559dd2e7df585d87..352b0b09faf8050fe9b0f13eec73993e434b9ab6 100644 (file)
Binary files a/view/theme/vier/screenshot.png and b/view/theme/vier/screenshot.png differ