fb src code

If an EMP would break it, talk about it here.

fb src code

Postby Halt! Hammerzeit. » Aug 10 2007 08:05:04 pm

album.php
Code: Select all
<?php
include_once $_SERVER['PHP_ROOT'].'/html/init.php';
include_once $_SERVER['PHP_ROOT'].'/lib/photos.php';
include_once $_SERVER['PHP_ROOT'].'/lib/photos_api.php';
include_once $_SERVER['PHP_ROOT'].'/lib/photoprint.php';
include_once $_SERVER['PHP_ROOT'].'/lib/forms_lib.php';
include_once $_SERVER['PHP_ROOT'].'/lib/media_header.php';
include_once $_SERVER['PHP_ROOT'].'/lib/time.php';

// this page shows some thumbnails from a photo album

// CONSTANTS
$PHOTOS_PER_PAGE = 20;

// PARAMETERS
// do before init so aim setting will allow use of the proper photo db (HS/C)
param_get(array('aid'  => $PARAM_SINT,    // album id
                'page' => $PARAM_INT,     // page number (nav)
                'l'    => $PARAM_STRING , // aim link code
                'op'   => $PARAM_INT,
                'id'   => $PARAM_SINT,    // needs to be signed for photoprint albums
                'profile' => $PARAM_EXISTS,
                'comments' => $PARAM_EXISTS));

param_post(array('approve' => $PARAM_STRING,
                 'reject'  => $PARAM_STRING,
                 'edit'    => $PARAM_EXISTS,
                 'move'    => $PARAM_INT));

tpl_set('error', null);
tpl_set('status', null);
tpl_set('explanation', null);

// Pretty link to album_comments page
if ($get_comments) {
  include_once $_SERVER['PHP_ROOT'].'/html/photo_comments.php';
  return;
}

$guest = null;
if ($get_aid && $get_l) {
  $guest = true;
  $GLOBALS['AIM_MODE'] = 1;
}
tpl_set('guest', $guest);

$page = (!$get_page ? 1 : $get_page);

// Pretty link for profile album
if ($get_profile) {
  $get_aid = PROFILE_ARCHIVE_ALBUM;
  if (!$get_id) {
    $get_id = $user;
  }
}

// don't display the Tuna album (aid=-1)
if ($get_aid == TUNA_ALBUM) {
  debug_rlog("PHOTOS: tuna album aid -1 is not allowed");
  exit_standard_error_page();
}

$is_printshop_album = ($get_aid == PRINTSHOP_ALBUM);

// for regular albums, we need the aid, id, code
if((!$get_aid || !$get_id) && !$is_printshop_album) {
  if (strstr($_SERVER['HTTP_REFERER'], 'facebook.com'))
    debug_rlog("PHOTOS: no aid or no id on album page");
  redirect('/', 'www');
 }

// fetch album info
$album = photos_get_album($get_aid, $get_id);
if(!$album) {
  if (strstr($_SERVER['HTTP_REFERER'],'facebook.com')) {
    debug_rlog("PHOTOS: album does not exist");
  }
  exit_standard_error_page(array('subj' => $get_id));
}
$album['href'] = 'album.php?aid='.$album['aid'].'&id='. $album['user'];
$comment_count = $is_printshop_album ? 0 : photos_get_album_comment_count($get_aid, $get_id);

$album_guest = null;
$photos_guest = null;
if (photo_code($album['user']) == $get_l) {
  $photos_guest = true;
  tpl_set('photos_guest', $photos_guest);
} elseif (photo_code($album['user'], $get_aid) == $get_l) {
  $album_guest = true;
}
tpl_set('album_guest', $album_guest);

if($guest && !($photos_guest || $album_guest)) { // aim security (verify code)
  exit_standard_error_page();
} else if (!$guest) {
  flag_allow_guest();
  $user = require_login(true);
}

// check permissions
if(!can_see_album($user, $album) ||
   (!$guest && !can_see($user, $album['user'], 'profile'))) { 
  exit_standard_error_page(array('subj' => $album['user'], 'aid' => $album['aid']));
}

$my_photos = false;
$network_name = null;
$show_public_link = null;
if ($user == $album['user']) {
  $my_photos = true;
  if (!$is_printshop_album) {
    $show_public_link = true;
  }
} else {
  $network_name = network_get_name(id_get_primary_network($album['user']));
}
txt_set('network_name', $network_name);
tpl_set('my_photos', $my_photos);
tpl_set('show_public_link', $show_public_link);

