]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/theme.php
Merge pull request #5823 from annando/ap-attach
[friendica.git] / view / theme / frio / theme.php
index 9d2b77d1f1a2796436792f48c88afa964ee66317..72e5ab0b6140b693464ec8d8170e19281d008bdd 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Name: frio
  * Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>.
- * Version: V.0.8
+ * Version: V.0.8.5
  * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
  *
  */
@@ -15,7 +15,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
-use Friendica\Database\DBM;
+use Friendica\Database\DBA;
 use Friendica\Model\Profile;
 
 $frio = 'view/theme/frio';
@@ -150,8 +150,18 @@ function frio_item_photo_menu(App $a, &$arr)
 function frio_contact_photo_menu(App $a, &$args)
 {
        $cid = $args['contact']['id'];
-       $pokelink = $args['menu']['poke'][1];
-       $pmlink = $args['menu']['pm'][1];
+
+       if (!empty($args['menu']['poke'])) {
+               $pokelink = $args['menu']['poke'][1];
+       } else {
+               $pokelink = '';
+       }
+
+       if (!empty($args['menu']['poke'])) {
+               $pmlink = $args['menu']['pm'][1];
+       } else {
+               $pmlink = '';
+       }
 
        // Set the the indicator for opening the status, profile and photo pages
        // in a new tab to false if the contact a dfrn (friendica) contact
@@ -231,7 +241,7 @@ function frio_remote_nav($a, &$nav)
                // user info
                $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self`", intval($a->user['uid']));
 
-               $r[0]['photo'] = (DBM::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg');
+               $r[0]['photo'] = (DBA::isResult($r) ? $a->remove_baseurl($r[0]['micro']) : 'images/person-48.jpg');
                $r[0]['name'] = $a->user['username'];
        } elseif (!local_user() && remote_user()) {
                $r = q("SELECT `name`, `nick`, `micro` AS `photo` FROM `contact` WHERE `id` = %d", intval(remote_user()));
@@ -239,15 +249,15 @@ function frio_remote_nav($a, &$nav)
        } elseif (Profile::getMyURL()) {
                $r = q("SELECT `name`, `nick`, `photo` FROM `gcontact`
                                WHERE `addr` = '%s' AND `network` = 'dfrn'",
-                       dbesc($webbie));
+                       DBA::escape($webbie));
                $nav['remote'] = L10n::t('Visitor');
        } else {
                $r = false;
        }
 
-       if (DBM::is_result($r)) {
+       if (DBA::isResult($r)) {
                $nav['userinfo'] = [
-                       'icon' => (DBM::is_result($r) ? $r[0]['photo'] : 'images/person-48.jpg'),
+                       'icon' => (DBA::isResult($r) ? $r[0]['photo'] : 'images/person-48.jpg'),
                        'name' => $r[0]['name'],
                ];
        }
@@ -268,7 +278,7 @@ function frio_remote_nav($a, &$nav)
                $nav['messages'] = [$server_url . '/message', L10n::t('Messages'), '', L10n::t('Private mail')];
                $nav['settings'] = [$server_url . '/settings', L10n::t('Settings'), '', L10n::t('Account settings')];
                $nav['contacts'] = [$server_url . '/contacts', L10n::t('Contacts'), '', L10n::t('Manage/edit friends and contacts')];
-               $nav['sitename'] = $a->config['sitename'];
+               $nav['sitename'] = Config::get('config', 'sitename');
        }
 }
 
@@ -299,18 +309,18 @@ function frio_acl_lookup(App $a, &$results)
 
        $sql_extra = '';
        if ($results['search']) {
-               $search_txt = dbesc(protect_sprintf(preg_quote($results['search'])));
-               $sql_extra .= " AND (`attag` LIKE '%%" . dbesc($search_txt) . "%%' OR `name` LIKE '%%" . dbesc($search_txt) . "%%' OR `nick` LIKE '%%" . dbesc($search_txt) . "%%') ";
+               $search_txt = DBA::escape(protect_sprintf(preg_quote($results['search'])));
+               $sql_extra .= " AND (`attag` LIKE '%%" . $search_txt . "%%' OR `name` LIKE '%%" . $search_txt . "%%' OR `nick` LIKE '%%" . $search_txt . "%%') ";
        }
 
        if ($nets) {
-               $sql_extra .= sprintf(" AND network = '%s' ", dbesc($nets));
+               $sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
        }
 
        $total = 0;
        $r = q("SELECT COUNT(*) AS `total` FROM `contact`
                WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ", intval($_SESSION['uid']));
-       if (DBM::is_result($r)) {
+       if (DBA::isResult($r)) {
                $total = $r[0]['total'];
        }
 
@@ -322,7 +332,7 @@ function frio_acl_lookup(App $a, &$results)
 
        $contacts = [];
 
-       if (DBM::is_result($r)) {
+       if (DBA::isResult($r)) {
                foreach ($r as $rr) {
                        $contacts[] = _contact_detail_for_template($rr);
                }