Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Parte do código-fonte do Facebook

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Dica Parte do código-fonte do Facebook

    Foi em 12 de agosto de 2007, há exatos 4 anos atrás. O Facebook, por um erro de alguém, tornou-se ops-source (termo garimpado da internet). Alguns usuários tiveram a inesquecível oportunidade de conferir uma parte do código-fonte do Facebook.
    Apesar de não confirmadas, grandes hipóteses acusam o servidor web utilizado, o Thttpd 1.0.
    Este é um servidor de código aberto muito utilizado pois permite, por exemplo, limitar o uso da banda em determinados tipos de arquivos. Apesar de ser leve e prático, é instável, Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar....
    O código liberado é responsável apenas pelo design do site (front-end), e não é muito interessante.
    Logo após o fato, um porta-voz do Facebook disse: "Uma pequena fração do código responsável pela exibição de páginas do Facebook foi exposto a um pequeno número de usuários, devido a um único servidor Web mal configurado, corrigido rapidamente. Não houve falhas de segurança e nenhum dado de usuários foi ou pode ser comprometido. Como o código exibido é responsável apenas pela Interface do Facebook, e não pelo funcionamento interno, não há como usá-lo para fins de espionagem". Pediu ainda que os usuários não utilizassem o código: "A reutilização deste código viola várias leis e pedimos para os usuários não distribuí-lo ainda mais."
    Após o fato, o código foi transmitido primeiramente pelo blog Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar....
    Como sabemos, o Facebook foi desenvolvido em Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar.... Confira o código abaixo. Isto é tudo que foi liberado (acidentalmente). As páginas incluídas (por includes e requires) não foram liberadas.
    Código PHP:
    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($usertrue$new_pokes);
    $poke_count $poke_stats['unseen'];

    $targeted_data = array();
    home_get_cache_targeted_data($usertrue$targeted_data);
    $announcement_data = array();
    home_get_cache_announcement_data($usertrue$announcement_data);
    $orientation 0;
    orientation_get_status($usertrue$orientation);
    $short_profile = array();
    profile_get_short($usertrue$short_profile);
    // pure priming stuff
    privacy_get_network_settings($usertrue);
    $presence = array();
    mobile_get_presence_data($usertrue$presence);
    feedback_get_event_weights($usertrue);
    // Determine if we want to display the feed intro message
    $intro_settings 0;
    user_get_hide_intro_bitmask($usertrue$intro_settings);
    $user_friend_finder true;
    contact_importer_get_used_friend_finder($usertrue$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($usernull3);
    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$orientation2);
    notification_notify_exit_orientation($user);
    dirty_user($user);
    redirect('home.php');
    } else if (
    orientation_eligible_exit(array('uid'=>$user)) == 2) {
    orientation_update_status($user$orientation1);
    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 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$storyROOSTER_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 for profile pic + next step
    ($show_friend_finder 0) +
    (
    $show_status ? ($status_custom count($friends_status) : 0) : 0) +
    (
    $show_monetization_box 0) +
    (
    $show_birthdays count($birthdays) : 0) +
    count($new_pokes);

    // page length using feed stories
    if ($orientation) {
    $ads_page_length_data max($ads_page_length_datacount($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_feeduser0null$ad_insert);
    } else if (
    can_see($user$user'feed')) {
    $feed_stories user_get_displayable_stories($user0null$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'nullfalse) : false);
    }
    tpl_set('feed_stories'$feed_stories);

    render_template($_SERVER['PHP_ROOT'].'/html/home.phpt'); 
    Apesar de que este código não significa nada, já que apenas chama e usa funções e variáveis declaradas em outros arquivos, é bem interessante conhecer a maneira de programar dos desenvolvedores da rede, que é algo muito pessoal, e saber o que se passa quando você visita a página.
    Este material pode ser compartilhado, desde que os devidos créditos sejam dados.



    Notify-list · Twitter · Blog

    Nova lei: Invadir computadores protegidos é crime.
    Lógica: Se eu invadi, não é protegido. Logo, não é crime :-)
    Similar Threads

  • Font Size
    #2
    Entenda melhor a falha: o módulo PHP do servidor web, por alguma razão, não foi acionado. Assim, o código era enviado diretamente ao usuário, sem antes passar pelo compilador. Quem já tentou rodar um script PHP sem ter o PHP instalado (apenas com o Apache) sabe como é.
    O código acima corresponde ao arquivo index.php (inicial).
    Mais códigos:
    photo.php (visualizar uma foto)
    Código PHP:
    // INIT
    include_once $_SERVER['PHP_ROOT'].'/html/init.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/share.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/wall.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/groups.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/events.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/forms_lib.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/mobile/mms/data_lib.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/notebook.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/photoprint.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/api/auth.php'// for api_param_get
    include_once $_SERVER['PHP_ROOT'].'/lib/wall.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/ratings/public.php';

    // PARAMETERS
    param_get_slashed(array('pid'   => $PARAM_INT,
                    
    'l'     => $PARAM_STRING,
                    
    'subj'  => $PARAM_INT,
                    
    'aid'   => $PARAM_SINT,
                    
    'auser' => $PARAM_INT,
                    
    'op'    => $PARAM_INT,
                    
    'id'    => $PARAM_INT,
                    
    'oid'   => $PARAM_INT,
                    
    'oview' => $PARAM_STRING,
                    
    'view'  => $PARAM_STRING,
                    
    'name'  => $PARAM_STRING,
                    
    'e'     => $PARAM_EXISTS,
                    
    'ref'   => $PARAM_STRING,
                    
    'psid'  => $PARAM_SINT,
                    
    'prev'  => $PARAM_EXISTS,
                    
    'saved' => $PARAM_EXISTS));

    if (
    $api_params api_param_get(array('uid''apid'))) {
      
    $get_id $api_params['uid'];
      
    $get_pid $api_params['apid'];
    } else {
      
    // process any POST operations here
    }
    $pid   $get_pid;
    $code  $get_l;
    $subj  $get_subj;
    $aid   $get_aid;
    $auser $get_auser;
    $opage $get_op;
    $id    $get_id;
    $oid   $get_oid;
    $psid  $get_psid;
    $oview txt_set($get_oview);
    $view  txt_set($get_view);
    $name  $get_name;
    $elink $get_e;

    $guest null;

    // try get keys if pid not present
    if (!$pid) {
      
    $id   = (int) extract_arg_from_get_key('id');
      
    $pid  = (int) extract_arg_from_get_key('pid');
      
    $code =       extract_arg_from_get_key('l');
    }

    // if $code exists, this is a guest request
    if ($pid && $code) {
      
    $guest true;
      
    $GLOBALS['AIM_MODE'] = 1;
    }
    tpl_set('guest'$guest);

    // EMAIL PHOTO TAG LINK
    if ($elink) {
      
    // This is the case in which a user received an email about being tagged
      
    $user require_login(true);
      
    $tag photos_get_email_tag($pid$subj);

      
    // Uh oh, th tag must have been removed since the user received the email
      // about it... just go to photo search!
      
    if (!$tag) {
        
    redirect('photo_search.php?id='.$user);
      }

      
    // Get all the necessary parameters from the photo tag, note that we do
      // explicitly set $get_aid in this case, as the code lower on the page should
      // behave as if aid was set as a GET parameter to this page.
      
    $aid $get_aid $tag['aid'];
      
    $id $tag['user'];
      
    $auser $tag['user'];
      
    $view $get_view 'album';
      
    $opage 1;
    }

    // validate args
    if ((!$pid || !$id) && !$psid) {
      
    // mcslee+lucas: rip debug_rlog() we will NEVER figure these out
      
    exit_standard_error_page();
    }

    // up front cache requests
    $photo_template = array();
    if (!
    $psid) {
      
    photos_get_phototemplate($pid$idtrue$photo_template);

    user_get_aim_code($idtrue);
    user_get_info_confirmed($idtrue);
    $profile = array();
    if (
    $subj && is_tuna_obj($subj)) {
      
    profile_get_short($idtrue$profile);
    } else {
      
    profile_get_short($subj $subj $idtrue$profile);
    }
    if (!
    $guest) {
      if (
    $user 0) {
        
    printshop_get_cart_items($usertrue);
      }
    }
    memcache_dispatch();

    // defer to id argument for connection handling
    if ($id) {
      if (
    check_down(id_to_db($id))) {
        
    error_redirect($error_msg "Photos Unavailable",
                       
    $error_explanation "We're sorry, photos aren't available right now.  Please try again later",
                       
    $page_title "Photos Unavailable",
                       
    $header "Photos Unavailable");
      }
    }

    $from_search = (int)($view || $subj || $aid || $name);

    // build photo search parameters
    $photoqs null;
    if (
    $from_search) {
      
    $photoqs  $oview "&o=$oview'';
      
    $photoqs .= $opage "&op=$opage'';
      
    $photoqs .= $view  "&view=$view'';
      
    $photoqs .= $subj  "&subj=$subj'';
      
    $photoqs .= $aid   "&aid=$aid'';
      
    $photoqs .= $auser "&auser=$auser'';
      
    $photoqs .= $name  '&name='.url_set($name) : '';

      
    tpl_set('photoqs'$photoqs);
    }


    /*
     * PREFETCH PHOTO DISPLAY OBJECT
     */
    if (!$psid && ($photo_template == null)) {
      
    // check to see if this is a deleted photo, this case happens all the time
      
    if ($conn id_get_conn($id) &&
          
    $ret queryf($conn'SELECT max(pid) FROM photo')) {
        
    $row mysql_fetch_row($ret);
        if (
    $row[0] < $pid) {
          
    debug_rlog('PHOTOS: invalid photo id, pid:'.$pid.' id:'.$id);
        }
      }

      
    // if they're from photo_search and are requesting a bad photo, chances are it's because
      // the pagination got screwed up... let's redirect them to a photo that's actually valid
      
    if ($from_search) {
        
    $search_meta photo_search_meta($user$opage$oview$view$subj$get_aid$auser$name);
        
    $navids  explode('-'$search_meta['photos_' $view]);
        if (
    $get_prev) {
          
    $navids array_reverse($navids);
        }
        
    $offset array_search($pid ',' $id$navids) + 1;
        
    $photo false;

        
    // loop through their photos 8 at a time and try to find one that's valid
        
    while (!$photo && ($next_photos array_slice($navids$offset8))) {
          
    $offset += 8;
          foreach (
    $next_photos as &$val) {
            
    $val array_combine(array('pid','user'), explode(','$val));
          }
          unset(
    $val);
          
    $next_photos multiget_photos($next_photos);

          foreach (
    $next_photos as $val) {
            if (
    $val) {
              
    $photo $val;
              break;
            }
          }
        }

        if (
    $photo) {
          
    redirect('photo.php?pid='.$photo['pid'].'&id='.$photo['user'].$photoqs);
        }
      }
      
    exit_standard_error_page(array('pid' => $get_pid'aid' => $get_aid'subj' => $get_subj'uid' => $get_id));
    }
    else if (
    $psid && ($photo_template printshop_get_phototemplate($pid$psid)) == null) {
      
    redirect('photoprint.php');
    }

    if (
    rand(1100000) > get_site_variable('WALL_POST_OLDEST_ENTRY_THROTTLE')) {
      if (empty(
    $photo_template['comments'])) {
        
    $time 0;
      } else {
        
    $time $photo_template['comments'][count($photo_template['comments']) - 1]['time'];
      }
      
    $message scribe_create_message('wall_survey''photo: '.$time.' '.$photo_template['created']);
      
    scribe_add_messages(array($message));


    if (
    check_super($user)) {
      
    // If we're a superuser, we can see deleted comments. These are not cached, and so we are going to fetch them manually now.
      
    $sql 'SELECT 1 AS is_deleted, `id`, `from`, `time`, `text` FROM `wall_deleted` 
                WHERE `to` = %d AND `media_type` = %d AND `media_id` = %d UNION 
              SELECT 0 AS is_deleted, `id`, `from`, `time`, `text` FROM `wall` 
                WHERE `to` = %d AND `media_type` = %d AND `media_id` = %d 
              ORDER BY `time`'
    ;
      
    $conn id_get_conn($photo_template['user']);
      if (
    $ret queryf($conn$sql$photo_template['user'], 1$pid$photo_template['user'], 1$pid)) {
        
    $photo_template['comments'] = array();
        while (
    $row mysql_fetch_assoc($ret)) {
          
    $photo_template['comments'][] = $row;
        }
      }  
    }  

    //keep track of tuna contexts
    $tuna_oids = array();
    foreach (
    $photo_template['tags'] as $tag) {
      
    $tag_subj $tag['subject'];
      if (!isset(
    $tag['pending']) &&
          
    is_tuna_obj($tag_subj) &&
          
    obj_can_see($tag_subj$user)) { //could check obj_can_see in phpt
        
    $tuna_oids[] = $tag_subj;
      }
    }
    tpl_set('tuna_oids'$tuna_oids);

    // If we're on an object photo but don't have the object id get get it
    if (!$from_search && $photo_template['aid'] == -1) {
      
    $from_search 1;

      foreach (
    $photo_template['tags'] as $tag) {
        if (
    is_tuna_obj($tag['subject'])) {
          
    $subj $tag['subject'];
          break;
        }
      }

      if (!
    $subj) {
        
    debug_rlog('Unable to find object tag for photo with aid==-1');
      }
      
      
    // Set default query parameters
      
    $view 'all';
      
    $opage 1;
      
    $aid = -1;
      
    }

    $aid $photo_template['aid'];
    $share_hrefs share_make_photo_hrefs($id$pid$subj);

    /*
     * PERMISSIONS CHECKING
     */
    $photo_guest null;
    if (
    photo_code($id) == $code) { //For legacy's sake
      
    $photos_guest true;
     } else if (
    photo_code($id$aid) == $code) {
      
    $album_guest true;
    } else if (
    photo_code($id$pid) == $code) {
      
    $photo_guest true;
    }
    tpl_set('photo_guest'$photo_guest);

    if (
    $guest && !($photos_guest || $album_guest || $photo_guest)) {
      
    exit_standard_error_page(array('pid' => $get_pid'aid' => $get_aid'subj' => $get_subj'uid' => $get_id));
    } else if (!
    $guest) {
      
    flag_allow_guest();
      
    $user require_login(true);
    }

    $is_unregistered 0;
    if (
    $user && is_unregistered($user)) {
      
    $is_unregistered 1;
    }
    tpl_set('is_unregistered'$is_unregistered);

    // Check privacy for back to profile link
    $can_see_profile can_see($user$id'profile');
    tpl_set('can_see_profile'$can_see_profile);

    // check permissions
    if (!can_see_photo($user$photo_template)) {
      
    exit_standard_error_page(array('pid' => $get_pid'aid' => $get_aid'subj' => $get_subj'uid' => $get_id));
    }

    $my_photos null;
    if (
    $user == $id ) {
      
    $my_photos 1;
    }
    tpl_set('my_photos'$my_photos);

    /*
     * SETUP PHOTO DATA
     */
    tpl_set('photo_img_src'$photo_template['img_src']);
    tpl_set('photo_order'  $photo_template['order']  );
    if (!
    is_sponsored_group_page() || !sgroup_hide_caption($subj$pid)) {
      
    tpl_set('photo_caption'txt_set_with_urls(trim($photo_template['caption'])));
    }
    tpl_set('photo_source',  $photo_template['source']);

    tpl_set('photo_img_width',  isset($photo_template['width']) ? $photo_template['width'] : null);
    tpl_set('photo_img_height', isset($photo_template['height']) ? $photo_template['height'] : null);

    /*
     * SETUP ALBUM DATA
     */
    $album_href redirect("album.php?aid=".$photo_template['aid'].'&id='.$idid_get_map($id), 0);
    if(
    $photo_template['order'] > 20$album_href .= "&page=" . ((int)(($photo_template['order']-1) / 20) + 1) ;
    if(
    $guest$album_href .= "&l=" $code;

    tpl_set('album_size'$photo_template['album_size']);
    tpl_set('album_href'$album_href);
    txt_set('album_name'$photo_template['album_name']);


    /*
     * SETUP PREV/NEXT LINKS
     */
    if ($from_search) {  // from photo_search
      
    if ($elink || $get_ref == 'nf' || $get_ref == 'mf') {
        
    // If the user came from an email link, then there is no guarantee that
        // photo_search has been called to properly populate the photo_search
        // results. Therefore, we need to call photo_search() directly instead of
        // using photo_search_meta(). This way, we always properly populate the
        // count and prev/next stuff.
        //
        // Note, this is now also true for links from feed and/or minifeed.
        
    $search photo_search($user$oview$view$subj$get_aid$auser$name$opage);
        
    $search_meta $search['meta'];
      } else {
        
    $search_meta photo_search_meta($user$opage$oview$view$subj$get_aid$auser$name);
      }

      
    $navids  explode('-'$search_meta['photos_' $view]);
      
    $current array_search($pid ',' $id$navids);
      
    $total   count($navids);

      if (
    $current === FALSE) {
        
        
    // this can happen if something has changed since the search was run, and
        // this photo no longer matches. It's ok to display it since we passed the
        // can_see checks, but prev & next don't make any sense
        
    $next null;
        
    $prev null;
        
    $next_href null;
        
    $prev_href null;

      } else {

        switch(
    $current) {
          case 
    0:         // first or only
            
    $prev = ($total==1) ? $navids[0] : $navids[$total-1];
            
    $next = ($total==1) ? $navids[0] : $navids[$current+1];
            break;
          case 
    $total-1:  // last, more than one
            
    $prev $navids[$total-2];
            
    $next $navids[0];
            break;
          default:        
    // middle
            
    $prev $navids[$current-1];
            
    $next $navids[$current+1];
            break;
        }
      }

      
    $next_pid null;
      
    $next_id null;
      if (
    $next) { 
        
    $arr array_combine(array('pid','id'), explode(',',$next));
        
    $next_href "photo.php?pid=$arr[pid]&id=$arr[id]$photoqs";
        
    $next_pid $arr['pid'];
        
    $next_id $arr['id'];
      }

      if (
    $prev) {
        
    $arr array_combine(array('pid','id'), explode(',',$prev));
        
    $prev_href 'photo.php?pid='.$arr['pid'].'&id='.$arr['id'].$photoqs.'&prev';
      }
      
      if (
    $next_oid is_obj_photo($photo_template['tags'])) {
        if (
    $next_href) {
          
    $next_href .= "&oid=$next_oid";
        }
        if (
    $prev_href) {
          
    $prev_href .= "&oid=$next_oid";
        }
      }
     
      
    tpl_set('searchqs'photo_search_qs($opage$oview$subj$get_aid$auser$name));  // used for back to search
      
    tpl_set('search_index'$current+1);
      
    tpl_set('search_total'$total);

    } else if (
    $psid) {
      
    $next_href 'photo.php?pid='.$photo_template['next'].'&psid='.$psid;
      
    $prev_href 'photo.php?pid='.$photo_template['prev'].'&psid='.$psid.'&prev';
    } else {
      
    $next_href 'photo.php?pid='.$photo_template['next'].'&id='.$id;
      
    $next_pid $photo_template['next'];
      
    $next_id $id;
      
    $prev_href 'photo.php?pid='.$photo_template['prev'].'&id='.$id.'&prev';
    }
    tpl_set('next_pid'$next_pid);
    tpl_set('next_id'$next_id);

    if(
    $guest) {
      if (
    $next_href) {
        
    $next_href .= "&l=" $code;
      }
      if (
    $prev_href) {
        
    $prev_href .= "&l=" $code;
      }
    }

    /*
     * SETUP TAGS
     */
    $next_photo null;
    if (!
    $psid) {
      
    // fetch info about the next photo
      
    if (get_site_variable('PHOTO_PREFETCHING_ON')) {
        if (
    $next_pid && $next_id) {
          
    $next_photo = array();
          
    photos_get_photo($next_pid$next_idtrue$next_photo);
        }
      }

      
    // get tag meta data
      
    tpl_set('tags'setup_tag_links($photo_template['tags'], $user$id$aid1, (is_tuna_obj($subj) ? $subj 0), $pid));
      
    // there is one of these inside setup_tag_links, but here just in case the
      // code is moved later
      
    memcache_dispatch();
     } else {
      
    tpl_set('tags', array());
     }

    // get the URL of the next image so we can do prefetching
    $next_img_src null;
    if (
    $next_photo) {  
      
    $next_img_src photos_get_url_from_photo($next_photo'n');
    }
    tpl_set('next_img_src'$next_img_src);

    tpl_set('next_href'$next_href);
    tpl_set('prev_href'$prev_href);

    /*
     * SETUP PHOTO EDIT LINKS
     */
    if ($my_photos) {
      
    $rotate_left distfs_get_upload_server() . "photos_rotate.php?pid=$pid&left=1";
      
    $rotate_right distfs_get_upload_server() . "photos_rotate.php?pid=$pid&right=1";
      
    $return urlencode("photo.php?pid=$pid&id=$user{$photoqs}");

      
    $rotate_left .= "&return=$return";
      
    $rotate_right .= "&return=$return";

      
    tpl_set('rotate_left' $rotate_left);
      
    tpl_set('rotate_right'$rotate_right);
      
      
    tpl_set('edit_href'redirect('/editphoto.php?pid='.$pidid_get_map($id), 0));
      
    tpl_set('delete_href'redirect('/editphoto.php?delete=1&pid='.$pidid_get_map($id), 0));
    }

    /*
     * DO THE PRINTSHOP STUFF
     */
    $printshop_add null;
    $is_in_cart null;
    $is_pending null;
    if (!
    $guest) {
      
    $in_cart=printshop_is_in_cart($user$aid$pid);
      if (
    $in_cart == 2) {
        
    $is_in_cart true;
      } else if (
    $in_cart == 1) {
        
    $is_pending true;
      } else if (
    $user==$id || (are_friends($user$id) && printshop_get_user_permission($id) != 1)) {
        
    $printshop_add 'pid=' $pid .'&ownid=' $id '&aid=' $aid;
      }
    }
    tpl_set('printshop_add'$printshop_add);
    tpl_set('is_in_cart'$is_in_cart);
    tpl_set('is_pending'$is_pending);

    /*
     * COMMENTS
     */
    if(!$guest) {
      
    $comments = array();
      if (
    $psid) { // printshop albums are stripped down
        
    $can_post false;
      } else if (
    $subj && is_tuna_obj($subj) && obj_is_active_member($subj$user)) { 
        
    // all memers of a tuna object can post photo comments
        // exception: photo owner has blocked viewer - see #1889
        
    $can_post = !blocked($id$user);  
      } else {
        
    $can_post photo_can_make_photo_comment($user$id);
      }

      
    tpl_set('can_post'$can_post);

        if(
    $is_unregistered) { $can_post false; }

        
    $comment_links = array('message'=>true);
        if(
    $subj && is_tuna_obj($subj)) {
          
    // display 'Report' links for photo comments in groups/events
          
    $comment_links['report'] = true;
        }

        
    // prime can_see data
        
    $comment_users = array();
        foreach (
    $photo_template['comments'] as $comment) {
          
    $comment_users[] = $comment['from'];
        }

        
    multiget_can_see($user$comment_userstrue);
        
    profile_multiget_short($comment_userstrue);
        
    memcache_dispatch();

        foreach (
    $photo_template['comments'] as $comment) {
          if ((
    $user == $id && !is_disabled_user($comment['from'])) || !blocked($user$comment['from'])) {
            
    $comment['to'] = $id;
            
    $comment['media_type'] = 1;
            
    $comment['media_id'] = $pid;
            
    $comments[] = convert_wall_to_display($comment$comment_links);
          }
        }

        if (
    $can_post) {
          
    $oid_str = (is_tuna_obj($subj) ? "&oid=$subj'');
          
    tpl_set('comment_post_url'"editwall.php?action=post&pid=$pid&id=$id$oid_str");
        }
        
    tpl_set('comments'$comments);
    }

    $is_note false;
    $is_group false
    $obj_name "";
    $is_obj_admin null;
    if (
    $subj && is_tuna_obj($subj)) {
      if(
    notebook_is_note($subj)) {
        
    $is_note true;
        
    $obj_name notebook_get_title($subj);
      } elseif (
    obj_is_group($subj)){
        
    $is_group true;
        
    $obj_name obj_get_name($subj);
      } else {
        
    $obj_name obj_get_name($subj);
      }

      if(
    $user
        
    $is_obj_admin obj_is_admin($subj$user);
    }

    tpl_set('is_note',      $is_note);
    tpl_set('is_group',     $is_group);
    tpl_set('share_hrefs',  $share_hrefs);
    tpl_set('show_save_button', !$is_unregistered);
    tpl_set('pid',          $pid);
    tpl_set('id',           $id);
    tpl_set('aid',          $aid);
    tpl_set('oid',          (is_tuna_obj($subj) ? $subj 0));
    if(
    $is_note) {
      
    tpl_set('obj_name',     $obj_name);
    } else {
      
    txt_set('obj_name',     $obj_name);
    }
    txt_set('profile_name'$profile['name']);
    txt_set('profile_id'$profile['id']);

    txt_set('owner_name',   get_short_profile_attr($id'name')); // different than profile_name if $subj is another user
    tpl_set('user',         $user);
    txt_set('view',         $get_view);
    txt_set('oview',        $get_oview);
    tpl_set('opage',        $opage);
    tpl_set('created'$photo_template['created']);
    tpl_set('subj',         $subj);
    txt_set('name',         $get_name);
    tpl_set('from_search',  $from_search);
    tpl_set('changes_saved',$get_saved);
    tpl_set('is_obj_admin'$is_obj_admin);
    tpl_set('psid',         $psid);

    $ratings_enabled false;
    if (
    is_tuna_obj($subj) && obj_is_sponsored($subj)) {
      
    $photo_contest_enabled get_site_variable('SGROUP_RATINGS_PHOTOS_ENABLED');
      if (
    $photo_contest_enabled && ratings_contest_is_active($subjCONTEST_TYPE_PHOTO)) {
        
    $ratings_enabled true;
      }
    }
    tpl_set('ratings_enabled'$ratings_enabled);

    $network_name network_get_name(id_get_primary_network($photo_template['user']));
    txt_set('network_name'$network_name);

    // $user can be < 0 in AIM mode, just use 0 there
    $falcon_id = ($user 0) ? $user 0;
    falcon_log('view_photo'$falcon_idtrue, array($photo_template['user'], id_get_primary_network($photo_template['user']), $pid));

    tpl_set('WALL_POST_MAX_LENGTH'$GLOBALS['WALL_POST_MAX_LENGTH']);

    // render
    render_template($_SERVER['PHP_ROOT'].'/html/photo.phpt'); 
    search.php (busca)
    Código PHP:
    /*
    * @author Mark Slee
    *
    * @package ubersearch
    */

    ini_set('memory_limit''100M'); // to be
    // safe we are increasing the memory limit for search

    include_once $_SERVER['PHP_ROOT'].'/html
    /init.php'
    // final
    // lib include
    include_once $_SERVER['PHP_ROOT'].'/lib/s.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/browse.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/events.php';
    include_once 
    $_SERVER['PHP_ROOT'].'/lib/websearch_classifier/websearch_classifier.php';

    flag_allow_guest();
    $user search_require_login();

    if(
    $_POST) {
    $arr us_flatten_checkboxes($_POST, array('ii'));
    $qs '?';
    foreach(
    $arr as $key=>$val) {
    $qs .= $key.'='.urlencode($val).'&';
    }
    $qs substr($qs0, (strlen($qs)-1));
    redirect($_SERVER['PHP_SELF'].$qs);
    }

    // If they performed a classmates search, these values are
    // needed to pre-populate dropdowns
    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));
    $pos strpos($get_hy':');
    if(
    $pos !== false) {
    $hsid intval(substr($get_hy0$pos));
    $hsyear intval(substr($get_hy$pos+1));
    } else {
    $hsid intval($get_hs);
    $hsyear null;
    }

    tpl_set('hs_id'$hsid);
    tpl_set('hs_name'get_high_school($hsid));
    tpl_set('hs_year'$hsyear);
    tpl_set('is_advanced_search'$get_adv);
    tpl_set('user'$user);
    tpl_set('count_total'0); // pre-set count_total for the sake of ads
    // page length

    // Events search calendar data
    param_get(array('k' => $PARAM_HEX,
    'n' => $PARAM_SINT));
    if ((
    $get_k == search_module::get_key(SEARCH_MOD_EVENTSEARCH_TYPE_AS))) {

    $EVENTS_CAL_DAYS_AHEAD 60;
    $events_begin strftime("%Y%m01"); // first of the month
    $events_end strftime("%Y%m%d"strtotime(strftime("%m/01/%Y")) +
    (
    86400 $EVENTS_CAL_DAYS_AHEAD));
    $events_params = array('dy1' => $events_begin,
    'dy2' => $events_end);

    param_get(array('c1' => $PARAM_INT'c2' => $PARAM_INT), 'evt_');
    if (isset(
    $evt_c1)) { $events_params['c1'] = $evt_c1; }
    if (isset(
    $evt_c2)) { $events_params['c2'] = $evt_c2; }
    $results events_get_calendar($user$get_n$events_params);
    tpl_set('events_date'$results['events_date']);
    }




    // Holy shit, is this the cleanest fucking frontend file you've ever seen?!
    ubersearch($_GET$embedded=false$template=true);

    // Render it
    render_template($_SERVER['PHP_ROOT'].'/html/s.phpt');

    /**
    * login function for s.php
    *
    * @author Philip Fung
    */
    function search_require_login() {

    //check if user is logged in
    $user require_login(true);

    if(
    $user 0 && !is_unregistered($user)) { return $user; }

    // this is an unregistered user
    param_get(array('k' => $GLOBALS['PARAM_HEX'], // search key
    (used by rest of ubersearch code)
    ));

    global 
    $get_k;
    $search_key $get_k;

    //Let user see event or group search if criteria are obeyed
    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
    ) {

    return 
    $user;

    } else {
    go_home();
    }

    Especula-se que o Facebook use Apenas usuários registrados e ativados podem ver os links., Clique aqui para se cadastrar... (mesmo que o site oficial do Smarty não o liste).
    Note que POO não é usado, e comentários engraçados aparecem. Mas o Smarty é baseado em POO! Fala-se que os desenvolvedores adaptaram diversas funções do Smarty, criando para ele um segundo núcleo, sem orientação a objeto. Se for verdade... trágico! Mas o site não é meu, então...
    Este material pode ser compartilhado, desde que os devidos créditos sejam dados.



    Notify-list · Twitter · Blog

    Nova lei: Invadir computadores protegidos é crime.
    Lógica: Se eu invadi, não é protegido. Logo, não é crime :-)

    Comment


    • Font Size
      #3
      0KaL , não sei se você já ouviu falar sobre o PHP Hip Hop, que o Facebook criou que nada mais era do que um compilador, que tornava o php em C++ que tornava o php mais rapido . De qualquer forma a minha dúvida não é essa, mas sim, se você sabe se o facebook, não utilizava o PHP Hip Hop na epoca ?
      É que nunca chegeui a testar o HipHop e pelo que vejo você é o usuario que tem mais conhecimento de PHP daqui.

      Sobre a questão de Ser o ou não OOP, acredito que seja porque ná epoca de criação do Projeto, OOP não era algo consolidado, ( apesar do conseito e implementação ser velha ), ou quem sabe o projeto foi feito a principio com a forma estruturada, pq o Mark não tinha conhecimento ainda de OOP, e como se tornou largamente amplo, não seria fácil reescrever todo o código. Ou mais uma teoria, pode ser que ele chamou programadores de C ( não C++ ), experientes já que C tem muito mais controle de aspectos de hard e gerenciamento de memoria, para programar o facebook em PHP, e utilizar as funções mais proximas do C dentro do PHP ... mas isso é só teorias, para mim, tanto faz o resultado final do facebook, mas em meus projetos OOP é padrão assim como TDD e MVC. De qualquer forma, não tenho tanta experiencia, sou noob, ainda.

      Comment


      • Font Size
        #4
        Dizem que o Facebook usa C++ para algumas tarefas, já que tem melhor performance.
        Conheço o HipHopPHP sim, Até acredito que eles usam.
        O OOP torna a execução do código mais rápida, fora que fica melhor para um humano entender também. Acredito que valha à pena começar a reescrever porções do código kkk
        Mas, como você disse, tudo são especulações. Essas partes vazadas do Facebook são apenas a parte responsável pelo front-end, e o que nos sobra são apenas teorias...
        Este material pode ser compartilhado, desde que os devidos créditos sejam dados.



        Notify-list · Twitter · Blog

        Nova lei: Invadir computadores protegidos é crime.
        Lógica: Se eu invadi, não é protegido. Logo, não é crime :-)

        Comment


        • Font Size
          #5
          0KaL, bacana, me tira uma duvida?

          Esse codigo que voce postou é possivelmente o original.

          Te perguntar uma coisa.

          Voce ja viu o script clone do facebook?

          È o mesmo que esse que voce postou?

          Se tem diferença qual seria?( tirando a diferença que esse que tu postou é só uma parte.)

          Obrigado pelo post, muito bacana.
          WhiteCollarGroup till I die
          MI5, MI6,NSA,FBI,Army, CIA,Navy,Air Force, Mossad, PF and all this shit can't stop me.

          Comment


          • Font Size
            #6
            Bom, já vi vários clones do Facebook, mas acredito que nenhum deles tenha os códigos originais, já que foram pouquíssimos os vazados.
            Este material pode ser compartilhado, desde que os devidos créditos sejam dados.



            Notify-list · Twitter · Blog

            Nova lei: Invadir computadores protegidos é crime.
            Lógica: Se eu invadi, não é protegido. Logo, não é crime :-)

            Comment

            X
            Working...
            X