[PHP] facebook搜索页面PHP源代码 2007年 →→→→→进入此内容的聊天室

来自 , 2020-09-08, 写在 PHP, 查看 109 次.
URL http://www.code666.cn/view/894db62f
  1. <?php
  2. /*
  3. * @author Mark Slee
  4. *
  5. * @package ubersearch
  6. */
  7.  
  8. ini_set('memory_limit', '100M'); // to be safe we are increasing the memory limit for search
  9.  
  10. include_once $_SERVER['PHP_ROOT'].'/html/init.php'; // final lib include
  11. include_once $_SERVER['PHP_ROOT'].'/lib/s.php';
  12. include_once $_SERVER['PHP_ROOT'].'/lib/browse.php';
  13. include_once $_SERVER['PHP_ROOT'].'/lib/events.php';
  14. include_once $_SERVER['PHP_ROOT'].'/lib/websearch_classifier/websearch_classifier.php';
  15.  
  16. flag_allow_guest();
  17. $user = search_require_login();
  18.  
  19. if ($_POST) {
  20.   $arr = us_flatten_checkboxes($_POST, array('ii'));
  21.   $qs = '?';
  22.   foreach($arr as $key = > $val) {
  23.     $qs. = $key.'='.urlencode($val).'&';
  24.   }
  25.   $qs = substr($qs, 0, (strlen($qs) - 1));
  26.   redirect($_SERVER['PHP_SELF'].$qs);
  27. }
  28.  
  29. // If they performed a classmates search, these values are
  30. // needed to pre-populate dropdowns
  31. param_get_slashed(array('hy' = > $PARAM_STRING, 'hs' = > $PARAM_INT, 'adv' = > $PARAM_EXISTS, 'events' = > $PARAM_EXISTS, 'groups' = > $PARAM_EXISTS, 'classmate' = > $PARAM_EXISTS, 'coworker' = > $PARAM_EXISTS));
  32. $pos = strpos($get_hy, ':');
  33. if ($pos !== false) {
  34.   $hsid = intval(substr($get_hy, 0, $pos));
  35.   $hsyear = intval(substr($get_hy, $pos + 1));
  36. } else {
  37.   $hsid = intval($get_hs);
  38.   $hsyear = null;
  39. }
  40.  
  41. tpl_set('hs_id', $hsid);
  42. tpl_set('hs_name', get_high_school($hsid));
  43. tpl_set('hs_year', $hsyear);
  44. tpl_set('is_advanced_search', $get_adv);
  45. tpl_set('user', $user);
  46. tpl_set('count_total', 0); // pre-set count_total for the sake of ads page length
  47.  
  48. // Events search calendar data
  49. param_get(array('k' = > $PARAM_HEX, 'n' = > $PARAM_SINT));
  50.  
  51. if (($get_k == search_module::get_key(SEARCH_MOD_EVENT, SEARCH_TYPE_AS))) {
  52.  
  53.   $EVENTS_CAL_DAYS_AHEAD = 60;
  54.   $events_begin = strftime("%Y%m01"); // first of the month
  55.   $events_end = strftime("%Y%m%d", strtotime(strftime("%m/01/%Y")) + (86400 * $EVENTS_CAL_DAYS_AHEAD));
  56.   $events_params = array('dy1' = > $events_begin, 'dy2' = > $events_end);
  57.  
  58.   param_get(array('c1' = > $PARAM_INT, 'c2' = > $PARAM_INT), 'evt_');
  59.   if (isset($evt_c1)) {
  60.     $events_params['c1'] = $evt_c1;
  61.   }
  62.   if (isset($evt_c2)) {
  63.     $events_params['c2'] = $evt_c2;
  64.   }
  65.   $results = events_get_calendar($user, $get_n, $events_params);
  66.   tpl_set('events_date', $results['events_date']);
  67. }
  68.  
  69.  
  70.  
  71.  
  72. // Holy shit, is this the cleanest fucking frontend file you've ever seen?!
  73. ubersearch($_GET, $embedded = false, $template = true);
  74.  
  75. // Render it
  76. render_template($_SERVER['PHP_ROOT'].'/html/s.phpt');
  77.  
  78. /**
  79.  * login function for s.php
  80.  *
  81.  * @author Philip Fung
  82.  */
  83.  
  84. function search_require_login() {
  85.  
  86.   //check if user is logged in
  87.   $user = require_login(true);
  88.  
  89.   if($user 0 && !is_unregistered($user)) { return $user; }
  90.  
  91.   // this is an unregistered user
  92.   param_get(
  93.     array('k' = > $GLOBALS['PARAM_HEX'], // search key (used by rest of ubersearch code)
  94.   ));
  95.  
  96.   global $get_k;
  97.   $search_key = $get_k;
  98.  
  99.   //Let user see event or group search if criteria are obeyed
  100.   if ($search_key && (search_module::get_key_type($search_key) == SEARCH_MOD_EVENT || search_module::get_key_type($search_key) == SEARCH_MOD_GROUP) //event or group search
  101.   ) {
  102.     return $user;
  103.   } else {
  104.     go_home();
  105.   }
  106. }

回复 "facebook搜索页面PHP源代码 2007年"

这儿你可以回复上面这条便签

captcha