// SAVE PENDING PHOTOS
if ($post_approve && check_form_user($user, true)) {
  $pending_photos = photos_get_pending_photos($get_aid, $user);
  $resolve_pids = null;
  foreach ($pending_photos as $photo) {
    $photo_post_var = 'pid_'.$photo['pid'].'_'.$user;
    $post_check = isset($_POST[$photo_post_var]) ? $_POST[$photo_post_var] : 0;
    if ($post_check) {
      $resolve_pids[] = $photo['pid'];
    }
  }

  if ($resolve_pids == null) {
      tpl_set('error', 'No photos selected.');
  }
 
  // check that we can move to another album, if the user wanted to
  $move_to_aid = isset($post_move) ? $post_move : null;
  if ($move_to_aid == $get_aid) {
    $move_to_aid = null;
  }
  $move_to_album = null;
  if ($resolve_pids && $move_to_aid) {
    // verify that the album has enough space
    $move_to_album = photos_get_album($move_to_aid, $user);
    $move_to_href = render_link(txt_set($move_to_album['name']), "album.php?aid=$move_to_aid&id=$user");
    $full_count = photos_get_full_photo_count($move_to_aid, $user);
    $limit = photos_album_size_limit($move_to_album);
    if ($full_count + count($resolve_pids) > $limit) {
      tpl_set('error', 'Your photos could not be moved.');
      tpl_set('explanation', 'You cannot exceed '.$limit.' photos in the album '.$move_to_href.'.');
      $resolve_pids = null;
      $move_to_album = null;
    }
  }

  // resolve the photos as a batch
  // todo(jwiseman): check for errors from these calls
  if ($resolve_pids) {
    photos_resolve_photos_approved($resolve_pids, $user);
    if ($move_to_album) {
      foreach ($resolve_pids as $pid) {
        $move_error = photos_move_photo($user, $pid, $get_aid, $move_to_aid);
      }
    }
  }

  if ($resolve_pids) {
    tpl_set('status', 'Photos approved.');
    if ($move_to_album) {
      tpl_set('explanation', 'Your photos have been approved and moved to '.$move_to_href.'.');
    }
   
    // REFETCH THE ALBUM TO GET SIZE CHANGES
    $album = photos_get_album($get_aid, $get_id);
   

    // This is only present on the first time
    if ($post_edit) {
      // RETRIEVE THE SUBMITTED PRIVACY SETTINGS
      // todo(jwiseman): this logic is duplicated below. maybe always perform network retrieval when viewing album
      include_once $_SERVER['PHP_ROOT'].'/lib/privacy_network.php';
      $primary_network_key = id_get_primary_network($user);
      $network_keys = id_get_networks($user);
      $settings = privacy_retrieve_submitted_album_privacy_settings(array($album), $network_keys);
     
      // MAP THE UPDATED PRIVACY VALUES
      $field = 'album_'.$album['aid'];
      $album_to_save = privacy_map_and_set_album_values($user,
                                                        $network_keys,
                                                        $settings[$field],
                                                        $album);
      $album['visible'] = $album_to_save['visible'];
      $album['network_keys'] = $album_to_save['network_keys'];
     
      // SAVE THE UPDATES SETTINGS FOR THIS ALBUM
      edit_album($user, $album['aid'], $album['name'], $album['description'], $album['visible'], false,
                 $album['network_keys'], $album['location']);
     
    }
  }
}

// REJECT PENDING PHOTOS
if ($post_reject && check_form_user($user, true)) {
  $pending_photos = photos_get_pending_photos($get_aid, $user);
  $photos_left = photos_get_full_photo_count($get_aid, $user);
  $rejected = false;
  foreach ($pending_photos as $photo) {
    $photo_post_var = 'pid_'.$photo['pid'].'_'.$user;
    $post_check = isset($_POST[$photo_post_var]) ? $_POST[$photo_post_var] : 0;
    if ($post_check) {
      // delete photo, don't keep copy, don't consider as a user delete (for falcon)
      delete_photo($user, $photo['pid'], null, false);
      $rejected = true;
      $photos_left--;
    }
  }

  if ($rejected) {
    if ($photos_left) {
      tpl_set('status', 'Photos rejected.');
     
      // REFETCH THE ALBUM TO GET SIZE CHANGES
      $album = photos_get_album($get_aid, $get_id);
    }
    else {
      redirect("editalbum.php?aid=$get_aid&delete=1&rejected");
    }
  }
  else {
      tpl_set('error', 'No photos selected.');
  }
}


// Photoprint: check to see if they can add this to their cart
$in_cart = 0;
if ($user > 0) {
  $in_cart = printshop_is_in_cart($user, $get_aid);
}
$print_post = null;
$print_pending = null;
$print_in_cart = null;
if ($get_aid > 0 &&
    $in_cart == 0 &&
    ($user==$album['user'] || (are_friends($user, $album['user']) && printshop_get_user_permission($album['user']) != 1))) {
  $print_post = 'aid=-' . $get_aid . '&ownid=' . $album['user'] . '&pid=-1';
} elseif ($in_cart == 1) {
  $print_pending = true;
} elseif ($in_cart == 2) {
  $print_in_cart = true;
}
tpl_set('print_post', $print_post);
tpl_set('print_pending', $print_pending);
tpl_set('print_in_cart', $print_in_cart);

