]> git.mxchange.org Git - friendica.git/blobdiff - mod/search.php
adding desaturation and transition for forumlist widget
[friendica.git] / mod / search.php
index 4144e2608f91f6b9bb7a44b4e5c4fd6a4e3bb1bd..4a911b4fd9828a51aaf05459bdad0dfc67174c15 100644 (file)
@@ -18,7 +18,6 @@ use Friendica\Module\BaseSearchModule;
 use Friendica\Util\Strings;
 
 function search_saved_searches() {
-
        $o = '';
        $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
 
@@ -50,12 +49,10 @@ function search_saved_searches() {
        }
 
        return $o;
-
 }
 
 
 function search_init(App $a) {
-
        $search = (!empty($_GET['search']) ? Strings::escapeTags(trim(rawurldecode($_GET['search']))) : '');
 
        if (local_user()) {
@@ -83,13 +80,9 @@ function search_init(App $a) {
                unset($_SESSION['theme']);
                unset($_SESSION['mobile-theme']);
        }
-
-
-
 }
 
 function search_content(App $a) {
-
        if (Config::get('system','block_public') && !local_user() && !remote_user()) {
                notice(L10n::t('Public access denied.') . EOL);
                return;
@@ -154,6 +147,16 @@ function search_content(App $a) {
                return BaseSearchModule::performSearch();
        }
 
+       if (parse_url($search, PHP_URL_SCHEME) != '') {
+               $id = Item::fetchByLink($search);
+               if (!empty($id)) {
+                       $item = Item::selectFirst(['guid'], ['id' => $id]);
+                       if (DBA::isResult($item)) {
+                               $a->internalRedirect('display/' . $item['guid']);
+                       }
+               }
+       }
+
        if (!empty($_GET['search-option']))
                switch($_GET['search-option']) {
                        case 'fulltext':
@@ -186,7 +189,7 @@ function search_content(App $a) {
                $condition = ["(`uid` = 0 OR (`uid` = ? AND NOT `global`))
                        AND `otype` = ? AND `type` = ? AND `term` = ?",
                        local_user(), TERM_OBJ_POST, TERM_HASHTAG, $search];
-               $params = ['order' => ['created' => true],
+               $params = ['order' => ['received' => true],
                        'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
                $terms = DBA::select('term', ['oid'], $condition, $params);