$img = "random.jpg"; } if ($img == 'local_img/') { $img = "random.jpg"; } if (strlen($web) > 1) { if (strlen($web) > 50) { $webl = substr($web, 0, 47) . "..."; } else { $webl = $web; } $web = str_replace("http://", "", $web); } else { $webl = ""; } $distancia = (int) geo_distance($_SESSION["Latitude"], $_SESSION["Longitude"], $latt, $lonn); if ($long != "") { if (strlen($long) > 80) { $long = substr($long, 0, 77) . "..."; } $divtit = '<div style="height:15px;" class="estilo2v3"><b>' . $long . '</b></div>'; } else { $divtit = ""; } $type = $prodrow['type']; if ($type) { $verty = mysql_query("SELECT * FROM tipos_locales WHERE id = '{$type}'"); $vertya = mysql_fetch_array($verty); $typen = $vertya['nombre']; if ($typen != "") { $divtip = '<div style="height:18px;"><b><a class="estilo2v3">Categoria: ' . $typen . '</a></b></div>';
$descri = $prodrow['name']; $coord = $prodrow['lat']; $coord = $coord . "," . $prodrow['lng']; $latt = $prodrow['lat']; $lonn = $prodrow['lng']; $long = $prodrow['descripcion']; $vlong = $prodrow['desc_long']; $titulo_f = $prodrow['titulo_f']; $img = $prodrow['image']; if ($img == '') { $img = "random.jpg"; } $ph = $prodrow['phone']; } $vlong = substr($vlong, 0, 400); $distancia = (int) geo_distance($location["Latitude"], $location["Longitude"], $latt, $lonn); ?> <div style=" padding-right:2px;"> <table width="100%" border="0" cellpadding="4" cellspacing="4" class="roudlite_g_b" > <tr> <td colspan="2" align="left" class="roudlite_g_a" ><a class="invitado_home2"><strong>QueComes!? recomienda:</strong></a><br /> </td> </tr> <tr> <td width="19%" rowspan="2"><img src="resize_image.php?image=<?php echo $img; ?> &new_width=130&new_height=130"></td> <td width="81%" align="left"><a class="invitado_home2" href="sitio/<?php echo $titulo_f; ?>
function do_profile() { global $user, $current_user, $login, $db, $globals; $options = array(); $options[$user->username] = get_user_uri($user->username); $options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories'); if ($current_user->user_id == $user->id || $current_user->user_level == 'god') { $options[_('modificar perfil').' →'] = $globals['base_url'].'profile.php?login='******'rss2.php?sent_by='.$user->id, _('envíos en rss2')); 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; } // Print last user's note $post = new Post; if ($post->read_last($user->id)) { echo '<div id="addpost"></div>'; echo '<ol class="comments-list" id="last_post">'; echo '<li>'; $post->print_summary(); echo '</li>'; echo "</ol>\n"; } echo '<fieldset><legend>'; echo _('información personal'); echo '</legend>'; // Avatar echo '<div style="float:right;text-align:center">'; echo '<img id="avatar" class="avatar" src="'.get_avatar_url($user->id, $user->avatar, 80).'" width="80" height="80" alt="'.$user->username.'" title="avatar" />'; // Print the button and associated div to change the avatar if ($current_user->user_id == $user->id) { echo '<div id="avatar_indicator" style="margin:0;padding:0;height:12px"></div>'; echo '<button id="avatar_upload" style="margin:0" title="'._('imagen cuadrada de no más de 400 KB, sin transparencias').'">'._('cambiar avatar').'</button>'."\n"; @include(mnminclude.'foreign/avatar_upload.html'); } echo '</div>'; // Geo div echo '<div style="width:140px; float:left;">'; if($globals['do_geo']) { echo '<div id="map" class="thumbnail" style="width:130px; height:130px; overflow:hidden; float:left"></div>'; 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 '<p style="color: #FF9400; font-size: 90%">'."$user->username "._('está a')." <strong>$distance kms</strong></p>"; } } echo ' </div>'; echo '<div style="float:left;min-width:65%">'; echo '<dl>'; if(!empty($user->username)) { echo '<dt>'._('usuario').':</dt><dd>'; if (!empty($url)) { echo '<a href="'.$url.'" '.$nofollow.'>'.$user->username.'</a>'; } else { echo $user->username; } $user->print_medals(); $clones_from = "and clon_date > date_sub(now(), interval 30 day)"; if ($current_user->admin && ($nclones = $db->get_var("select count(distinct clon_to) from clones where clon_from = $user->id $clones_from")) > 0 ) { echo ' (<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/ip_clones.php?id='. $user->id.'\', \''. _('clones por IP'). '\')" title="'._('clones').'">'._('clones').'</a><sup>'.$nclones.'</sup>) '; } // Print friend icon if ($current_user->user_id > 0 && $current_user->user_id != $user->id) { echo ' <a id="friend-'.$current_user->user_id.'-'.$user->id.'" href="javascript:get_votes(\'get_friend.php\',\''.$current_user->user_id.'\',\'friend-'.$current_user->user_id.'-'.$user->id.'\',0,\''.$user->id.'\')">'.User::friend_teaser($current_user->user_id, $user->id).'</a>'; } // Print user detailed info if ($user->id==$current_user->user_id || $current_user->admin) { echo " (" . _('id'). ": <em>$user->id</em>, "; echo "<em>$user->level</em>)"; } if($current_user->user_level=='god') { echo " (<em>$user->username_register</em>)"; } echo '</dd>'; } if(!empty($user->names)) { echo '<dt>'._('nombre').':</dt><dd>'.$user->names.'</dd>'; } // 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 '<dt>'._('IM/email').':</dt><dd> '.$user->public_info.'</dd>'; } if(!empty($url)) { echo '<dt>'._('sitio web').':</dt><dd><a href="'.$url.'" '.$nofollow.'>'.$url.'</a></dd>'; } echo '<dt>'._('desde').':</dt><dd>'.get_date_time($user->date).'</dd>'; if($current_user->user_level=='god') { echo '<dt>'._('email').':</dt><dd>'.$user->email. " (<em>$user->email_register</em>)</dd>"; } if ($user->id == $current_user->user_id || $current_user->user_level=='god' ) { echo '<dt>'._('clave API').':</dt><dd id="api-key"><a href="javascript:get_votes(\'get_user_api_key.php\',\'\',\'api-key\',0,\''.$user->id.'\')">'._('leer clave API').'</a> ('._('no la divulgues').')</dd>'; if(!empty($user->adcode)) { echo '<dt>'._('Código AdSense').':</dt><dd>'.$user->adcode.' </dd>'; echo '<dt>'._('Canal AdSense').':</dt><dd>'.$user->adchannel.' </dd>'; } } echo '<dt>'._('karma').':</dt><dd>'.$user->karma; // Karma details if ($user->id == $current_user->user_id || $current_user->user_level=='god' ) { echo ' (<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/get_karma_numbers.php?id='.$user->id.'\', \''. _('cálculo del karma'). '\')" title="'._('detalles').'">'._('detalle cálculo').'</a>)'; } echo '</dd>'; echo '<dt>'._('ranking').':</dt><dd>#'.$user->ranking().'</dd>'; $user->all_stats(); echo '<dt>'._('noticias enviadas').':</dt><dd>'.$user->total_links.'</dd>'; 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 '<dt><em>'._('entropía').'</em>:</dt><dd>'.$entropy.'%</dd>'; } echo '<dt>'._('noticias publicadas').':</dt><dd>'.$user->published_links.' ('.$percent.'%)</dd>'; echo '<dt>'._('comentarios').':</dt><dd>'.$user->total_comments.'</dd>'; echo '<dt>'._('notas').':</dt><dd>'.$user->total_posts.'</dd>'; echo '<dt>'._('número de votos').':</dt><dd>'.$user->total_votes.'</dd>'; // Print affinity to this user if ($current_user->user_id && ($aff_to = User::get_affinity($user->id, $current_user->user_id))) { $aff_to = round($aff_to/100, 2); echo '<dt><strong>'._('afinidad con este usuario').'</strong>:</dt><dd>'.$aff_to .'</dd>'; } echo '</dl>'; if ($user->id == $current_user->user_id) { echo '<div style="margin-top: 20px" align="center">'; print_oauth_icons($_REQUEST['return']); echo '</div>'."\n"; } echo '</div>'; echo '</fieldset>'; // Print GEO form if($globals['do_geo'] && $current_user->user_id == $user->id) { echo '<div class="geoform">'; geo_coder_print_form('user', $current_user->user_id, $globals['latlng'], _('ubícate en el mapa (si te apetece)'), 'user'); echo '</div>'; } // Print a chart of the last 30 days activity if ($user->total_votes > 20 && ($current_user->user_id == $user->id || $current_user->admin)) { echo '<fieldset><legend>'._('votos/hora últimos 30 días').'</legend>'; // Call to generate HMTL and javascript for the Flot chart echo '<script src="'.$globals['base_static'].'js/jquery.flot.min.js" type="text/javascript"></script>'."\n"; //echo '<div id="flot" style="width:600px;height:150px;"></div>'."\n"; echo '<div id="flot" style="width:100%;height:150px;"></div>'."\n"; @include (mnminclude.'foreign/chart_user_votes_history.js'); echo '</fieldset>'; } // Show first numbers of the address if the user has god privileges if ($current_user->user_level == 'god' && ! $user->admin ) { // gods 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 order by vote_date desc limit 30"); // 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 30"); } if (! $addresses) { // Use register IP $addresses = $db->get_results("select user_ip as ip from users where user_id = $user->id"); } // Not addresses to show if (! $addresses) { return; } $clone_counter = 0; echo '<fieldset><legend>'._('últimas direcciones IP').'</legend>'; $prev_address = ''; foreach ($addresses as $dbaddress) { $ip_pattern = preg_replace('/\.[0-9]+$/', '', $dbaddress->ip); if($ip_pattern != $prev_address) { echo '<p>'. $ip_pattern . '</p>'; $clone_counter++; $prev_address = $ip_pattern; if ($clone_counter >= 30) break; } } echo '</fieldset>'; } }
<?php function geo_distance($lafrom, $lofrom, $lato, $loto) { $er = "6366.707"; //$latFrom=deg2rad($from->lat); //$latTo=deg2rad($to->lat); //$lngFrom=deg2rad($from->lng); //$lngTo=deg2rad($to->lng); $latFrom = deg2rad($lafrom); $latTo = deg2rad($lato); $lngFrom = deg2rad($lofrom); $lngTo = deg2rad($loto); $x1 = $er * cos($lngFrom) * sin($latFrom); $y1 = $er * sin($lngFrom) * sin($latFrom); $z1 = $er * cos($latFrom); $x2 = $er * cos($lngTo) * sin($latTo); $y2 = $er * sin($lngTo) * sin($latTo); $z2 = $er * cos($latTo); $d = acos(sin($latFrom) * sin($latTo) + cos($latFrom) * cos($latTo) * cos($lngTo - $lngFrom)) * $er; return $d; } $mylat = 40.596701; $mylon = -3.248165; $tolat = 38.695824; $tolon = -0.474129; $distancia = (int) geo_distance($mylat, $mylon, $tolat, $tolon); echo $distancia;
include_once mnminclude . 'geo.php'; if (empty($_GET['id'])) { die; } $id = intval($_GET['id']); $user = new User(); $user->id = $id; if (!$user->read()) { die; } if ($user->avatar) { echo '<div style="float: left;"><img hspace="4" src="' . get_avatar_url($user->id, $user->avatar, 80) . '" width="80" height="80" alt="' . $user->username . '"/></div>'; } echo '<strong>' . _('usuario') . ':</strong> ' . $user->username; if ($current_user->user_id > 0 && $current_user->user_id != $user->id) { echo ' ' . friend_teaser($current_user->user_id, $user->id); } echo '<br/>'; echo '<strong>' . _('nombre') . ':</strong> ' . $user->names . '<br/>'; echo '<strong>' . _('web') . ':</strong> ' . $user->url . '<br/>'; echo '<strong>' . _('karma') . ':</strong> ' . $user->karma . '<br/>'; echo '<strong>' . _('desde') . ':</strong> ' . get_date($user->date) . '<br/>'; if ($current_user->user_id > 0 && $current_user->user_id != $user->id && ($her_latlng = geo_latlng('user', $user->id)) && ($my_latlng = geo_latlng('user', $current_user->user_id))) { $distance = (int) geo_distance($my_latlng, $her_latlng); echo '<strong>' . _('distancia') . ':</strong> ' . $distance . ' kms<br/>'; } $post = new Post(); if ($post->read_last($user->id)) { echo '<br clear="left"><strong>' . _('última nota') . '</strong>: '; $post->print_text(); }
$img_n = "random.jpg"; } if ($img_n == 'local_img/') { $img_n = "random.jpg"; } if (strlen($web_n) > 1) { if (strlen($web_n) > 50) { $webl_n = substr($web_n, 0, 47) . "..."; } else { $webl_n = $web_n; } $web_n = str_replace("http://", "", $web_n); } else { $webl_n = ""; } $distancia_n = geo_distance($sitio_latt_n, $sitio_lonn_n, $latt, $lonn); if ($distancia_n < 1) { $distancia_n = round($distancia_n * 1000, 0) . " metros"; } else { $distancia_n = $distancia_n . " kms"; } if ($long_n != "") { if (strlen($long_n) > 30) { $long = substr($long_n, 0, 27) . "..."; } $divtit_n = '<div style="height:15px;" class="estilo2v3"><b>' . $long_n . '</b></div>'; } else { $divtit_n = ""; } $type_n = $prodrow['type']; if ($vlong_n != "") {
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 '<ol class="comments-list" id="last_post">'; $post->print_summary(); echo "</ol>\n"; } echo '<fieldset><legend>'; echo _('información personal'); if ($login === $current_user->user_login) { echo ' (<a href="' . $globals['base_url'] . 'profile.php">' . _('modificar') . '</a>)'; } elseif ($current_user->user_level == 'god') { echo ' (<a href="' . $globals['base_url'] . 'profile.php?login='******'">' . _('modificar') . '</a>)'; } echo '</legend>'; // Avatar echo '<img class="thumbnail" src="' . get_avatar_url($user->id, $user->avatar, 80) . '" width="80" height="80" alt="' . $user->username . '" title="avatar" />'; // Geo div echo '<div style="width:140px; float:left;">'; if ($globals['do_geo']) { echo '<div id="map" class="thumbnail" style="width:130px; height:130px; overflow:hidden; float:left"></div>'; 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 '<p style="color: #FF9400; font-size: 90%">' . _('estás a') . " <strong>{$distance} kms</strong> " . _('de') . ' ' . $user->username . '</p>'; } } echo ' </div>'; echo '<div style="float:left;min-width:65%">'; echo '<dl>'; if (!empty($user->username)) { echo '<dt>' . _('usuario') . ':</dt><dd>'; if (!empty($url)) { echo '<a href="' . $url . '" ' . $nofollow . '>' . $user->username . '</a>'; } else { echo $user->username; } // Print friend icon if ($current_user->user_id > 0 && $current_user->user_id != $user->id) { echo ' <a id="friend-' . $current_user->user_id . '-' . $user->id . '" href="javascript:get_votes(\'get_friend.php\',\'' . $current_user->user_id . '\',\'friend-' . $current_user->user_id . '-' . $user->id . '\',0,\'' . $user->id . '\')">' . friend_teaser($current_user->user_id, $user->id) . '</a>'; } // Print user detailed info if ($login === $current_user->user_login || $current_user->user_level == 'god') { echo " (" . _('id') . ": <em>{$user->id}</em>)"; echo " (<em>{$user->level}</em>)"; } if ($current_user->user_level == 'god') { echo " (<em>{$user->username_register}</em>)"; } echo '</dd>'; } if (!empty($user->names)) { echo '<dt>' . _('nombre') . ':</dt><dd>' . $user->names . '</dd>'; } // 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')) { //friends cannot see the IM address (it was public before) echo '<dt>' . _('IM/email') . ':</dt><dd> ' . $user->public_info . '</dd>'; } if (!empty($url)) { echo '<dt>' . _('sitio web') . ':</dt><dd><a href="' . $url . '" ' . $nofollow . '>' . $url . '</a></dd>'; } echo '<dt>' . _('desde') . ':</dt><dd>' . get_date_time($user->date) . '</dd>'; if ($current_user->user_level == 'god') { echo '<dt>' . _('email') . ':</dt><dd>' . $user->email . " (<em>{$user->email_register}</em>)</dd>"; } if ($user->id == $current_user->user_id || $current_user->user_level == 'god') { echo '<dt>' . _('clave API') . ':</dt><dd id="api-key"><a href="javascript:get_votes(\'get_user_api_key.php\',\'\',\'api-key\',0,\'' . $user->id . '\')">' . _('leer clave API') . '</a> (' . _('no la divulgues') . ')</dd>'; if (!empty($user->adcode)) { echo '<dt>' . _('Código AdSense') . ':</dt><dd>' . $user->adcode . ' </dd>'; echo '<dt>' . _('Canal AdSense') . ':</dt><dd>' . $user->adchannel . ' </dd>'; } } echo '<dt>' . _('karma') . ':</dt><dd>' . $user->karma; // Karma details if ($user->id == $current_user->user_id || $current_user->user_level == 'god') { echo ' (<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_karma_numbers.php?id=' . $user->id . '\', \'' . _('cálculo del karma') . '\')" title="' . _('detalles') . '">' . _('detalle cálculo') . '</a>)'; } echo '</dd>'; $user->all_stats(); echo '<dt>' . _('noticias enviadas') . ':</dt><dd>' . $user->total_links . '</dd>'; 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 '<dt><em>' . _('entropía') . '</em>:</dt><dd>' . $entropy . '%</dd>'; } echo '<dt>' . _('noticias publicadas') . ':</dt><dd>' . $user->published_links . ' (' . $percent . '%)</dd>'; echo '<dt>' . _('comentarios') . ':</dt><dd>' . $user->total_comments . '</dd>'; echo '<dt>' . _('notas') . ':</dt><dd>' . $user->total_posts . '</dd>'; echo '<dt>' . _('número de votos') . ':</dt><dd>' . $user->total_votes . '</dd>'; echo '</dl>'; echo '</div>'; echo '</fieldset>'; // Print GEO form if ($globals['do_geo'] && $current_user->user_id == $user->id) { echo '<div class="geoform">'; geo_coder_print_form('user', $current_user->user_id, $globals['latlng'], _('ubícate en el mapa (si te apetece)'), 'user'); echo '</div>'; } // 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} order by vote_date desc limit 30"); // 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 30"); } // Not addresses to show if (!$addresses) { return; } $clone_counter = 0; echo '<fieldset><legend>' . _('últimas direcciones IP') . '</legend>'; echo '<ol>'; $prev_address = ''; foreach ($addresses as $dbaddress) { $ip_pattern = preg_replace('/\\.[0-9]+$/', '', $dbaddress->ip); if ($ip_pattern != $prev_address) { echo '<li>' . $ip_pattern . ': <span id="clone-container-' . $clone_counter . '"><!--<a href="javascript:get_votes(\'ip_clones.php\',\'' . $ip_pattern . '\',\'clone-container-' . $clone_counter . '\',0,' . $user->id . ')" title="' . _('clones') . '">»»</a>--></span></li>'; $clone_counter++; $prev_address = $ip_pattern; if ($clone_counter >= 30) { break; } } } echo '</ol>'; echo '</fieldset>'; } }