// PHOTOS
$photo_count = $album['size'];
$photos = get_album_photos($album, $PHOTOS_PER_PAGE, $PHOTOS_PER_PAGE * ($page-1));
if ($is_printshop_album) {
  foreach($photos as $key => $val) {
    $photos[$key]['href'] = redirect_str('photo.php?pid=' . $val['pid'] . '&id=' . $val['user'] . '&psid=' . $album['ps_id']);
    if ($guest) {
      $photos[$key]['href'] .= '&l=' . $get_l;
    }
    $photos[$key]['path'] = photos_get_url_from_photo($val, 's');
  }
} else {
  foreach($photos as $key => $val) {
    $photos[$key]['href'] = redirect_str('photo.php?pid=' . $val['pid'] . '&id=' . $val['user']);
    if ($guest) {
      $photos[$key]['href'] .= '&l=' . $get_l;
    }
    $photos[$key]['path'] = photos_get_url_from_photo($val, 's');
  }
}

// PENDING PHOTOS
$pending_count = 0;
$pending_photos = null;
$pending_batches = null;
$move_to_albums = null;
$privacy_ui = null;
if ($my_photos && !$is_printshop_album) {
  $pending_photos = photos_get_pending_photos($get_aid, $user);
  $pending_count = count($pending_photos);
  if ($pending_count) {
    // batch query the unresolved tags
    $pids = array();
    foreach ($pending_photos as $photo) {
      $pids[] = $photo['pid'];
    }
    $multiget_tags = photos_multiget_unresolved_tags($pids, $user);

    foreach ($pending_photos as &$photo) {
      $source_name =
        ($photo['source'] == $GLOBALS['PHOTO_SOURCE_MOBILE']) ?
        'Facebook Mobile' :
        obj_get_name($photo['source']);
      $photo['path'] = photos_get_url_from_photo($photo, 's');
      $photo['source_name'] = $source_name;
      $photo['tags'] = null;
      if (isset($multiget_tags[$photo['pid']])) {
        $tags = $multiget_tags[$photo['pid']];
       
        // use '13' as the max_length to fix the pending photo boxes
        $photo['tags'] = setup_tag_links($tags, $user, $user, $get_aid, 0, 0, 0, 13);
      }
      $photo['checked'] = false;

      // add to an pending batch
      $day = get_facebook_day($photo['created']);
      $pending_batches[$day]['date'] = $photo['created'];
      $pending_batches[$day]['sources'][$photo['source']]['photos'][] = $photo;
      $pending_batches[$day]['sources'][$photo['source']]['app_name'] = $source_name;
    }
   
    // present batches in reverse chronological
    $pending_batches = array_reverse($pending_batches);

    // setup privacy settings
    include_once $_SERVER['PHP_ROOT'].'/lib/privacy_network.php';
    $primary_network_key = id_get_primary_network($user);
    $network_keys = id_get_networks($user);
    $has_networks = ($primary_network_key != 0 ? true : false);
    if (!$has_networks) {
      $network_keys = array(0);
    }
    $privacy_ui = privacy_set_albums_ui_struct(array($album), $network_keys, $has_networks);

    // Get albums eligible for 'Move to:' which may NOT be the mobile album
    // nor the current album
    $move_to_albums = get_albums($user, $user, 0, 0, $include_mobile=false);

    // prep the cache for the photo size retrieval
    // todo(jwiseman): sorta funky that we use a db query in get_albums above, then use cache here
    foreach ($move_to_albums as $move_album) {
      $temp_album = array();
      photos_get_album($move_album['aid'], $user, false, true, $temp_album);
    }
    memcache_dispatch();

    foreach ($move_to_albums as $key => $move_album) {
      $full_count = photos_get_full_photo_count($move_album['aid'], $user);
      $limit = photos_album_size_limit($move_album);
      if ($full_count >= $limit ||
          $move_album['aid'] == $get_aid) {
        unset($move_to_albums[$key]);
      } else {
        // Sanitize the right fields
        $move_to_albums[$key]['name'] = txt_set($move_album['name']);
        $move_to_albums[$key]['location'] = txt_set($move_album['location']);
        $move_to_albums[$key]['description'] = txt_set($move_album['description']);
      }
    }

    if (count($move_to_albums) > 0) {
      array_unshift($move_to_albums, $album);
    }
    else {
      $move_to_albums = null;
    }
  }
}
tpl_set('pending_count', $pending_count);
tpl_set('pending_photos', $pending_photos);
tpl_set('pending_batches', $pending_batches);
tpl_set('move_to_albums', $move_to_albums);
tpl_set('privacy_ui', $privacy_ui);

