. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include('config.php'); include(mnminclude.'html1.php'); include(mnminclude.'link.php'); include(mnminclude.'comment.php'); include(mnminclude.'user.php'); include(mnminclude.'geo.php'); $offset=(get_current_page()-1)*$page_size; $globals['ads'] = true; if (!empty($globals['base_user_url']) && !empty($_SERVER['PATH_INFO'])) { $url_args = preg_split('/\/+/', $_SERVER['PATH_INFO']); array_shift($url_args); // The first element is always a "/" $_REQUEST['login'] = clean_input_string($url_args[0]); $_REQUEST['view'] = $url_args[1]; } else { $_REQUEST['login'] = clean_input_string($_REQUEST['login']); if (!empty($globals['base_user_url']) && !empty($_REQUEST['login'])) { header('Location: ' . get_user_uri($_REQUEST['login'], clean_input_string($_REQUEST['view']))); die; } } $login = $_REQUEST['login']; if(empty($login)){ if ($current_user->user_id > 0) { header('Location: ' . get_user_uri($current_user->user_login)); die; } else { header('Location: '.$globals['base_url']); die; } } $user=new User(); $user->username = $db->escape($login); if(!$user->read()) { not_found(); } // Enable user AdSense // do_user_ad: 0 = noad, > 0: probability n/100 // 100 if the user is the current one if($globals['external_user_ads'] && !empty($user->adcode)) { $globals['user_adcode'] = $user->adcode; $globals['user_adchannel'] = $user->adchannel; if ($current_user->user_id == $user->id || $current_user->user_level=='god') $globals['do_user_ad'] = 100; else $globals['do_user_ad'] = $user->karma * 2; } $view = clean_input_string($_REQUEST['view']); if(empty($view)) $view = 'profile'; // Load Google GEO if ($view == 'profile' && $globals['google_maps_api'] && (($globals['latlng']=$user->get_latlng()) || $current_user->user_id == $user->id)) { if ($current_user->user_id == $user->id) geo_init('geo_coder_editor_load', $globals['latlng'], 7, 'user'); else geo_init('geo_coder_load', $globals['latlng'], 7, 'user'); $globals['do_geo'] = true; } switch ($view) { case 'history': case 'commented': case 'shaken': case 'friends': case 'favorites': $globals['noindex'] = true; } do_header($login); do_banner_top(); echo '
' . "\n"; echo '
'."\n"; $url_login = urlencode($login); switch ($view) { case 'history': do_user_tabs(2, $login); do_history(); do_pages($rows, $page_size); break; case 'commented': do_user_tabs(3, $login); do_commented(); do_pages($rows, $page_size, false); break; case 'shaken': do_user_tabs(4, $login); do_shaken(); do_pages($rows, $page_size); break; // Disabls becuase affiliation was also disabled /********** case 'preferred': do_user_tabs(5, $login); do_voters_preferred(); break; ***********/ case 'friends': do_user_tabs(7, $login); do_friends(); break; case 'favorites': do_user_tabs(6, $login); do_favorites(); do_pages($rows, $page_size); break; case 'profile': default: do_user_tabs(1, $login); do_profile(); break; } echo '
'."\n"; do_footer(); function do_profile() { global $user, $current_user, $login, $db, $globals; if(!empty($user->url)) { if ($user->karma < 10) $nofollow = 'rel="nofollow"'; if (!preg_match('/^http/', $user->url)) $url = 'http://'.$user->url; else $url = $user->url; } $post = new Post; if ($post->read_last($user->id)) { echo '
    '; $post->print_summary(); echo "
\n"; } echo '
'; echo _('información personal'); if($login===$current_user->user_login) { echo ' ('._('modificar').')'; } elseif ($current_user->user_level == 'god') { echo ' ('._('modificar').')'; } echo ''; // Avatar echo ''.$user->username.''; // Geo div echo '
'; if($globals['do_geo']) { echo '
'; if ($current_user->user_id > 0 && $current_user->user_id != $user->id && $globals['latlng'] && ($my_latlng = geo_latlng('user', $current_user->user_id))) { $distance = (int) geo_distance($my_latlng, $globals['latlng']); echo '

'._('estás a')." $distance kms "._('de').' '.$user->username.'

'; } } echo ' 
'; echo '
'; echo '
'; if(!empty($user->username)) { echo '
'._('usuario').':
'; if (!empty($url)) { echo ''.$user->username.''; } else { echo $user->username; } // Print friend icon if ($current_user->user_id > 0 && $current_user->user_id != $user->id) { echo ' '.friend_teaser($current_user->user_id, $user->id).''; } // Print user detailed info if ($login===$current_user->user_login || $current_user->user_level == 'god') { echo " (" . _('id'). ": $user->id)"; echo " ($user->level)"; } if($current_user->user_level=='god') { echo " ($user->username_register)"; } echo '
'; } if(!empty($user->names)) { echo '
'._('nombre').':
'.$user->names.'
'; } // Show public info is it's a friend or god if($current_user->user_id > 0 && !empty($user->public_info) && ( $current_user->user_id == $user->id || $current_user->user_level=='god' /*|| friend_exists($user->id, $current_user->user_id)*/ )) { //friends cannot see the IM address (it was public before) echo '
'._('IM/email').':
'.$user->public_info.'
'; } if(!empty($url)) { echo '
'._('sitio web').':
'.$url.'
'; } echo '
'._('desde').':
'.get_date_time($user->date).'
'; if($current_user->user_level=='god') { echo '
'._('email').':
'.$user->email. " ($user->email_register)
"; } if ($user->id == $current_user->user_id || $current_user->user_level=='god' ) { echo '
'._('clave API').':
('._('mantenla siempre en secreto').') '._('leer clave API').'
'; if(!empty($user->adcode)) { echo '
'._('Código AdSense').':
'.$user->adcode.' 
'; echo '
'._('Canal AdSense').':
'.$user->adchannel.' 
'; } } echo '
'._('karma').':
'.$user->karma.'
'; $user->all_stats(); echo '
'._('noticias enviadas').':
'.$user->total_links.'
'; if ($user->total_links > 0 && $user->published_links > 0) { $percent = intval($user->published_links/$user->total_links*100); } else { $percent = 0; } if ($user->total_links > 1) { $entropy = intval(($user->blogs() - 1) / ($user->total_links - 1) * 100); echo '
'._('entropía').':
'.$entropy.'%
'; } echo '
'._('noticias publicadas').':
'.$user->published_links.' ('.$percent.'%)
'; echo '
'._('comentarios').':
'.$user->total_comments.'
'; echo '
'._('número de votos').':
'.$user->total_votes.'
'; echo '
'; // Karma details if ($user->id == $current_user->user_id || $current_user->user_level=='god' ) { echo ''; } echo '
'; echo '
'; // Print GEO form if($globals['do_geo'] && $current_user->user_id == $user->id) { echo '
'; geo_coder_print_form('user', $current_user->user_id, $globals['latlng'], _('ubícate en el mapa (si te apetece)'), 'user'); echo '
'; } // Show first numbers of the address if the user has god privileges if ($current_user->user_level == 'god' && $user->level != 'god' && $user->level != 'admin' ) { // tops and admins know each other for sure, keep privacy $addresses = $db->get_results("select INET_NTOA(vote_ip_int) as ip from votes where vote_type='links' and vote_user_id = $user->id and vote_date > date_sub(now(), interval 30 day) order by vote_date desc limit 1000"); // Try with comments if (! $addresses) { $addresses = $db->get_results("select comment_ip as ip from comments where comment_user_id = $user->id and comment_date > date_sub(now(), interval 30 day) order by comment_date desc limit 1000"); } // Not addresses to show if (! $addresses) { return; } $clone_counter = 0; echo '
'._('últimas direcciones IP').''; echo '
    '; $prev_address = ''; foreach ($addresses as $dbaddress) { $ip_pattern = preg_replace('/\.[0-9]+$/', '', $dbaddress->ip); if($ip_pattern != $prev_address) { echo '
  1. '. $ip_pattern . ':
  2. '; $clone_counter++; $prev_address = $ip_pattern; if ($clone_counter >= 30) break; } } echo '
'; echo '
'; } } function do_history () { global $db, $rows, $user, $offset, $page_size, $globals; $link = new Link; $rows = $db->get_var("SELECT count(*) FROM links WHERE link_author=$user->id AND link_votes > 0"); $links = $db->get_col("SELECT link_id FROM links WHERE link_author=$user->id AND link_votes > 0 ORDER BY link_date DESC LIMIT $offset,$page_size"); if ($links) { echo '
'; echo 'Mozilla bookmark'; echo '  rss2'; echo '
'; foreach($links as $link_id) { $link->id=$link_id; $link->read(); $link->print_summary('short'); } } } function do_favorites () { global $db, $rows, $user, $offset, $page_size, $globals; $link = new Link; $rows = $db->get_var("SELECT count(*) FROM favorites WHERE favorite_user_id=$user->id"); $links = $db->get_col("SELECT link_id FROM links, favorites WHERE favorite_user_id=$user->id AND favorite_link_id=link_id ORDER BY link_date DESC LIMIT $offset,$page_size"); if ($links) { echo '
'; echo 'Mozilla bookmark'; echo '  rss2'; echo '
'; foreach($links as $link_id) { $link->id=$link_id; $link->read(); $link->print_summary('short'); } } } function do_shaken () { global $db, $rows, $user, $offset, $page_size, $globals; if ($globals['bot']) return; $link = new Link; $rows = $db->get_var("SELECT count(*) FROM links, votes WHERE vote_type='links' and vote_user_id=$user->id AND vote_link_id=link_id and vote_value > 0"); $links = $db->get_col("SELECT link_id FROM links, votes WHERE vote_type='links' and vote_user_id=$user->id AND vote_link_id=link_id and vote_value > 0 ORDER BY link_date DESC LIMIT $offset,$page_size"); if ($links) { echo 'Mozilla bookmark'; foreach($links as $link_id) { $link->id=$link_id; $link->read(); $link->print_summary('short'); } echo '
'._('Nota').': ' . _('sólo se visualizan los votos de los últimos meses') . '
'; } } function do_commented () { global $db, $rows, $user, $offset, $page_size, $globals; if ($globals['bot']) return; $link = new Link; $comment = new Comment; $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id=$user->id"); $comments = $db->get_results("SELECT comment_id, link_id FROM comments, links WHERE comment_user_id=$user->id and link_id=comment_link_id ORDER BY comment_date desc LIMIT $offset,$page_size"); if ($comments) { echo '
'; echo 'Mozilla bookmark'; echo '  rss2'; echo '
'; foreach ($comments as $dbcomment) { $link->id=$dbcomment->link_id; $comment->id = $dbcomment->comment_id; if ($last_link != $link->id) { $link->read(); echo '

'; echo ''. $link->title. ''; echo ' ['.$link->comments.']'; echo '

'; $last_link = $link->id; } $comment->read(); echo '
    '; $comment->print_summary($link, 2000, false); echo "
\n"; } } } /************ function do_voters_preferred() { global $db, $user; echo '
'; echo _('autores preferidos'); echo ''; $prefered_id = $user->id; $prefered_type = 'friends'; echo '
'. "\n"; require('backend/get_prefered_bars.php'); echo '
'. "\n"; echo '
'. "\n"; echo '
'; echo _('votado por'); echo ''; $prefered_id = $user->id; $prefered_type = 'voters'; echo '
'. "\n"; require('backend/get_prefered_bars.php'); echo '
'. "\n"; echo '
'. "\n"; echo '
'; // Show first numbers of the addresss if the user has god privileges if ($current_user->user_level == 'god' && $user->level != 'god' && $user->level != 'admin' ) { // tops and admins know each other for sure, keep privacy $addresses = $db->get_results("select distinct INET_NTOA(vote_ip_int) as ip from votes where vote_type='links' and vote_user_id = $user->id and vote_date > date_sub(now(), interval 60 day) order by vote_date desc limit 20"); // Try with comments if (! $addresses) { $addresses = $db->get_results("select distinct comment_ip as ip from comments where comment_user_id = $user->id and comment_date > date_sub(now(), interval 60 day) order by comment_date desc limit 20"); } // Not addresses to show if (! $addresses) { return; } $clone_counter = 0; echo '
'._('últimas direcciones IP').''; echo '
    '; foreach ($addresses as $dbaddress) { $ip_pattern = preg_replace('/\.[0-9]+$/', '', $dbaddress->ip); echo '
  1. '. $ip_pattern . ':
  2. '; $clone_counter++; } echo '
'; echo '
'; } } ***************/ function do_friends() { global $db, $user, $globals; echo '
'; echo 'rss2'; echo '
'; echo '
'; echo _('amigos'); echo ''; $prefered_id = $user->id; $prefered_type = 'from'; echo '
'. "\n"; require('backend/get_friends_bars.php'); echo '
'. "\n"; echo '
'. "\n"; echo '
'; echo _('elegido por'); echo ''; $prefered_id = $user->id; $prefered_type = 'to'; echo '
'. "\n"; require('backend/get_friends_bars.php'); echo '
'. "\n"; echo '
'. "\n"; echo '
'; } function do_user_tabs($option, $user) { global $globals, $current_user; $active = array(); $active[$option] = 'class="tabsub-this"'; echo ''; } ?>