]> git.mxchange.org Git - friendica.git/blobdiff - include/identity.php
Merge remote-tracking branch 'upstream/3.5.2rc' into 1705-dbclean-advanced
[friendica.git] / include / identity.php
index d0a670abb75df0c982f15ead930bbd9af1dac9a2..25b24f289b6f8b20198364d7690cf01e56d05d16 100644 (file)
@@ -3,6 +3,8 @@
  * @file include/identity.php
  */
 
+use Friendica\App;
+
 require_once 'include/ForumManager.php';
 require_once 'include/bbcode.php';
 require_once 'mod/proxy.php';
@@ -150,7 +152,9 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
 
        if ($profile) {
                $profile_int = intval($profile);
-               $r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
+               $r = q("SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
+                               `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
+                               `profile`.`uid` AS `profile_uid`, `profile`.*,
                                `contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
                        FROM `profile`
                        INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
@@ -161,7 +165,9 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
                );
        }
        if (!dbm::is_result($r)) {
-               $r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
+               $r = q("SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
+                               `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
+                               `profile`.`uid` AS `profile_uid`, `profile`.*,
                                `contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
                        FROM `profile`
                        INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
@@ -363,9 +369,9 @@ function profile_sidebar($profile, $block = 0) {
                        'fullname' => $profile['name'],
                        'firstname' => $firstname,
                        'lastname' => $lastname,
-                       'photo300' => App::get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
-                       'photo100' => App::get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg',
-                       'photo50' => App::get_baseurl() . '/photo/custom/50/'  . $profile['uid'] . '.jpg',
+                       'photo300' => $profile['contact_photo'],
+                       'photo100' => $profile['contact_thumb'],
+                       'photo50' => $profile['contact_micro'],
                );
        else
                $diaspora = false;
@@ -408,9 +414,9 @@ function profile_sidebar($profile, $block = 0) {
        else
                $p["address"] = bbcode($p["location"]);
 
-       if (isset($p["photo"]))
+       if (isset($p["photo"])) {
                $p["photo"] = proxy_url($p["photo"], false, PROXY_SIZE_SMALL);
-
+       }
        if ($a->theme['template_engine'] === 'internal')
                $location = template_escape($location);
 
@@ -877,7 +883,7 @@ function zrl_init(App $a) {
                $urlparts = parse_url($tmp_str);
 
                $result = Cache::get("gprobe:" . $urlparts["host"]);
-               if (!is_null($result)) && (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
+               if ((!is_null($result)) && (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) {
                        logger("DDoS attempt detected for " . $urlparts["host"] . " by " . $_SERVER["REMOTE_ADDR"] . ". server data: " . print_r($_SERVER, true), LOGGER_DEBUG);
                        return;
                }