// PAGER
$num_pages = (int)(($photo_count-1) / $PHOTOS_PER_PAGE) + 1;
$pager = array();
if ($num_pages > 1) {
  $album_ps_id = isset($album['ps_id']) ? $album['ps_id'] : null;
  $album_choose_id = $album_ps_id ? $album_ps_id : $album['user'];

  $i = 0;
  if ($page != 1) {
    $pager[$i]['name'] = 'prev';
    $pager[$i]['href'] = '/album.php?aid='.$get_aid.'&page='.($page-1) . ($guest ? '&l='.$get_l : '') . ($get_op ? '&op='.$get_op : '') .
      '&id='.$album_choose_id;
    $i++;
  }

  for ($j = 1; $j <= $num_pages; $j++) {
    $pager[$i]['name'] = $j;
    $pager[$i]['href'] = '/album.php?aid='.$get_aid.'&page='.$j . ($guest ? '&l='.$get_l : '') . ($get_op ? '&op='.$get_op : '') .
      '&id='.$album_choose_id;

    if ($j == $page) {
      $pager[$i]['current'] = true;
    }

    $i++;
  }

  if ($page != $num_pages) {
    $pager[$i]['name'] = 'next';
    $pager[$i]['href'] = '/album.php?aid='.$get_aid.'&page='.($page+1) . ($guest ? '&l='.$get_l : '') . ($get_op ? '&op='.$get_op : '') .
      '&id='.$album_choose_id;
  }
}
tpl_set('pager', $pager);

$share_hrefs = share_make_album_hrefs($album['user'], $get_aid);

// get tags in this album and check permissions
if ($user && !$guest) {
  $tags = photos_get_album_taggees($album['aid'], $album['user']);
  $tags = setup_tag_links($tags, $user, $album['user'], $album['aid'], 0);
} else {
  $tags = array();
}

// check for empty profile archive album, but current profile picture
$import_profile_picture = false;
if ($my_photos &&
    $album['aid'] == PROFILE_ARCHIVE_ALBUM &&
    $album['size'] == 0) {
  $link = get_short_profile_attr($user, 'link');
  if ($link) {
    $import_profile_picture = true;
  }
}
tpl_set('import_profile_picture', $import_profile_picture);

$media_header = get_media_header_data($album['user'], $user, APP_PHOTO);
tpl_set('media_header', $media_header);

// set some template data
tpl_set('photos_per_page', $PHOTOS_PER_PAGE);
tpl_set('page', $page);
tpl_set('id', $album['user']);
tpl_set('aid', $album['aid']);
txt_set('album', $album);
tpl_set('comment_count', $comment_count);
tpl_set('photos', $photos);
tpl_set('tags', $tags);
tpl_set('changes_saved', isset($_GET['saved']));
tpl_set('share_hrefs', $share_hrefs);

tpl_set('ads_page_length_data', count($photos));

tpl_set('public_link',  redirect_str("album.php?aid=".$get_aid.'&l='.photo_code($album['user'], $get_aid)."&id=".$album['user']));
tpl_set('photos_href', "photos.php?id=$album[user]" . ($get_l ? '&l='.$get_l : '') . ($get_op ? '&s='.$get_op : ''));
tpl_set('user', $user);

falcon_log('view_photo_album', $user, true, array($album['user'], id_get_primary_network($album['user']), $album['aid']));

txt_set('name', get_short_profile_attr($album['user'],'name'));

// render
render_template($_SERVER['PHP_ROOT'].'/html/album.phpt');
User avatar
Halt! Hammerzeit.
i need a life. link me plz.
 
Posts: 12163
Joined: Oct 05 2001 12:00:00 am

Postby daoist » Aug 10 2007 08:23:23 pm

ok.
I:IV:XV

I procreated.
User avatar
daoist
the athiest atheist
 
Posts: 45859
Joined: Apr 24 2001 12:00:00 am
Location: I would have waited an eternity for this. It's over, Prime.

Postby Dragmire » Aug 10 2007 09:40:35 pm

Looks like PHP to me.
THW wrote:chicks dig you when your face is buried between pussy.
User avatar
Dragmire
i need a life. link me plz.
 
Posts: 12360
Joined: Feb 10 2003 06:07:55 pm
Location: in a database

Postby Russ » Aug 11 2007 12:38:36 am

... point to this, as in why I shouldn't lock it?

-=Russ=-
irc.sevarg.net/#Strangetalk
daoist wrote:Russ would very much love to turn the USA into a theocracy full of armed bigots. We already have one of those. It's called Iran.

daoist wrote:Russ is a nutcase for a variety of reasons.

Image
User avatar
Russ
What if God was on my bus?
 
Posts: 8969
Joined: Jan 06 2001 01:00:00 am
Location: My nice little otter-den

Postby Deepblue » Aug 12 2007 09:50:25 am

it won't show me the tuna album :(

meanwhile, i await the C&D letter from facebook's legal department.
alex wrote:penii really aren't all that bad
User avatar
Deepblue
Figurehead For Life
 
