daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function top () {
  2.         $front = FrontController::get_instance();
  3.         $view  = new View();
  4.         $user = User::get_instance();
  5.         $lang = Lang::get_instance();
  6.         $params = $front->getParams();
  7.        
  8.         $params_sex = isset($params['s']) ? $params['s'] : false;
  9.        
  10.         if ($params_sex == "boys") {
  11.             $user_sex = "M";
  12.             $type = "boys_top";
  13.             $number_users = dbUsers::get_number_users_by_sex("M");
  14.         } elseif ($params_sex == "girls") {
  15.             $user_sex = "F";
  16.             $type = "girls_top";
  17.             $number_users = dbUsers::get_number_users_by_sex("F");
  18.         } else {
  19.             $user_sex = "X";
  20.             $type = "users_top";
  21.             $number_users = dbUsers::get_number_users();           
  22.         }
  23.        
  24.         //Create pagination instance
  25.         $pgn = new Pagination($number_users);
  26.        
  27.         $current_month_time = mktime(0, 0, 0, date("n"), 1, date("Y"));
  28.        
  29.         if ($user_sex == "X") {
  30.             $users_details = dbUsers::get_users_top_with_limit($pgn->sin(), $pgn->iop(), $current_month_time); 
  31.         } else {
  32.             $users_details = dbUsers::get_users_top_by_sex_with_limit($user_sex, $pgn->sin(), $pgn->iop(), $current_month_time);           
  33.         }
  34.        
  35.         foreach ($users_details as $key => $user_details) {
  36.             $users_details[$key]['user_online_by'] = ago($user->is_online_of($user_details['user_id']));
  37.             $users_details[$key]['country'] = dbCountries::get_country_by_id($user_details['user_country']);
  38.             $users_details[$key]['user_age'] = get_age($user_details['user_birthday']);
  39.             $users_details[$key]['main_photo'] = $user->get_main_photo($user_details['user_id']);
  40.         }
  41.        
  42.         $view->assign('type', $type);
  43.         $view->assign('users_details', $users_details);
  44.         $view->assign('current_params', $params['s']);     
  45.         $view->assign('pgn', $pgn->getall());
  46.         $view->assign('action', $front->getAction());
  47.                
  48.         $result = $view->fetch('members_list.tpl');
  49.         $front->setBody($result);  
  50.     }
  51.    
  52.     /**
  53.      * Top popularity
  54.      */
  55.     public function popularity () {
  56.         $front = FrontController::get_instance();
  57.         $view  = new View();
  58.         $user = User::get_instance();
  59.         $lang = Lang::get_instance();
  60.  
  61.         $type = "popularity_top";
  62.         $number_users = dbUsers::get_number_users();
  63.        
  64.         //Create pagination instance
  65.         $pgn = new Pagination($number_users);      
  66.    
  67.         $current_month_time = mktime(0, 0, 0, date("n"), 1, date("Y"));
  68.        
  69.         $users_details = dbUsers::get_users_top_popularity_with_limit($pgn->sin(), $pgn->iop(), $current_month_time);
  70.        
  71.         foreach ($users_details as $key => $user_details) {
  72.             $users_details[$key]['user_online_by'] = ago($user->is_online_of($user_details['user_id']));
  73.             $users_details[$key]['country'] = dbCountries::get_country_by_id($user_details['user_country']);
  74.             $users_details[$key]['user_age'] = get_age($user_details['user_birthday']);
  75.             $users_details[$key]['main_photo'] = $user->get_main_photo($user_details['user_id']);
  76.         }
  77.        
  78.         $view->assign('type', $type);
  79.         $view->assign('users_details', $users_details);    
  80.         $view->assign('pgn', $pgn->getall());
  81.         $view->assign('action', $front->getAction());
  82.                
  83.         $result = $view->fetch('members_list.tpl');
  84.         $front->setBody($result);  
  85.     }
RAW Paste Data
Pastebin PRO CHRISTMAS Special!
Get 60% OFF Pastebin PRO accounts!
Top