]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
- Improved speed due to forced indexes when showing items.
[friendica.git] / mod / profile.php
index 9e9af19834c0b6c89429cdfeb8b73ae9bd60e964..c5f787a4f0792fd33a636a18dffd1be13d1153f9 100644 (file)
@@ -33,7 +33,6 @@ function profile_init(&$a) {
                auto_redir($a, $which);
        }
 
-       set_template_engine($a); // reset the template engine to the default in case the user's theme doesn't specify one
        profile_load($a,$which,$profile);
 
        $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
@@ -199,7 +198,8 @@ function profile_content(&$a, $update = 0) {
                'acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
                    'bang' => '',
                'visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
-                   'profile_uid' => $a->profile['profile_uid']
+                   'profile_uid' => $a->profile['profile_uid'],
+                               'acl_data' => ( $is_owner ? construct_acl_data($a, $a->user) : '' ), // For non-Javascript ACL selector
                );
 
                $o .= status_editor($a,$x);
@@ -258,8 +258,17 @@ function profile_content(&$a, $update = 0) {
                        }
                }
 
-               $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
-               $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
+               //  check if we serve a mobile device and get the user settings 
+               //  accordingly
+               if ($a->is_mobile) { 
+                   $itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network');
+                   $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
+               } else { 
+                   $itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
+                   $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
+               }
+               //  now that we have the user settings, see if the theme forces 
+               //  a maximum item number which is lower then the user choice
                if(($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network))
                        $itemspage_network = $a->force_max_items;
 
@@ -268,7 +277,7 @@ function profile_content(&$a, $update = 0) {
                $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
 
                $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
-                       FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+                       FROM `item` FORCE INDEX (created) LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                        WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
                        and `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                        AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 1