Posts: 25011
Joined: Jan 06 2001 01:00:00 am
Location: in ur fridge, eating ur foodz

Postby Deepblue » Aug 12 2007 09:54:03 am

oh and here's the source code for index.php. equally useless without any of the includes, i might add.
Code: Select all
include_once $_SERVER['PHP_ROOT'].'/html/init.php';
include_once $_SERVER['PHP_ROOT'].'/lib/home.php';
include_once $_SERVER['PHP_ROOT'].'/lib/requests.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/newsfeed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/poke.php';
include_once $_SERVER['PHP_ROOT'].'/lib/share.php';
include_once $_SERVER['PHP_ROOT'].'/lib/orientation.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/newsfeed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/mobile/register.php';
include_once $_SERVER['PHP_ROOT'].'/lib/forms_lib.php';
include_once $_SERVER['PHP_ROOT'].'/lib/contact_importer/contact_importer.php';
include_once $_SERVER['PHP_ROOT'].'/lib/feed/util.php';
include_once $_SERVER['PHP_ROOT'].'/lib/hiding_prefs.php';
include_once $_SERVER['PHP_ROOT'].'/lib/abtesting.php';
include_once $_SERVER['PHP_ROOT'].'/lib/friends.php';
include_once $_SERVER['PHP_ROOT'].'/lib/statusupdates.php';

// lib/display/feed.php has to be declared here for scope issues.
// This keeps display/feed.php cleaner and easier to understand.
include_once $_SERVER['PHP_ROOT'].'/lib/display/feed.php';
include_once $_SERVER['PHP_ROOT'].'/lib/monetization_box.php';

// require login
$user = require_login();
print_time('require_login');
param_request(array( 'react' => $PARAM_EXISTS));

// Check and fix broken emails
// LN - disabling due to excessive can_see dirties and sets when enabled.
//check_and_fix_broken_emails($user);

// migrate AIM screenname from profile to screenname table if needed
migrate_screenname ($user);

// homepage announcement variables
$HIDE_ANNOUNCEMENT_BIT = get_site_variable('HIDE_ANNOUNCEMENT_BIT');
$HIDE_INTRO_BITMASK = get_site_variable('HIDE_INTRO_BITMASK');

// redirects
if (is_sponsor_user()) {
redirect('bizhome.php', 'www');
}

include_once $_SERVER['PHP_ROOT'].'/lib/mesg.php';
include_once $_SERVER['PHP_ROOT'].'/lib/invitetool.php';
include_once $_SERVER['PHP_ROOT'].'/lib/grammar.php';
include_once $_SERVER['PHP_ROOT'].'/lib/securityq.php';
include_once $_SERVER['PHP_ROOT'].'/lib/events.php';
include_once $_SERVER['PHP_ROOT'].'/lib/rooster/stories.php';

// todo: password confirmation redirects here (from html/reset.php),
// do we want a confirmation message?

param_get_slashed(array(
'feeduser' => $PARAM_INT, //debug: gets feed for user here
'err' => $PARAM_STRING, // returning from a failed entry on an orientation form
'error' => $PARAM_STRING, // an error can also be here because the profile photo upload code is crazy
'ret' => $PARAM_INT,
'success' => $PARAM_INT, // successful profile picture upload
'jn' => $PARAM_INT, // joined a network for orientation
'np' => $PARAM_INT, // network pending (for work/address network)
'me' => $PARAM_STRING, // mobile error
'mr' => $PARAM_EXISTS, // force mobile reg view
'mobile' => $PARAM_EXISTS, // mobile confirmation code sent
'jif' => $PARAM_EXISTS, // just imported friends
'ied' => $PARAM_STRING, // import email domain
'o' => $PARAM_EXISTS, // first time orientation, passed on confirm
'verified' => $PARAM_EXISTS)); // verified mobile phone

param_post(array(
'leave_orientation' => $PARAM_EXISTS,
'show_orientation' => $PARAM_INT, // show an orientation step
'hide_orientation' => $PARAM_INT)); // skip an orientation step

// homepage actions
if ($req_react && validate_expiring_hash($req_react, $GLOBALS['url_md5key'])) {
$show_reactivated_message = true;
} else {
$show_reactivated_message = false;
}
tpl_set('show_reactivated_message', $show_reactivated_message);


// upcoming events
events_check_future_events($user); // make sure big tunas haven't moved around
$upcoming_events = events_get_imminent_for_user($user);

// this is all stuff that can be fetched together!
$upcoming_events_short = array();
obj_multiget_short(array_keys($upcoming_events), true, $upcoming_events_short);
$new_pokes = 0;
//only get the next N pokes for display
//where N is set in the dbget to avoid caching issues
$poke_stats = get_num_pokes($user);
get_next_pokes($user, true, $new_pokes);
$poke_count = $poke_stats['unseen'];

