function do_register0() { echo '<div class="recoverpass" style="text-align:center"><h4><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></h4></div>'; echo '<form action="' . get_auth_link() . 'register.php" method="post" id="thisform" onSubmit="return check_checkfield(\'acceptlegal\', \'' . _('no has aceptado las condiciones de uso') . '\')">' . "\n"; echo '<fieldset>' . "\n"; echo '<legend><span class="sign">' . _("datos del usuario") . '</span></legend>' . "\n"; echo '<p><label for="name">' . _("nombre de usuario") . ':</label><br />' . "\n"; echo '<input type="text" name="username" id="name" value="" onkeyup="enablebutton(this.form.checkbutton1, this.form.submit, this)" size="25" tabindex="1"/>' . "\n"; echo '<span id="checkit"><input type="button" class="button" id="checkbutton1" disabled="disabled" value="' . _('verificar') . '" onclick="checkfield(\'username\', this.form, this.form.username)"/></span>' . "\n"; echo ' <span id="usernamecheckitvalue"></span></p>' . "\n"; echo '<p><label for="email">email:</label><br />' . "\n"; echo '<span class="note">' . _('es importante que sea correcta, recibirás un correo para validar la cuenta') . '</span> <br />'; echo '<input type="text" id="email" name="email" value="" onkeyup="enablebutton(this.form.checkbutton2, this.form.submit, this)" size="25" tabindex="2"/>' . "\n"; echo '<input type="button" class="button" id="checkbutton2" disabled="disabled" value="' . _('verificar') . '" onclick="checkfield(\'email\', this.form, this.form.email)"/>' . "\n"; echo ' <span id="emailcheckitvalue"></span></p>' . "\n"; echo '<p><label for="password">' . _("clave") . ':</label><br />' . "\n"; echo '<span class="note">' . _('al menos ocho caracteres, incluyendo mayúsculas, minúsculas y números') . ' </span><br />'; echo '<input type="password" id="password" name="password" size="25" tabindex="3" onkeyup="return securePasswordCheck(this.form.password);"/><span id="password1-warning"></span></p>' . "\n"; echo '<p><label for="verify">' . _("verificación de clave") . ': </label><br />' . "\n"; echo '<input type="password" id="verify" name="password2" size="25" tabindex="4" onkeyup="checkEqualFields(this.form.password2, this.form.password)"/></p>' . "\n"; echo '<p><label><span class="note">' . _('has leído y aceptas las '); do_legal(_('condiciones de uso'), 'target="_blank"', false); echo ' <input type="checkbox" id="acceptlegal" name="acceptlegal" value="accept" tabindex="5"/></span></label></p>' . "\n"; echo '<p><input type="submit" class="button" disabled="disabled" name="submit" value="' . _('crear usuario') . '" class="log2" tabindex="6" /></p>' . "\n"; echo '<input type="hidden" name="process" value="1"/>' . "\n"; echo '<div style="margin-top: 20px" style="text-align:center">'; print_oauth_icons($_REQUEST['return']); echo '</div>' . "\n"; echo '</fieldset>' . "\n"; get_form_auth_ip(); echo '</form>' . "\n"; }
function do_login() { global $current_user, $globals; $previous_login_failed = Log::get_date('login_failed', $globals['user_ip_int'], 0, 300); echo '<form action="' . get_auth_link() . 'login.php" id="xxxthisform" method="post">' . "\n"; if ($_POST["processlogin"] == 1) { $username = clean_input_string(trim($_POST['username'])); $password = trim($_POST['password']); // Check form if (($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) && !ts_is_human()) { Log::insert('login_failed', $globals['user_ip_int'], 0); recover_error(_('el código de seguridad no es correcto')); } elseif (strlen($password) > 0 && $current_user->Authenticate($username, $password, $_POST['persistent']) == false) { Log::insert('login_failed', $globals['user_ip_int'], 0); recover_error(_('usuario o email inexistente, sin validar, o clave incorrecta')); $previous_login_failed++; } else { UserAuth::check_clon_from_cookies(); header('HTTP/1.1 303 Load'); if (!empty($_REQUEST['return'])) { header('Location: http://' . $_COOKIE['return_site'] . $_REQUEST['return']); } else { header('Location: http://' . $_COOKIE['return_site'] . $globals['base_url']); } die; } } echo '<p><label for="name">' . _('usuario o email') . ':</label><br />' . "\n"; echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . __($username) . '" /></p>' . "\n"; echo '<p><label for="password">' . _('clave') . ':</label><br />' . "\n"; echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n"; echo '<p><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n"; // Print captcha if ($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) { ts_print_form(); } echo '<p><input type="submit" value="login" tabindex="4" />' . "\n"; echo '<input type="hidden" name="processlogin" value="1"/></p>' . "\n"; echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n"; echo '</form>' . "\n"; echo '<div><strong><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></strong></div>' . "\n"; echo '<div style="margin-top: 30px">'; print_oauth_icons($_REQUEST['return']); echo '</div>' . "\n"; }
static function print_form($link, $rows=12) { global $current_user, $globals; if (!$link->votes > 0) return; if ($link->association && !in_array($current_user->user_id, $globals['association_users'])) { // so a xente da asociacion pode comentar aqui echo '<div class="commentform warn">'."\n"; echo _('Tes que ser da asociación para poder comentar nesta noticia')."\n"; echo '</div>'."\n"; } elseif($link->date < $globals['now']-$globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) { // Comments already closed echo '<div class="commentform warn">'."\n"; echo _('comentarios cerrados')."\n"; echo '</div>'."\n"; } elseif ($current_user->authenticated && (($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments']) || $current_user->user_id == $link->author)) { // User can comment echo '<div class="commentform">'."\n"; echo '<form action="" method="post">'."\n"; echo '<fieldset>'."\n"; echo '<legend>'._('envía un comentario'). ' <em style="font-size:80%">'._('porque alguien en Internet está equivocado').'</em></legend>'."\n"; print_simpleformat_buttons('comment'); echo '<label for="comment">'. _('texto del comentario / no se admiten etiquetas HTML').'<br /><span class="note">'._('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta').'</span></label>'."\n"; echo '<div><textarea name="comment_content" id="comment" cols="75" rows="'.$rows.'"></textarea></div>'."\n"; echo '<input class="button" type="submit" name="submit" value="'._('enviar el comentario').'" />'."\n"; // Allow gods to put "admin" comments which does not allow votes if ($current_user->user_level == 'god') { echo ' <label><strong>'._('admin').' </strong><input name="type" type="checkbox" value="admin"/></label>'."\n"; } echo '<input type="hidden" name="process" value="newcomment" />'."\n"; echo '<input type="hidden" name="randkey" value="'.rand(1000000,100000000).'" />'."\n"; echo '<input type="hidden" name="link_id" value="'.$link->id.'" />'."\n"; echo '<input type="hidden" name="user_id" value="'.$current_user->user_id.'" />'."\n"; echo '<input type="hidden" name="parent_id" value="0" />'."\n"; // for comment replies echo '</fieldset>'."\n"; echo '</form>'."\n"; echo "</div>\n"; echo '<div style="visibility:hidden;text-align:center;" id="comentarNoticia" ><a href="#" >'._("Comentar Noticia").'</a></div>'."\n"; } else { // Not enough karma or anonymous user if($tab_option == 1) do_comment_pages($link->comments, $current_page); if ($current_user->authenticated) { if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) { $remaining = txt_time_diff($globals['now'], $current_user->user_date+$globals['min_time_for_comments']); $msg = _('debes esperar') . " $remaining " . _('para escribir el primer comentario'); } if ($current_user->user_karma <= $globals['min_karma_for_comments']) { $msg = _('no tienes el mínimo karma requerido')." (" . $globals['min_karma_for_comments'] . ") ". _('para comentar'). ": ".$current_user->user_karma; } echo '<div class="commentform warn">'."\n"; echo $msg . "\n"; echo '</div>'."\n"; } elseif (!$globals['bot']){ echo '<div class="commentform warn">'."\n"; echo '<a href="'.get_auth_link().'login.php?return='.$_SERVER['REQUEST_URI'].'">'._('Autentifícate si deseas escribir').'</a> '._('comentarios').'. '._('O crea tu cuenta'). ' <a href="'.$globals['base_url'].'register.php">aquí.</a>'."\n"; echo '</div>'."\n"; echo '<div style="margin-top: 20px" align="center">'; print_oauth_icons(); echo '</div>'."\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; } } 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" />'; 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 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>)"; } echo '</dd>'; } if (!empty($user->names)) { echo '<dt>' . _('nombre') . ':</dt><dd>' . $user->names . '</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>'; echo '<dt>' . _('karma') . ':</dt><dd>' . $user->karma; echo '</dd>'; echo '<dt>' . _('ranking') . ':</dt><dd>#' . $user->ranking() . '</dd>'; $user->all_stats(); echo '<dt>' . _('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>' . _('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>' . _('votos') . ':</dt><dd>' . $user->total_votes . '</dd>'; echo '</dl>'; if ($current_user->user_id == $user->id) { echo '<div style="margin-top: 20px" align="center">'; print_oauth_icons($_REQUEST['return']); echo '</div>' . "\n"; } echo '</fieldset>'; }
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>'; } }
function do_login() { global $current_user, $globals; $form_ip_check = check_form_auth_ip(); $previous_login_failed = Log::get_date('login_failed', $globals['form_user_ip_int'], 0, 300); // Show menéame intro only if first try and the there were not previous logins if (!$globals['mobile'] && $previous_login_failed < 3 && empty($_POST["processlogin"]) && empty($_COOKIE['u'])) { echo '<div class="faq wideonly" style="float:right; width:55%; margin-top: 10px;">' . "\n"; // Only prints if the user was redirected from submit.php if (!empty($_REQUEST['return']) && preg_match('/submit\\.php/', $_REQUEST['return'])) { echo '<p style="border:1px solid #FF9400; font-size:1.3em; background:#FEFBEA; font-weight:bold; padding:0.5em 1em;">Para enviar una historia debes ser un usuario registrado</p>' . "\n"; } echo '<h3>' . _('¿Qué es menéame?') . '</h3>' . "\n"; echo '<p>' . _('Es un sitio que te permite enviar una historia que será revisada por todos y será promovida, o no, a la página principal. Cuando un usuario envía una historia ésta queda en la <a href="shakeit.php">cola de pendientes</a> hasta que reúne los votos suficientes para ser promovida a la página principal') . '.</p>' . "\n"; echo '<h3>' . _('¿Todavía no eres usuario de menéame?') . '</h3>' . "\n"; echo '<p>' . _('Como usuario registrado podrás, entre otras cosas') . ':</p>' . "\n"; echo '<ul style="margin-left: 1.5em">' . "\n"; echo '<li>' . "\n"; echo '<strong>' . _('Enviar historias') . '</strong><br />' . "\n"; echo '<p>' . _('Una vez registrado puedes enviar las historias que consideres interesantes para la comunidad. Si tienes algún tipo de duda sobre que tipo de historias puedes enviar revisa nuestras <a href="faq-es.php">preguntas frecuentes sobre menéame</a>') . '.</p>' . "\n"; echo '</li>' . "\n"; echo '<li>' . "\n"; echo '<strong>' . _('Escribir comentarios') . '</strong><br />' . "\n"; echo '<p>' . _('Puedes escribir tu opinión sobre las historias enviadas a menéame mediante comentarios de texto. También puedes votar positivamente aquellos comentarios ingeniosos, divertidos o interesantes y negativamente aquellos que consideres inoportunos') . '.</p>' . "\n"; echo '</li>' . "\n"; echo '<li>' . "\n"; echo '<strong>' . _('Perfil de usuario') . '</strong><br />' . "\n"; echo '<p>' . _('Toda tu información como usuario está disponible desde la página de tu perfil. También puedes subir una imagen que representará a tu usuario en menéame. Incluso es posible compartir los ingresos publicitarios de Menéame, solo tienes que introducir el código de tu cuenta Google Adsense desde tu perfil') . '.</p>' . "\n"; echo '</li>' . "\n"; echo '<li>' . "\n"; echo '<strong>' . _('Chatear en tiempo real desde la fisgona') . '</strong><br />' . "\n"; echo '<p>' . _('Gracias a la <a href="sneak.php">fisgona</a> puedes ver en tiempo real toda la actividad de menéame. Además como usuario registrado podrás chatear con mucha más gente de la comunidad menéame') . '</p>' . "\n"; echo '</li>' . "\n"; echo '</ul>' . "\n"; echo '<h3><a href="register.php" style="color:#FF6400; text-decoration:underline; display:block; width:8em; text-align:center; margin:0 auto; padding:0.5em 1em; border:3px double #FFE2C5; background:#FFF3E8;">Regístrate ahora</a></h3>' . "\n"; echo '</div>' . "\n"; echo '<div class="genericform" style="float:left; width:40%; margin: 0">' . "\n"; } else { echo '<div class="genericform" style="float:auto;">' . "\n"; } echo '<form action="' . get_auth_link() . 'login.php" id="thisform" method="post">' . "\n"; if ($_POST["processlogin"] == 1) { // Check the IP, otherwise redirect if (!$form_ip_check) { header('HTTP/1.1 303 Load'); header("Location: http://" . $_COOKIE['return_site'] . $globals['base_url'] . "login.php"); die; } $username = clean_input_string(trim($_POST['username'])); $password = trim($_POST['password']); // Check form if (($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) && !ts_is_human()) { Log::insert('login_failed', $globals['form_user_ip_int'], 0); recover_error(_('el código de seguridad no es correcto') . " ({$previous_login_failed})"); } elseif (strlen($password) > 0 && $current_user->Authenticate($username, $password, $_POST['persistent']) == false) { Log::insert('login_failed', $globals['form_user_ip_int'], 0); $previous_login_failed++; recover_error(_('usuario o email inexistente, sin validar, o clave incorrecta') . " ({$previous_login_failed})"); } else { UserAuth::check_clon_from_cookies(); // If the user is authenticating from a mobile device, keep her in the standard version if ($globals['mobile']) { setcookie('nomobile', '1', 0, $globals['base_url'], UserAuth::domain()); } header('HTTP/1.1 303 Load'); if (!empty($_REQUEST['return'])) { header('Location: http://' . $_COOKIE['return_site'] . $_REQUEST['return']); } else { header('Location: http://' . $_COOKIE['return_site'] . $globals['base_url']); } die; } } echo '<fieldset>' . "\n"; echo '<legend><span class="sign">' . _('usuario y contraseña') . '</span></legend>' . "\n"; echo '<p><label for="name">' . _('usuario o email') . ':</label><br />' . "\n"; echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="' . htmlentities($username) . '" /></p>' . "\n"; echo '<p><label for="password">' . _('clave') . ':</label><br />' . "\n"; echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>' . "\n"; echo '<p><label for="remember">' . _('recuérdame') . ': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>' . "\n"; // Print captcha if ($previous_login_failed > 2 || $globals['captcha_first_login'] == true && !UserAuth::user_cookie_data()) { ts_print_form(); } get_form_auth_ip(); echo '<p><input type="submit" value="login" class="button" tabindex="4" /></p>' . "\n"; print_oauth_icons($_REQUEST['return']); echo '<input type="hidden" name="processlogin" value="1"/>' . "\n"; echo '<input type="hidden" name="return" value="' . htmlspecialchars($_REQUEST['return']) . '"/>' . "\n"; echo '</fieldset>' . "\n"; echo '</form>' . "\n"; echo '<div class="recoverpass" style="text-align:center"><h4><a href="login.php?op=recover">' . _('¿has olvidado la contraseña?') . '</a></h4></div>' . "\n"; echo '</div>' . "\n"; echo '<br/> '; }
static function print_form($link, $rows = 5) { global $current_user, $globals; if (!$link->votes > 0) { return; } $comment = new Comment(); // Foo comment $comment->randkey = rand(1000000, 100000000); if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) { // Comments already closed echo '<div class="commentform warn">' . "\n"; echo _('comentarios cerrados') . "\n"; echo '</div>' . "\n"; } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) { // User can comment echo '<div class="commentform">' . "\n"; echo '<form action="" method="post" enctype="multipart/form-data" class="comment">'; echo '<input type="hidden" name="process" value="newcomment" />'; echo '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />'; echo '<fieldset>' . "\n"; echo '<legend>' . _('envía un comentario') . '</legend>'; $vars = compact('link', 'comment'); Haanga::Load('comment_edit.html', $vars); echo '<div class="note" style="margin-top:10px">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</div>'; echo '</fieldset>' . "\n"; echo '</form>' . "\n"; echo "</div>\n"; } else { // Not enough karma or anonymous user if ($tab_option == 1) { do_comment_pages($link->comments, $current_page); } if ($current_user->authenticated) { if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) { $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']); $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario'); } if ($current_user->user_karma <= $globals['min_karma_for_comments']) { $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma; } echo '<div class="commentform warn">' . "\n"; echo $msg . "\n"; echo '</div>' . "\n"; } elseif (!$globals['bot']) { echo '<div class="commentform warn">' . "\n"; echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n"; echo '</div>' . "\n"; print_oauth_icons(); } } }
static function print_form($link, $rows = 5) { global $current_user, $globals; if (!$link->votes > 0) { return; } if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) { // Comments already closed echo '<div class="commentform warn">' . "\n"; echo _('comentarios cerrados') . "\n"; echo '</div>' . "\n"; } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) { // User can comment echo '<div class="commentform">' . "\n"; echo '<form action="" method="post" enctype="multipart/form-data" class="comment">' . "\n"; echo '<input type="hidden" name="process" value="newcomment" />' . "\n"; echo '<input type="hidden" name="randkey" value="' . rand(1000000, 100000000) . '" />' . "\n"; echo '<fieldset>' . "\n"; echo '<legend>' . _('envía un comentario') . '</legend>' . "\n"; print_simpleformat_buttons('comment'); echo '<label for="comment">' . _('texto del comentario') . '<br /><span class="note">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</span></label>' . "\n"; echo '<div><textarea name="comment_content" class="droparea" id="comment" rows="' . $rows . '"></textarea></div>' . "\n"; echo '<input class="button" type="submit" name="submit" value="' . _('enviar el comentario') . '" />' . "\n"; // Allow gods to put "admin" comments which does not allow votes if ($current_user->user_level == 'god') { echo ' <label><strong>' . _('admin') . ' </strong><input name="type" type="checkbox" value="admin"/></label>' . "\n"; } $comment = new Comment(); // Foo comment $vars = compact('link', 'comment'); Haanga::Load('comment_edit.html', $vars); echo '</fieldset>' . "\n"; echo '</form>' . "\n"; echo "</div>\n"; } else { // Not enough karma or anonymous user if ($tab_option == 1) { do_comment_pages($link->comments, $current_page); } if ($current_user->authenticated) { if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) { $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']); $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario'); } if ($current_user->user_karma <= $globals['min_karma_for_comments']) { $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma; } echo '<div class="commentform warn">' . "\n"; echo $msg . "\n"; echo '</div>' . "\n"; } elseif (!$globals['bot']) { echo '<div class="commentform warn">' . "\n"; echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n"; echo '</div>' . "\n"; print_oauth_icons(); } } }
function do_register0() { echo '<form action="' . get_auth_link() . 'register" method="post" id="thisform" onSubmit="return check_checkfield(\'acceptlegal\', \'' . _('no has aceptado las condiciones de uso') . '\')">' . "\n"; ob_start(); echo _('he leído y acepto las '); do_legal(_('condiciones de uso'), 'target="_blank"', false); $legal = ob_get_clean(); ob_start(); print_oauth_icons($_REQUEST['return']); $oauthIconsHtml = ob_get_clean(); $rememberPasswordText = _('¿has olvidado la contraseña?'); echo <<<EOT <div class="row bigform"> <section class="col-lg-10 col-lg-offset-1 col-md-10 col-md-offset-1 col-xs-12 col-sm-offset-0"> <div class="well well-lg"> <div class="row"> <div class="col-sm-6 col-xs-12"> <div class="row"> <div class="col-xs-12"><h3>Registro social</h3></div> </div> <div class="row"> <div class="col-xs-12"><p>Evita quebraderos de cabeza.</p></div> </div> <div class="row"> <div class="col-xs-12"> {$oauthIconsHtml} </div> </div> </div> <div class="col-sm-6 col-xs-12"> <div class="row"> <div class="col-xs-12"><h3>Registro clásico</h3></div> </div> <div class="row"> <div class="col-xs-12"> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-user fa-2x"></i></span> <input id="name" name="username" value="" onkeyup="enablebutton(this.form.checkbutton1, this.form.submit, this)" class="form-control input-lg" placeholder="Nombre de usuario" required="required" maxlength="100" type="text" data-original-title="" title=""> \t\t<span class="input-group-btn btn-group-lg"> \t<button class="btn btn-default" type="button" id="checkbutton1" disabled="disabled" onclick="checkfield('username', this.form, this.form.username)"> \tVerificar \t</button> \t\t</span> </div> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-envelope fa-2x"></i></span> <input id="email" name="email" value="" onkeyup="enablebutton(this.form.checkbutton2, this.form.submit, this)" class="form-control input-lg" placeholder="Correo electrónico" required="required" maxlength="100" type="text" data-original-title="" title=""> \t\t<span class="input-group-btn btn-group-lg"> \t<button class="btn btn-default" type="button" id="checkbutton2" disabled="disabled" onclick="checkfield('email', this.form, this.form.email)"> \tVerificar \t</button> \t\t</span> </div> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-asterisk fa-2x"></i></span> <input id="password" name="password" class="form-control input-lg" placeholder="Clave" required="required" maxlength="60" type="password" data-original-title="" title=""> </div> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-asterisk fa-2x"></i></span> <input id="verify" name="password2" class="form-control input-lg" placeholder="Repita la clave" required="required" maxlength="60" type="password" data-original-title="" title=""> </div> {$captchaHtml} <div class="form-group"> <button type="submit" value="login" id="btn-signup" class="btn btn-block btn-primary btn-lg">Crear usuario</button> </div> <div class="checkbox"> <label> <input id="acceptlegal" name="acceptlegal" type="checkbox" value="accept" /> {$legal} </label> </div> <div class="input-group"> <a href="login?op=recover">{$rememberPasswordText}</a> </div> </div><!-- end of column --> </div><!-- end of row --> </div><!-- end of column 2 --> </div><!-- end of well row --> </div><!-- end of well --> </section> </div> <input type="hidden" name="process" value="1"/> EOT; get_form_auth_ip(); echo '</form>' . "\n"; /* echo '<div class="recoverpass" style="text-align:center"><h4><a href="login?op=recover">'._('¿has olvidado la contraseña?').'</a></h4></div>'; echo '<form action="'.get_auth_link().'register" method="post" id="thisform" onSubmit="return check_checkfield(\'acceptlegal\', \''._('no has aceptado las condiciones de uso').'\')">' . "\n"; echo '<fieldset>' . "\n"; echo '<legend><span class="sign">' . _("datos del usuario") . '</span></legend>' . "\n"; echo '<p><label for="name">' . _("nombre de usuario") . ':</label><br />' . "\n"; echo '<input type="text" name="username" id="name" value="" onkeyup="enablebutton(this.form.checkbutton1, this.form.submit, this)" size="25" tabindex="1"/>' . "\n"; echo '<span id="checkit"><input type="button" class="button" id="checkbutton1" disabled="disabled" value="'._('verificar').'" onclick="checkfield(\'username\', this.form, this.form.username)"/></span>' . "\n"; echo ' <span id="usernamecheckitvalue"></span></p>' . "\n"; echo '<p><label for="email">email:</label><br />' . "\n"; echo '<span class="note">'._('es importante que sea correcta, recibirás un correo para validar la cuenta').'</span> <br />'; echo '<input type="text" id="email" name="email" value="" onkeyup="enablebutton(this.form.checkbutton2, this.form.submit, this)" size="25" tabindex="2"/>' . "\n"; echo '<input type="button" class="button" id="checkbutton2" disabled="disabled" value="'._('verificar').'" onclick="checkfield(\'email\', this.form, this.form.email)"/>' . "\n"; echo ' <span id="emailcheckitvalue"></span></p>' . "\n"; echo '<p><label for="password">' . _("clave") . ':</label><br />' . "\n"; echo '<span class="note">'._('al menos ocho caracteres, incluyendo mayúsculas, minúsculas y números').' </span><br />'; echo '<input type="password" id="password" name="password" size="25" tabindex="3" onkeyup="return securePasswordCheck(this.form.password);"/><span id="password1-warning"></span></p>' . "\n"; echo '<p><label for="verify">' . _("verificación de clave") . ': </label><br />' . "\n"; echo '<input type="password" id="verify" name="password2" size="25" tabindex="4" onkeyup="checkEqualFields(this.form.password2, this.form.password)"/></p>' . "\n"; echo '<p><label><span class="note">'._('has leído y aceptas las '); do_legal(_('condiciones de uso'), 'target="_blank"', false); echo ' <input type="checkbox" id="acceptlegal" name="acceptlegal" value="accept" tabindex="5"/></span></label></p>' . "\n"; echo '<p><input type="submit" class="button" disabled="disabled" name="submit" value="'._('crear usuario').'" class="log2" tabindex="6" /></p>' . "\n"; echo '<input type="hidden" name="process" value="1"/>' . "\n"; echo '<div style="margin-top: 20px" style="text-align:center">'; print_oauth_icons($_REQUEST['return']); echo '</div>'."\n"; echo '</fieldset>' . "\n"; get_form_auth_ip(); echo '</form>' . "\n"; */ }
function do_login() { global $current_user, $globals; $form_ip_check = check_form_auth_ip(); $previous_login_failed = log_get_date('login_failed', $globals['form_user_ip_int'], 0, 300); echo '<form action="'.get_auth_link().'login.php" id="xxxthisform" method="post">'."\n"; if ($_POST["processlogin"] == 1) { // Check the IP, otherwise redirect if (!$form_ip_check) { header("Location: http://".get_server_name().$globals['base_url']."login.php"); die; } $username = clean_input_string(trim($_POST['username'])); $password = trim($_POST['password']); if ($_POST['persistent']) { $persistent = 3600000; // 1000 hours } else { $persistent = 0; } // Check form if (($previous_login_failed > 2 || ($globals['captcha_first_login'] == true && ! UserAuth::user_cookie_data()) ) && !ts_is_human()) { log_insert('login_failed', $globals['form_user_ip_int'], 0); recover_error(_('o codigo de seguridade non é correcto')); } elseif ($current_user->Authenticate($username, md5($password), $persistent) == false) { log_insert('login_failed', $globals['form_user_ip_int'], 0); recover_error(_('usuario ou email inexistente, sin validar, ou clave incorrecta')); $previous_login_failed++; } else { UserAuth::check_clon_from_cookies(); if(!empty($_REQUEST['return'])) { header('Location: '.$_REQUEST['return']); } else { header('Location: ./'); } die; } } echo '<p><label for="name">'._('usuario ou email').':</label><br />'."\n"; echo '<input type="text" name="username" size="25" tabindex="1" id="name" value="'.htmlentities($username).'" /></p>'."\n"; echo '<p><label for="password">'._('clave').':</label><br />'."\n"; echo '<input type="password" name="password" id="password" size="25" tabindex="2"/></p>'."\n"; echo '<p><label for="remember">'._('recordame').': </label><input type="checkbox" name="persistent" id="remember" tabindex="3"/></p>'."\n"; // Print captcha if ($previous_login_failed > 2 || ($globals['captcha_first_login'] == true && ! UserAuth::user_cookie_data())) { ts_print_form(); } get_form_auth_ip(); echo '<p><input type="submit" value="login" tabindex="4" />'."\n"; echo '<input type="hidden" name="processlogin" value="1"/></p>'."\n"; echo '<input type="hidden" name="return" value="'.htmlspecialchars($_REQUEST['return']).'"/>'."\n"; echo '</form>'."\n"; echo '<div><strong><a href="login.php?op=recover">'._('olvidaches o contrasinal??').'</a></strong></div>'."\n"; echo '<div style="margin-top: 30px">'; print_oauth_icons($_REQUEST['return']); echo '</div>'."\n"; }