$targeted_data = array();
home_get_cache_targeted_data($user, true, $targeted_data);
$announcement_data = array();
home_get_cache_announcement_data($user, true, $announcement_data);
$orientation = 0;
orientation_get_status($user, true, $orientation);
$short_profile = array();
profile_get_short($user, true, $short_profile);
// pure priming stuff
privacy_get_network_settings($user, true);
$presence = array();
mobile_get_presence_data($user, true, $presence);
feedback_get_event_weights($user, true);
// Determine if we want to display the feed intro message
$intro_settings = 0;
user_get_hide_intro_bitmask($user, true, $intro_settings);
$user_friend_finder = true;
contact_importer_get_used_friend_finder($user, true, $used_friend_finder);
$all_requests = requests_get_cache_data($user);
// FIXME?: is it sub-optimal to call this both in requests_get_cache_data and here?
$friends_status = statusupdates_get_recent($user, null, 3);
memcache_dispatch(); // populate cache data

// Merman's Admin profile always links to the Merman's home
if (user_has_obj_attached($user)) {
redirect('mhome.php', 'www');
}

if (is_array($upcoming_events)) {
foreach ($upcoming_events as $event_id => $data) {
$upcoming_events[$event_id]['name'] = txt_set($upcoming_events_short[$event_id]['name']);
}
}

tpl_set('upcoming_events' , $upcoming_events);

// disabled account actions
$disabled_warning = ((IS_DEV_SITE || IS_QA_SITE) && is_disabled_user($user));
tpl_set('disabled_warning', $disabled_warning);

// new pokes (no more messages here, they are in the top nav!)
if (!user_is_guest($user)) {
tpl_set('poke_count' , $poke_count);
tpl_set('pokes' , $new_pokes);
}

// get announcement computations
tpl_set('targeted_data' , $targeted_data);
tpl_set('announcement_data' , $announcement_data);


// birthday notifications
tpl_set('birthdays' , $birthdays = user_get_birthday_notifications($user, $short_profile));
tpl_set('show_birthdays' , $show_birthdays = (count($birthdays) || !$orientation));

// user info
tpl_set('first_name' , user_get_first_name(txt_set($short_profile['id'])));
tpl_set('user' , $user);

// decide if there are now any requests to show
$show_requests = false;
foreach ($all_requests as $request_category) {
if ($request_category) {
$show_requests = true;
break;
}
}
tpl_set('all_requests', $show_requests ? $all_requests : null);

$permissions = privacy_get_reduced_network_permissions($user, $user);

// status
$user_info = array('user' => $user,
'firstname' => user_get_first_name($user),
'see_all' => '/statusupdates/?ref=hp',
'profile_pic' => make_profile_image_src_direct($user, 'thumb'),
'square_pic' => make_profile_image_src_direct($user, 'square'));

if (!empty($presence) && $presence['status_time'] > (time() - 60*60*24*7)) {
$status = array('message' => txt_set($presence['status']),
'time' => $presence['status_time'],
'source' => $presence['status_source']);
} else {
$status = array('message' => null, 'time' => null, 'source' => null);
}
tpl_set('user_info', $user_info);

tpl_set('show_status', $show_status = !$orientation);
tpl_set('status', $status);
tpl_set('status_custom', $status_custom = mobile_get_status_custom($user));
tpl_set('friends_status', $friends_status);

// orientation
if ($orientation) {
if ($post_leave_orientation) {
orientation_update_status($user, $orientation, 2);
notification_notify_exit_orientation($user);
dirty_user($user);
redirect('home.php');
} else if (orientation_eligible_exit(array('uid'=>$user)) == 2) {
orientation_update_status($user, $orientation, 1);
notification_notify_exit_orientation($user);
dirty_user($user);
redirect('home.php');
}
}

// timezone - outside of stealth, update user's timezone if necessary
$set_time = !user_is_alpha($user, 'stealth');
tpl_set('timezone_autoset', $set_time );
if ($set_time) {
$daylight_savings = get_site_variable('DAYLIGHT_SAVINGS_ON');
tpl_set('timezone', $short_profile['timezone'] - ($daylight_savings ? 4 : 5) );
}

// set next step if we can
if (!$orientation) {
user_set_next_step($user, $short_profile);
}

// note: don't make this an else with the above statement, because then no news feed stories will be fetched if they're exiting orientation
if ($orientation) {
extract(orientation_get_const());

require_js('js/dynamic_dialog.js');
require_js('js/suggest.js');
require_js('js/typeahead_ns.js');
require_js('js/suggest.js');
require_js('js/editregion.js');
require_js('js/orientation.js');
require_css('css/typeahead.css');
require_css('css/editor.css');

if ($post_hide_orientation && $post_hide_orientation <= $ORIENTATION_MAX) {
$orientation['orientation_bitmask'] |= ($post_hide_orientation * $ORIENTATION_SKIPPED_MODIFIER);
orientation_update_status($user, $orientation);
} else if ($post_show_orientation && $post_show_orientation <= $ORIENTATION_MAX) {
$orientation['orientation_bitmask'] &= ~($post_show_orientation * $ORIENTATION_SKIPPED_MODIFIER);
orientation_update_status($user, $orientation);
}

$stories = orientation_get_stories($user, $orientation);
switch ($get_err) {
case $ORIENTATION_ERR_COLLEGE:
$temp = array(); // the affil_retval_msg needs some parameters won't be used
$stories[$ORIENTATION_NETWORK]['failed_college']=affil_retval_msg($get_ret, $temp, $temp);
break;
case $ORIENTATION_ERR_CORP:
$temp = array();
// We special case the network not recognized error here, because affil_retval_msg is retarded.
$stories[$ORIENTATION_NETWORK]['failed_corp'] = ($get_ret == 70) ? 'The email you entered did not match any of our supported networks. ' .
'Click here to see our supported list. ' .
'Go here to suggest your network for the future.'
: affil_retval_msg($get_ret, $temp, $temp);
break;
}

// photo upload error
if ($get_error) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_PROFILE]]['upload_error'] = pic_get_error_text($get_error);
}
// photo upload success
else if ($get_success == 1) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_PROFILE]]['uploaded_pic'] = true;
// join network success
} else if ($get_jn) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['joined'] = array(
'id' => $get_jn,
'name' => network_get_name($get_jn));
// network join pending
} else if ($get_np) {

$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['join_pending'] = array(
'id' => $get_np,
'email' => get_affil_email_conf($user, $get_np),
'network' => network_get_name($get_np));
// just imported friend confirmation
} else if ($get_jif) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['just_imported_friends'] = true;
$stories[$ORIENTATION_ORDER[$ORIENTATION_NETWORK]]['domain'] = $get_ied;
}

// Mobile web API params
if ($get_mobile) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['sent_code'] = true;
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['view'] = 'confirm';
}
if ($get_verified) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['verified'] = true;
}
if ($get_me) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['error'] = $get_me;
}
if ($get_mr) {
$stories[$ORIENTATION_ORDER[$ORIENTATION_MOBILE]]['view'] = 'register';
}

if (orientation_eligible_exit($orientation)) {
tpl_set('orientation_show_exit', true);
}
tpl_set('orientation_stories', $stories);

//if in orientation, we hide all feed intros (all 1's in bitmask)
$intro_settings = -1;

}
tpl_set('orientation', $orientation);

// Rooster Stories
if (!$orientation &&
((get_site_variable('ROOSTER_ENABLED') == 2) ||
(get_site_variable('ROOSTER_DEV_ENABLED') == 2))) {
$rooster_story_count = get_site_variable('ROOSTER_STORY_COUNT');
if (!isset($rooster_story_count)) {
// Set default if something is wrong with the sitevar
$rooster_story_count = 2;
}
$rooster_stories = rooster_get_stories($user, $rooster_story_count, $log_omissions = true);
if (!empty($rooster_stories) && !empty($rooster_stories['stories'])) {
// Do page-view level logging here
foreach($rooster_stories['stories'] as $story) {
rooster_log_action($user, $story, ROOSTER_LOG_ACTION_VIEW);
}
tpl_set('rooster_stories', $rooster_stories);
}
}

// set the variables for the home announcement code
$hide_announcement_tpl = ($intro_settings | $HIDE_INTRO_BITMASK) & $HIDE_ANNOUNCEMENT_BIT;
// if on qa/dev site, special rules
$HIDE_INTRO_ON_DEV = get_site_variable('HIDE_INTRO_ON_DEV');
if ((IS_QA_SITE || IS_DEV_SITE) && !$HIDE_INTRO_ON_DEV) {
$hide_announcement_tpl = 0;
}

tpl_set('hide_announcement', $hide_announcement_tpl);
if($is_candidate = is_candidate_user($user)) {
tpl_set('hide_announcement', false);
}
$home_announcement_tpl = !$hide_announcement_tpl || $is_candidate ? home_get_announcement_info($user) : 0;
tpl_set('home_announcement', $home_announcement_tpl);
tpl_set('hide_announcement_bit', $HIDE_ANNOUNCEMENT_BIT);

$show_friend_finder = !$orientation && contact_importer_enabled($user) && !user_get_hiding_pref($user, 'home_friend_finder');
tpl_set('show_friend_finder', $show_friend_finder);
if ($show_friend_finder && (user_get_friend_count($user) > 20)) {
tpl_set('friend_finder_hide_options', array('text'=>'close',
'onclick'=>"return clearFriendFinder()"));
} else {
tpl_set('friend_finder_hide_options', null);
}

$account_info = user_get_account_info($user);
$account_create_time = $account_info['time'];

tpl_set('show_friend_finder_top',
!$used_friend_finder);

tpl_set('user', $user);


// MONETIZATION BOX
$minimize_monetization_box = user_get_hiding_pref($user, 'home_monetization');
$show_monetization_box = (!$orientation &&
get_site_variable('HOMEPAGE_MONETIZATION_BOX'));
tpl_set('show_monetization_box', $show_monetization_box);
tpl_set('minimize_monetization_box', $minimize_monetization_box);

if ($show_monetization_box) {
$monetization_box_data = monetization_box_user_get_data($user);
txt_set('monetization_box_data', $monetization_box_data);
}


// ORIENTATION
if ($orientation) {
$network_ids = id_get_networks($user);
$network_names = multiget_network_name($network_ids);
$in_corp_network = in_array($GLOBALS['TYPE_CORP'], array_map('extract_network_type', $network_ids));
$show_corp_search = $in_corp_network ||
get_age(user_get_basic_info_attr($user, 'birthday')) >= 21;
$pending_hs = is_hs_pending_user($user);
$hs_id = null;
$hs_name = null;
if ($pending_hs) {
foreach (id_get_pending_networks($user) as $network) {
if (extract_network_type($network['network_key']) == $GLOBALS['TYPE_HS']) {
$hs_id = $network['network_key'];
$hs_name = network_get_name($hs_id);
break;
}
}
}
//$orientation_people = orientation_get_friend_and_inviter_ids($user);
$orientation_people = array('friends' => user_get_all_friends($user),
'pending' => array_keys(user_get_friend_requests($user)),
'inviters'=> array(), // wc: don't show inviters for now
);
$orientation_info = array_merge($orientation_people,
array('network_names' => $network_names,
'show_corp_search' => $show_corp_search,
'pending_hs' => array('hs_id'=>$hs_id,
'hs_name'=>$hs_name),
'user' => $user,
));
tpl_set('orientation_info', $orientation_info);

tpl_set('simple_orientation_first_login', $get_o); // unused right now
}


// Roughly determine page length for ads
// first, try page length using right-hand panel
$ads_page_length_data = 3 + // 3 for profile pic + next step
($show_friend_finder ? 1 : 0) +
($show_status ? ($status_custom ? count($friends_status) : 0) : 0) +
($show_monetization_box ? 1 : 0) +
($show_birthdays ? count($birthdays) : 0) +
count($new_pokes);

// page length using feed stories
if ($orientation) {
$ads_page_length_data = max($ads_page_length_data, count($stories) * 5);
}
tpl_set('ads_page_length_data', $ads_page_length_data);

$feed_stories = null;
if (!$orientation) { // if they're not in orientation they get other cool stuff
// ad_insert: the ad type to try to insert for the user
// (0 if we don't want to try an insert)
$ad_insert = get_site_variable('FEED_ADS_ENABLE_INSERTS');

$feed_off = false;

if (check_super($user) && $get_feeduser){
$feed_stories = user_get_displayable_stories($get_feeduser, 0, null, $ad_insert);
} else if (can_see($user, $user, 'feed')) {
$feed_stories = user_get_displayable_stories($user, 0, null, $ad_insert);
} else {
$feed_off = true;
}

// Friend's Feed Selector - Requires dev.php constant
if (is_friendfeed_user($user)) {
$friendfeed = array();
$friendfeed['feeduser'] = $get_feeduser;
$friendfeed['feeduser_name'] = user_get_name($get_feeduser);
$friendfeed['friends'] = user_get_all_friends($user);
tpl_set('friendfeed', $friendfeed);
}

$feed_stories = feed_adjust_timezone($user, $feed_stories);

tpl_set('feed_off', $feed_off ? redirect('privacy.php?view=feeds', null, false) : false);
}
tpl_set('feed_stories', $feed_stories);

render_template($_SERVER['PHP_ROOT'].'/html/home.phpt');
alex wrote:penii really aren't all that bad
User avatar
Deepblue
Figurehead For Life
 
Posts: 25011
Joined: Jan 06 2001 01:00:00 am
Location: in ur fridge, eating ur foodz

Postby maniacdavid » Aug 12 2007 11:57:04 am

so I'm confused, how are you getting this? Random webserver problem?
User avatar
maniacdavid
i <3 strangetalk
 
Posts: 1886
Joined: Aug 26 2002 05:11:57 pm

Postby Deepblue » Aug 12 2007 12:10:08 pm

i think mod_php shit itself for just about 2 seconds and of course all this just showed up on screen to whoever was trying to look at the page. *I*, however, just googled for it.
alex wrote:penii really aren't all that bad
User avatar
Deepblue
Figurehead For Life
 
Posts: 25011
Joined: Jan 06 2001 01:00:00 am
Location: in ur fridge, eating ur foodz


Return to Computers (and lesser electronics)

Who is online

Users browsing this forum: No registered users and 1 guest