コード例 #1
0
ファイル: sneak.php プロジェクト: brainsqueezer/fffff
function init_sneak()
{
    global $globals, $db, $current_user;
    // Create temporary table for chat if it does not exist
    $db->query('CREATE TABLE IF NOT EXISTS `chats` ( `chat_time` DECIMAL( 12, 2 ) UNSIGNED NOT NULL DEFAULT 0 , `chat_uid` INTEGER UNSIGNED NOT NULL DEFAULT 0, `chat_room` enum("all","friends","admin") NOT NULL default "all", `chat_user` CHAR( 32 ) NOT NULL , `chat_text` CHAR( 255 ) NOT NULL , INDEX USING BTREE ( `chat_time` ) ) ENGINE = MEMORY MAX_ROWS = 2000');
    $db->query('CREATE TABLE IF NOT EXISTS `sneakers` ( `sneaker_id` CHAR(24) NOT NULL, `sneaker_time` INTEGER UNSIGNED NOT NULL DEFAULT 0, `sneaker_user` INTEGER UNSIGNED NOT NULL DEFAULT 0, UNIQUE ( `sneaker_id` ) ) ENGINE = MEMORY MAX_ROWS = 1000');
    // Check number of users if it's annonymous
    if ($current_user->user_id == 0) {
        $nusers = $db->get_var("select count(*) from sneakers");
        if ($nusers > $globals['max_sneakers']) {
            header('Location: http://' . get_server_name() . $globals['base_url'] . 'toomuch.html');
            die;
        }
    }
    // Check number of connections from the same IP addres
    // if it comes from Netvibes, allow more
    if (preg_match('/Netvibes Ajax/', $_SERVER["HTTP_USER_AGENT"])) {
        $max_conn = 50;
    } else {
        $max_conn = 10;
    }
    $nusers = $db->get_var("select count(*) from sneakers where sneaker_id like '" . $globals['user_ip'] . "-%'");
    if ($nusers > $max_conn) {
        header('Location: http://' . get_server_name() . $globals['base_url'] . 'toomuch.html');
        die;
    }
    // Delete all connections from the same IP, just to avoid stupid cheating
    $db->query("delete from sneakers where sneaker_id like '" . $globals['user_ip'] . "%'");
}
コード例 #2
0
ファイル: sneak.php プロジェクト: GallardoAlba/Meneame
function init_sneak()
{
    global $globals, $db, $current_user;
    // Create temporary table for chat if it does not exist
    $db->query('CREATE TABLE IF NOT EXISTS `chats` ( `chat_time` DECIMAL( 12, 2 ) UNSIGNED NOT NULL DEFAULT 0 , `chat_uid` INTEGER UNSIGNED NOT NULL DEFAULT 0, `chat_room` enum("all","friends","admin") NOT NULL default "all", `chat_user` CHAR( 32 ) NOT NULL , `chat_text` CHAR( 255 ) NOT NULL , INDEX USING BTREE ( `chat_time` ) ) ENGINE = MEMORY MAX_ROWS = 2000');
    $db->query('CREATE TABLE IF NOT EXISTS `sneakers` ( `sneaker_id` CHAR(24) NOT NULL, `sneaker_time` INTEGER UNSIGNED NOT NULL DEFAULT 0, `sneaker_user` INTEGER UNSIGNED NOT NULL DEFAULT 0, UNIQUE ( `sneaker_id` ) ) ENGINE = MEMORY MAX_ROWS = 1000');
    // Check number of users if it's annonymous
    if ($current_user->user_id == 0) {
        $nusers = $db->get_var("select count(*) from sneakers");
        if ($nusers > $globals['max_sneakers']) {
            header('Location: ' . $globals['scheme'] . '//' . get_server_name() . $globals['base_url_general'] . 'toomuch.html');
            die;
        }
    }
    // Check number of connections from the same IP addres
    $max_conn = 50;
    $nusers = $db->get_var("select count(*) from sneakers where sneaker_id like '" . $globals['user_ip'] . "-%'");
    if ($nusers > $max_conn) {
        header('Location: ' . $globals['scheme'] . '//' . get_server_name() . $globals['base_url_general'] . 'toomuch.html');
        die;
    }
    // Delete all connections from the same IP, just to avoid stupid cheating
    $db->query("delete from sneakers where sneaker_id like '" . $globals['user_ip'] . "%'");
    // Force to show conv counters even if they are zero
    if ($current_user->user_id > 0) {
        $globals['show_conv_counters'] = true;
    }
}
コード例 #3
0
function do_credits()
{
    global $dblang, $globals;
    echo '<br style="clear: both;" />' . "\n";
    echo '<div class="credits-strip">' . "\n";
    echo '<span class="credits-strip-text">' . "\n";
    // IMPORTANT: legal note only for our servers, CHANGE IT!!
    if (preg_match('/meneame.net$/', get_server_name())) {
        echo '<a href="http://bitassa.com/legal-meneame.php"><strong>' . _('información legal y condiciones de uso') . '</strong></a>&nbsp;&nbsp;|&nbsp;&nbsp;';
    }
    // IMPORTANT: read above
    echo '<a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php#we">' . _('quiénes somos') . '</a>';
    echo '<br />';
    echo '<a href="http://meneame.wikispaces.com/" title="wiki meneame">' . _('wiki') . '</a>' . "\n";
    echo '&nbsp;&nbsp;|&nbsp;&nbsp;' . _('código: ') . ' <a href="' . $globals['base_url'] . 'COPYING">' . _('licencia') . '</a>, <a href="' . $globals['base_url'] . 'archives/meneame-src.tgz">' . _('descargar') . '</a>';
    echo '&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://creativecommons.org/licenses/by-sa/2.5/">' . _('licencia de los gráficos') . '</a>' . "\n";
    echo '</span>' . "\n";
    echo '<span class="credits-strip-buttons">' . "\n";
    echo '<a href="http://validator.w3.org/check?uri=referer"><img src="' . $globals['base_url'] . 'img/common/valid-xhtml10.png" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>' . "\n";
    echo '&nbsp;&nbsp;' . "\n";
    echo '<a href="http://jigsaw.w3.org/css-validator/check/referer"><img style="border:0;width:88px;height:31px" src="' . $globals['base_url'] . 'img/common/vcss.png" alt="Valid CSS!" /></a>&nbsp;&nbsp;' . "\n";
    echo '<a href="http://feedvalidator.org/check.cgi?url=http://meneame.net/rss2.php"><img src="' . $globals['base_url'] . 'img/common/valid-rss.png" alt="[Valid RSS]" title="Validate my RSS feed" /></a>' . "\n";
    echo '</span>' . "\n";
    echo '</div>' . "\n";
    echo "<!--ben-tmp-functions:do_credits-->\n";
}
コード例 #4
0
ファイル: mail.php プロジェクト: manelio/woolr
function send_recover_mail($user)
{
    global $site_key, $globals;
    if (!check_email($user->email)) {
        return false;
    }
    $now = time();
    if (!empty($globals['email_domain'])) {
        $domain = $globals['email_domain'];
    } else {
        $domain = get_server_name();
    }
    $key = md5($user->id . $user->pass . $now . $site_key . get_server_name());
    $url = $globals['base_url'] . 'profile?login='******'&t=' . $now . '&k=' . $key;
    //echo "$user->username, $user->email, $url<br />";
    $to = $user->email;
    $subject = _('Recuperación o verificación de contraseña de ') . get_server_name();
    $subject = mb_encode_mimeheader($subject, "UTF-8", "B", "\n");
    $message = $to . ': ' . _('para poder acceder sin la clave, conéctate a la siguiente dirección en menos de 15 minutos:') . "\n\n{$url}\n\n";
    $message .= _('Pasado este tiempo puedes volver a solicitar acceso en: ') . "\nhttp://" . get_server_name() . $globals['base_url'] . "login?op=recover\n\n";
    $message .= _('Una vez en tu perfil, puedes cambiar la clave de acceso.') . "\n" . "\n";
    $message .= "\n\n" . _('Este mensaje ha sido enviado a solicitud de la dirección: ') . $globals['user_ip'] . "\n\n";
    $message .= "-- \n  " . _('el equipo de menéame');
    $message = wordwrap($message, 70);
    $headers = 'Content-Type: text/plain; charset="utf-8"' . "\n" . 'From: ' . _('Avisos') . ' ' . $domain . ' <' . _('no_contestar') . "@{$domain}>\n" . 'Reply-To: ' . _('no_contestar') . "@{$domain}\n" . 'X-Mailer: meneame.net' . "\n";
    $headers .= 'MIME-Version: 1.0' . "\n";
    //$pars = '-fweb@'.get_server_name();
    mail($to, $subject, $message, $headers);
    echo '<p><strong>' . _('Correo enviado, mira tu buzón, allí están las instrucciones. Mira también en la carpeta de spam.') . '</strong></p>';
    return true;
}
コード例 #5
0
ファイル: login.php プロジェクト: brainsqueezer/fffff
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(_('el código de seguridad no es correcto'));
        } elseif ($current_user->Authenticate($username, md5($password), $persistent) == false) {
            log_insert('login_failed', $globals['form_user_ip_int'], 0);
            recover_error(_('usuario o email inexistente, sin validar, o 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 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" 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";
}
コード例 #6
0
ファイル: Apc.php プロジェクト: reoring/sabel
 private function __construct()
 {
     if (extension_loaded("apc")) {
         $this->setKeyPrefix(get_server_name());
     } else {
         $message = __METHOD__ . "() apc extension not loaded.";
         throw new Sabel_Exception_Runtime($message);
     }
 }
コード例 #7
0
function do_legal($legal_name, $target = '')
{
    // IMPORTANT: legal note only for our servers, CHANGE IT!!
    if (preg_match('/meneame.net$/', get_server_name())) {
        echo '<a href="http://bitassa.com/legal-meneame.php" ' . $target . '>' . $legal_name . '</a>';
    } else {
        echo _('condiciones legales');
    }
    // IMPORTANT: read above
}
コード例 #8
0
function check_stats($string) {
	global $globals;
	if (preg_match('/^!statsu/', $string)) return do_statsu($string);
	if (preg_match('/^!stats2/', $string)) return do_stats2($string);
	if (preg_match('/^!stats1{0,1}/', $string)) return do_stats1($string);
	if (preg_match('/^!help/', $string)) return _('comandos') . ': <a href="http://meneame.wikispaces.com/Comandos">meneame.wikispaces.com/Comandos</a>';
	if (preg_match('/^!cabal/', $string)) return do_cabal($string);
	if (preg_match('/^!wiki/', $string)) return 'wiki: <a href="http://meneame.wikispaces.com/">meneame.wikispaces.com</a>';
	if (preg_match('/^!promote/', $string)) return '<a href="http://' . get_server_name().$globals['base_url']. 'archives/promote.html">promote.html</a>';
	return '';
}
コード例 #9
0
ファイル: Memcache.php プロジェクト: reoring/sabel
 private function __construct($host, $port)
 {
     if (extension_loaded("memcache")) {
         $this->memcache = new Memcache();
         $this->addServer($host, $port);
         $this->setKeyPrefix(get_server_name());
     } else {
         $message = __METHOD__ . "() memcache extension not loaded.";
         throw new Sabel_Exception_Runtime($message);
     }
 }
コード例 #10
0
function do_header($title, $id = 'home')
{
    global $current_user, $dblang, $globals;
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    //echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n";
    echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n";
    echo '<head>' . "\n";
    echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
    echo "<title>" . _($title) . " // men&eacute;ame</title>\n";
    echo '<meta name="generator" content="Bluefish 1.0.4"/>' . "\n";
    echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n";
    echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n";
    echo '<style type="text/css" media="screen">@import "' . $globals['base_url'] . 'css/es/mnm15.css";</style>' . "\n";
    echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n";
    echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n";
    echo '<link rel="alternate" type="application/rss+xml" title="' . _('todas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=all" />' . "\n";
    echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n";
    echo '<link rel="icon" href="' . $globals['base_url'] . 'favicon.ico" type="image/x-icon" />' . "\n";
    echo '<script type="text/javascript">var base_url="' . $globals['base_url'] . '";</script>';
    echo '<script src="' . $globals['base_url'] . 'js/xmlhttp05.js" type="text/javascript"></script>' . "\n";
    echo '</head>' . "\n";
    echo "<body id=\"{$id}\" " . $globals['body-args'] . ">\n";
    echo '<div id="container">' . "\n";
    echo '<div id="logo">' . "\n";
    echo '<a href="' . $globals['base_url'] . '"><img src="' . $globals['base_url'] . 'img/es/logo01.png" alt="meneame, noticias colaborativas" /></a>';
    echo '</div>' . "\n";
    echo '<div id="header">' . "\n";
    // benjami: later - echo '<h1><a href="/">men&eacute;ame</a></h1>' . "\n";
    echo '<ul>' . "\n";
    echo '<li><a href="' . $globals['base_url'] . 'telnet.php">' . _('¡la jefa!') . '</a></li>' . "\n";
    echo '<li><a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php">' . _('acerca de menéame') . '</a></li>' . "\n";
    if ($title != "login") {
        if ($current_user->authenticated) {
            echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&amp;return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('cerrar sesión') . '</a></li>' . "\n";
            echo '<li><a href="' . $globals['base_url'] . 'user.php?login='******'">' . _('perfil de') . ' ' . $current_user->user_login . '</a></li>' . "\n";
        } else {
            echo '<li><a href="' . $globals['base_url'] . 'register.php">' . _('registrarse') . '</a></li>' . "\n";
            echo '<li><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . '</a></li>' . "\n";
        }
    }
    echo '<li>' . "\n";
    echo '<form action="' . $globals['base_url'] . '" method="get" id="thisform-search">' . "\n";
    echo '<label for="search" accesskey="100" class="inside">' . _('buscar') . '</label>' . "\n";
    if (!empty($_REQUEST['search'])) {
        echo '<input type="text" name="search" id="search" value="' . htmlspecialchars(strip_tags($_REQUEST['search'])) . '" />' . "\n";
    } else {
        // benjami: onblur and onfocus to this
        echo '<input name="search" id="search" value="' . _('buscar...') . '" type="text" onblur="if(this.value==\'\') this.value=\'' . _('buscar...') . '\';" onfocus="if(this.value==\'' . _('buscar...') . '\') this.value=\'\';"/>' . "\n";
    }
    echo '</form>' . "\n";
    echo '</li>' . "\n";
    echo '</ul>' . "\n";
    echo '</div>' . "\n";
}
コード例 #11
0
ファイル: linkmobile.php プロジェクト: GallardoAlba/Meneame
 function print_summary($type = 'full', $karma_best_comment = 0, $show_tags = true)
 {
     global $current_user, $current_user, $globals, $db;
     if (!$this->read) {
         return;
     }
     $this->is_votable();
     switch ($this->status) {
         case 'queued':
             // another color box for not-published
             $box_class = 'mnm-queued';
             break;
         case 'abuse':
             // another color box for discarded
         // another color box for discarded
         case 'autodiscard':
             // another color box for discarded
         // another color box for discarded
         case 'discard':
             // another color box for discarded
             $box_class = 'mnm-discarded';
             break;
         case 'published':
             // default for published
         // default for published
         default:
             $box_class = 'mnm-published';
             break;
     }
     $this->has_warning = !(!$this->check_warn() || $this->is_discarded());
     $this->is_editable = $this->author == $current_user->user_id && $this->is_editable();
     $this->total_votes = $this->votes + $this->anonymous;
     $this->rpermalink = $this->get_relative_permalink();
     $this->author_html = '<a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a>';
     $this->normal_link = preg_replace('/\\/mobile\\//', '/', $this->get_relative_permalink());
     $this->show_shakebox = $type != 'preview' && $this->votes > 0;
     $this->thumb_url = $this->has_thumb();
     if ($this->status == 'abuse' || $this->has_warning) {
         $this->negative_text = FALSE;
         $negatives = $db->get_row("select SQL_CACHE vote_value, count(vote_value) as count from votes where vote_type='links' and vote_link_id={$this->id} and vote_value < 0 group by vote_value order by count desc limit 1");
         if ($negatives->count > 2 && $negatives->count >= $this->negatives / 2 && ($negatives->vote_value == -6 || $negatives->vote_value == -8)) {
             $this->negative_text = get_negative_vote($negatives->vote_value);
         }
     }
     $text = $this->content;
     $my_domain = get_server_name();
     $parent_domain = preg_replace('/m\\./', '', $my_domain);
     if ($parent_domain != $my_domain && preg_match('#[^\\.]' . preg_quote($parent_domain) . '/#', $text)) {
         $text = preg_replace('#([^\\.])' . preg_quote($parent_domain) . '/#', "\$1{$my_domain}/", $text);
     }
     $vars = compact('type', 'karma_best_comment', 'show_tags', 'box_class', 'nofollow', 'url', 'text');
     $vars['self'] = $this;
     return Haanga::Load('mobile/link_summary.html', $vars);
 }
コード例 #12
0
ファイル: link_bookmark.php プロジェクト: manelio/woolr
function do_header($title)
{
    echo '<!DOCTYPE NETSCAPE-Bookmark-file-1>' . "\n";
    echo '<!-- This file was generated by Meneame -->' . "\n";
    echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' . "\n";
    echo '<TITLE>Bookmarks</TITLE>' . "\n";
    echo '<H1 LAST_MODIFIED="' . time() . '">Bookmarks</H1>' . "\n";
    echo '<DL><P>' . "\n";
    echo '<DT><H3 FOLDED >' . $title . '//' . get_server_name() . '</H3>' . "\n";
    echo '<DL><P>' . "\n";
}
コード例 #13
0
ファイル: sitemap.php プロジェクト: brainsqueezer/fffff
function do_published($page)
{
    global $globals, $index_size;
    $start = 1 + $page * $index_size;
    $sql = "SELECT SQL_NO_CACHE link_uri from links where link_status='published' order by link_date asc limit {$start}, {$index_size}";
    $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
    echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
    while ($res = mysql_fetch_object($result)) {
        echo '<url>' . "\n";
        echo '<loc>http://' . get_server_name() . $globals['base_url'] . $globals['base_story_url'] . $res->link_uri . '</loc>' . "\n";
        echo '</url>' . "\n";
    }
    echo '</urlset>' . "\n";
}
コード例 #14
0
ファイル: sneaker-stats.php プロジェクト: brainsqueezer/fffff
function check_stats($string)
{
    global $globals, $current_user;
    if (preg_match('/^!top/', $string)) {
        return do_top($string);
    }
    if (preg_match('/^!statsu/', $string)) {
        return do_statsu($string);
    }
    if (preg_match('/^!stats2/', $string)) {
        return do_stats2($string);
    }
    if (preg_match('/^!stats3/', $string)) {
        return do_stats3($string);
    }
    if (preg_match('/^!stats1{0,1}/', $string)) {
        return do_stats1($string);
    }
    if (preg_match('/^!time/', $string)) {
        return date(" d-m-Y H:i:s") . ', ' . _('una hora menos en Canarias');
    }
    if (preg_match('/^!help/', $string)) {
        return _('comandos') . ': http://meneame.wikispaces.com/Comandos';
    }
    if (preg_match('/^!cabal/', $string)) {
        return do_cabal($string);
    }
    if (preg_match('/^!dariaunojo/', $string)) {
        return do_ojo($string);
    }
    if (preg_match('/^!wiki/', $string)) {
        return 'wiki: http://meneame.wikispaces.com/';
    }
    if (preg_match('/^!promote/', $string)) {
        return 'http://' . get_server_name() . $globals['base_url'] . 'promote.php';
    }
    if (preg_match('/^!hoygan/', $string)) {
        return '¡HOYGAN! BISITEN http://' . get_server_name() . $globals['base_url'] . 'sneak.php?hoygan=1 GRASIAS DE HANTEMANO';
    }
    if (preg_match('/^!webstats/', $string)) {
        return 'http://www.quantcast.com/' . get_server_name();
    }
    if (preg_match('/^!ignore/', $string)) {
        return do_ignore($string);
    }
    if (preg_match('/^!admins/', $string)) {
        return do_admins($string);
    }
    return false;
}
コード例 #15
0
ファイル: application.php プロジェクト: reoring/sabel
function get_uri_prefix($secure = false, $absolute = false)
{
    $prefix = "";
    if ($secure || $absolute) {
        $server = get_server_name();
        $prefix = ($secure ? "https" : "http") . "://" . $server;
    }
    if ($bus = Sabel_Context::getContext()->getBus()) {
        if ($bus->get("NO_VIRTUAL_HOST") && defined("URI_PREFIX")) {
            $prefix .= URI_PREFIX;
        }
    }
    return $prefix;
}
コード例 #16
0
ファイル: fbconnect.php プロジェクト: brainsqueezer/fffff
 function __construct()
 {
     global $globals;
     $this->service = 'facebook';
     if ($globals['mobile_version']) {
         $server = 'm.facebook.com';
     } else {
         $server = 'www.facebook.com';
     }
     // Store de FB URL for login
     $location_ok = urlencode('http://' . get_server_name() . $globals['base_url'] . 'oauth/fbconnect.php?op=ok' . '&t=' . time());
     $location_cancel = urlencode('http://' . get_server_name() . $globals['base_url'] . 'oauth/fbconnect.php?op=cancel' . '&t=' . time());
     $this->authorize_url = "http://{$server}/login.php?api_key=" . $globals['facebook_key'] . '&extern=1&fbconnect=1&return_session=1&v=1.0&next=' . $location_ok . '&cancel_url=' . $location_ok;
     parent::__construct();
 }
コード例 #17
0
ファイル: external_post.php プロジェクト: brainsqueezer/fffff
function pubsub_post()
{
    require_once mnminclude . 'pubsubhubbub/publisher.php';
    global $globals;
    if (!$globals['pubsub']) {
        return false;
    }
    $rss = 'http://' . get_server_name() . $globals['base_url'] . 'rss2.php';
    $p = new Publisher($globals['pubsub']);
    if ($p->publish_update($rss)) {
        syslog(LOG_NOTICE, "Meneame: posted to pubsub ({$rss})");
    } else {
        syslog(LOG_NOTICE, "Meneame: failed to post to pubsub ({$rss})");
    }
}
コード例 #18
0
ファイル: gplus.php プロジェクト: GallardoAlba/Meneame
 function __construct()
 {
     global $globals;
     if (!$globals['oauth']['gplus']['consumer_key'] || !$globals['oauth']['gplus']['consumer_secret']) {
         $oauth = null;
     }
     $this->service = 'gplus';
     $callback = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'oauth/signin.php?service=gplus';
     $this->client = new apiClient();
     $this->client->setClientId($globals['oauth']['gplus']['consumer_key']);
     $this->client->setClientSecret($globals['oauth']['gplus']['consumer_secret']);
     $this->client->setRedirectUri($callback);
     // $this->client->setApprovalPrompt('auto'); // TODO: pass to auto, check token is ok
     $this->client->setApplicationName("Menéame Login");
     $this->gplus = new apiPlusService($this->client);
     parent::__construct();
 }
コード例 #19
0
ファイル: trackback.php プロジェクト: brainsqueezer/fffff
 function send($link)
 {
     if (empty($this->url)) {
         return;
     }
     $title = urlencode($this->title);
     // Convert everything to HTML and the strip all html tags.
     $excerpt = urlencode(strip_tags(text_to_html($this->content)));
     $blog_name = urlencode(get_server_name());
     $tb_url = $this->url;
     $url = urlencode($link->get_permalink());
     $query_string = "charset=UTF-8&title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
     $trackback_url = parse_url($this->url);
     $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
     $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
     $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' . "\r\n";
     $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
     $http_request .= "User-Agent: MNM (http://meneame.net) ";
     $http_request .= "\r\n\r\n";
     $http_request .= $query_string;
     if ('' == $trackback_url['port']) {
         $trackback_url['port'] = 80;
     }
     $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 5);
     if ($fs && ($res = @fputs($fs, $http_request))) {
         /*********** DEBUG **********
                 $debug_file = '/tmp/trackback.log';
                 $fp = fopen($debug_file, 'a');
                 fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
                 while(!@feof($fs)) {
                         fwrite($fp, @fgets($fs, 4096));
                 }
                 fwrite($fp, "\n\n");
                 fclose($fp);
         		/*********** DEBUG ************/
         @fclose($fs);
         $this->status = 'ok';
         $this->store();
         return true;
     }
     $this->status = 'error';
     $this->store();
     return $false;
 }
コード例 #20
0
ファイル: twitter.php プロジェクト: brainsqueezer/fffff
 function authRequest()
 {
     global $globals;
     try {
         if ($request_token_info = $this->oauth->getRequestToken($this->request_token_url, 'http://' . get_server_name() . $globals['base_url'] . 'oauth/signin.php?service=twitter')) {
             // if [oauth_callback_confirmed] => true then is oauth 1.0a
             setcookie('oauth_token', $request_token_info['oauth_token'], 0);
             setcookie('oauth_token_secret', $request_token_info['oauth_token_secret'], 0);
             $this->token_secret = $request_token_info['oauth_token_secret'];
             $this->token = $request_token_info['oauth_token'];
             header("Location: " . $this->authorize_url . "?oauth_token={$this->token}");
             exit;
         } else {
             do_error(_('error obteniendo tokens'), false, false);
         }
     } catch (Exception $e) {
         do_error(_('error de conexión a') . " {$this->service} (authRequest)", false, false);
     }
 }
コード例 #21
0
ファイル: sitemap.php プロジェクト: brainsqueezer/fffff
function do_published($page)
{
    global $globals, $index_size, $db;
    $start = $page * $index_size;
    // Force to open DB connection
    $db->get_var("select count(*) from users");
    $sql = "SELECT SQL_NO_CACHE link_uri from links where link_status='published' order by link_date asc limit {$start}, {$index_size}";
    $result = $db->get_col($sql);
    if (!$result) {
        return;
    }
    echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
    foreach ($result as $uri) {
        echo '<url>' . "\n";
        echo '<loc>http://' . get_server_name() . $globals['base_url'] . $globals['base_story_url'] . $uri . '</loc>' . "\n";
        echo '</url>' . "\n";
    }
    echo '</urlset>' . "\n";
}
コード例 #22
0
ファイル: sneaker-stats.php プロジェクト: brainsqueezer/fffff
function check_stats($string)
{
    global $globals;
    if (preg_match('/^!top/', $string)) {
        return do_top($string);
    }
    if (preg_match('/^!statsu/', $string)) {
        return do_statsu($string);
    }
    if (preg_match('/^!stats2/', $string)) {
        return do_stats2($string);
    }
    if (preg_match('/^!stats3/', $string)) {
        return do_stats3($string);
    }
    if (preg_match('/^!stats1{0,1}/', $string)) {
        return do_stats1($string);
    }
    if (preg_match('/^!help/', $string)) {
        return _('comandos') . ': <a href="http://meneame.wikispaces.com/Comandos">meneame.wikispaces.com/Comandos</a>';
    }
    if (preg_match('/^!cabal/', $string)) {
        return do_cabal($string);
    }
    if (preg_match('/^!dariaunojo/', $string)) {
        return do_ojo($string);
    }
    if (preg_match('/^!wiki/', $string)) {
        return 'wiki: <a href="http://meneame.wikispaces.com/">meneame.wikispaces.com</a>';
    }
    if (preg_match('/^!promote/', $string)) {
        return '<a href="http://' . get_server_name() . $globals['base_url'] . 'archives/promote.html">promote.html</a>';
    }
    if (preg_match('/^!hoygan/', $string)) {
        return '¡HOYGAN! BISITEN http://' . get_server_name() . $globals['base_url'] . 'hoygan.php GRASIAS DE HANTEMANO';
    }
    if (preg_match('/^!webstats/', $string)) {
        return '<a href="http://' . get_server_name() . '/statcounter">Statcounter</a>, <a href="http://' . get_server_name() . '/webalizer/">Webalizer</a>';
    }
    return '';
}
コード例 #23
0
ファイル: mail.php プロジェクト: brainsqueezer/fffff
function send_recover_mail($user)
{
    global $site_key, $globals;
    require_once mnminclude . 'user.php';
    $now = time();
    $key = md5($user->id . $user->pass . $now . $site_key . get_server_name());
    $url = 'http://' . get_server_name() . $globals['base_url'] . 'profile.php?login='******'&t=' . $now . '&k=' . $key;
    //echo "$user->username, $user->email, $url<br />";
    $to = $user->email;
    $subject = _('Recuperación o verificación de la contraseña de ') . get_server_name();
    $message = $to . _(': para poder acceder sin la clave, conéctate a la siguiente dirección en menos de dos horas:') . "\n\n{$url}\n\n";
    $message .= _('Pasado este tiempo puedes volver a solicitar acceso en: ') . "\nhttp://" . get_server_name() . $globals['base_url'] . "login.php?op=recover\n\n";
    $message .= _('Una vez en tu perfil, puedes cambiar la clave de acceso.') . "\n" . "\n";
    $message .= "\n\n" . _('Este mensaje ha sido enviado a solicitud de la dirección: ') . $globals['user_ip'] . "\n\n";
    $message .= "-- \n  " . _('el equipo de menéame');
    $message = wordwrap($message, 70);
    $headers = 'Content-Type: text/plain; charset="utf-8"' . "\n" . 'X-Mailer: meneame.net/PHP/' . phpversion() . "\n" . 'From: meneame.net <web@' . get_server_name() . ">\n";
    //$pars = '-fweb@'.get_server_name();
    mail($to, $subject, $message, $headers);
    echo '<p><strong>' . _('Correo enviado, mira tu buzón, allí están las instrucciones. Mira también en la carpeta de spam.') . '</strong></p>';
    return true;
}
コード例 #24
0
ファイル: blogs_rss2.php プロジェクト: brainsqueezer/fffff
function do_header($title)
{
    global $if_modified, $last_modified, $dblang, $globals;
    if (!$last_modified > 0) {
        if ($if_modified > 0) {
            $last_modified = $if_modified;
        } else {
            $last_modified = time();
        }
    }
    if ($if_modified) {
        header('X-If-Modified: ' . gmdate('D, d M Y H:i:s', $if_modified));
    }
    header('X-Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified));
    if ($last_modified <= $if_modified) {
        header('HTTP/1.1 304 Not Modified');
        exit;
    }
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified) . ' GMT');
    header('Content-type: text/xml; charset=UTF-8', true);
    echo '<?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
    echo '<rss version="2.0" ' . "\n";
    echo '     xmlns:atom="http://www.w3.org/2005/Atom"' . "\n";
    echo '     xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n";
    echo '     xmlns:wfw="http://wellformedweb.org/CommentAPI/"' . "\n";
    echo '     xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n";
    echo '     xmlns:meneame="http://meneame.net/faq-es.php"' . "\n";
    echo ' >' . "\n";
    echo '<channel>' . "\n";
    echo '	<atom:link href="http://' . get_server_name() . $globals['base_url'] . 'blogs_rss2.php" rel="self" type="application/rss+xml" />' . "\n";
    echo '	<title>' . $title . '</title>' . "\n";
    echo '	<link>http://' . get_server_name() . $globals['base_url'] . 'rsss.php</link>' . "\n";
    echo "\t<image><title>" . $title . "</title><link>http://" . get_server_name() . $globals['base_url'] . "rsss.php</link><url>http://" . get_static_server_name() . $globals['base_url'] . "img/mnm/eli-rss.png</url></image>\n";
    echo '	<description>' . _('blogs de usuarios de Menéame') . '</description>' . "\n";
    echo '	<pubDate>' . date("r", $last_modified) . '</pubDate>' . "\n";
    echo '	<generator>http://blog.meneame.net/</generator>' . "\n";
    echo '	<language>' . $dblang . '</language>' . "\n";
}
コード例 #25
0
ファイル: index.php プロジェクト: brainsqueezer/fffff
                    // $db->get_var("SELECT count(distinct(conversation_from)) FROM conversations, posts WHERE conversation_user_to=$user->id and conversation_type='post' and post_id = conversation_from ");
                    $rss_option = "sneakme_rss2.php?conversation_of={$user->id}";
                    break;
                default:
                    $view = 0;
                    $page_title = sprintf(_('notas de %s'), $user->username);
                    $globals['search_options']['u'] = $user->username;
                    $where = "post_user_id={$user->id}";
                    $order_by = "ORDER BY post_id desc";
                    $limit = "LIMIT {$offset},{$page_size}";
                    $rows = $db->get_var("SELECT count(*) FROM posts WHERE post_user_id={$user->id}");
                    $rss_option = "sneakme_rss2.php?user_id={$user->id}";
            }
        }
}
if (isset($globals['canonical_server_name']) && $globals['canonical_server_name'] != get_server_name()) {
    $globals['noindex'] = true;
}
do_header($page_title, _('nótame'), get_posts_menu($tab_option, $user->username));
$conversation_extra = '';
if ($tab_option == 4) {
    if ($current_user->user_id == $user->id) {
        //$conversation_extra = ' ['.Post::get_unread_conversations($user->id).']';
        $conversation_extra = ' [<span id="p_c_counter">0</span>]';
        $whose = _('mías');
    } else {
        $whose = _('suyas');
    }
    $options = array($whose => post_get_base_url($user->username), _('amigos') => post_get_base_url("{$user->username}/_friends"), _('favoritos') => post_get_base_url("{$user->username}/_favorites"), _('conversación') . $conversation_extra => post_get_base_url("{$user->username}/_conversation"), sprintf(_('debates con %s'), $user->username) => $globals['base_url'] . "between.php?type=posts&amp;u1={$current_user->user_login}&amp;u2={$user->username}", sprintf(_('perfil de %s'), $user->username) => get_user_uri($user->username));
} elseif ($tab_option == 1 && $current_user->user_id > 0) {
    //$conversation_extra = ' ['.Post::get_unread_conversations($user->id).']';
コード例 #26
0
ファイル: priv_edit.php プロジェクト: GallardoAlba/Meneame
function notify_user($from, $to, $text)
{
    $sender = new User($from);
    $user = new User($to);
    if (!$user || !$sender) {
        return;
    }
    if (!check_email($user->email)) {
        return;
    }
    if (!User::get_pref($to, 'notify_priv')) {
        return;
    }
    $url = 'http://' . get_server_name() . post_get_base_url('_priv');
    $subject = "Notificación de mensaje privado de {$sender->username}";
    $message = "{$sender->username} " . _('escribió') . ":\n{$url}\n\n{$text}";
    require_once mnminclude . 'mail.php';
    send_mail($user->email, $subject, $message);
}
コード例 #27
0
ファイル: list.php プロジェクト: GallardoAlba/Meneame
function get_link($link_id)
{
    global $globals;
    $link = Link::from_db($link_id);
    if (!$link) {
        return false;
    }
    $obj = array();
    $obj['id'] = (int) $link->id;
    $obj['permalink'] = $link->get_permalink();
    $obj['go'] = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'go?id=' . $link->id;
    $obj['url'] = $link->url;
    $obj['from'] = parse_url($link->url, PHP_URL_HOST);
    $obj['sub'] = $link->sub_name;
    $obj['status'] = $link->status;
    $obj['user'] = $link->username;
    $obj['clicks'] = (int) $link->clicks;
    $obj['votes'] = intval($link->votes + $link->anonymous);
    $obj['negatives'] = (int) $link->negatives;
    $obj['karma'] = intval($link->karma);
    $obj['comments'] = (int) $link->comments;
    $obj['title'] = html_entity_decode($link->title);
    $obj['tags'] = html_entity_decode($link->tags);
    $obj['sent_date'] = (int) $link->sent_date;
    if ($link->status == 'published') {
        $obj['date'] = (int) $link->date;
    } else {
        $obj['date'] = (int) $link->sent_date;
    }
    // $obj['content'] = $link->to_html($link->content);
    $obj['content'] = html_entity_decode($link->content);
    if ($link->has_thumb()) {
        $obj['thumb'] = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'backend/media?type=link&id=' . $link->id;
    }
    return $obj;
}
コード例 #28
0
ファイル: fonctions.php プロジェクト: Samara94/dolibarr
/**
 * Fonction permettant de générer les URL pour les sondage
 *
 * @param   string    $id     L'identifiant du sondage
 * @param   bool      $admin  True pour générer une URL pour l'administration d'un sondage, False pour un URL publique
 * @return  string            L'url pour le sondage
 */
function getUrlSondage($id, $admin = false)
{
    if ($admin === true) {
        $url = get_server_name() . 'results.php?id=' . $id;
    } else {
        $url = get_server_name() . '/public/studs.php?sondage=' . $id;
    }
    return $url;
}
コード例 #29
0
ファイル: go.php プロジェクト: GallardoAlba/Meneame
            $url = $globals['scheme'] . '//' . get_server_name() . post_get_base_url($id);
            do_redirection($url);
            exit(0);
        case 'comment':
            $c = new Comment();
            $c->id = $id;
            $url = $globals['scheme'] . '//' . get_server_name() . $c->get_relative_individual_permalink();
            do_redirection($url);
            exit(0);
        default:
            $l = Link::from_db($id, null, false);
            if (!$l) {
                exit(0);
            }
            if (!$globals['mobile'] && !$globals['mobile_version'] && !empty($l->url) && $current_user->user_id > 0 && (empty($globals['https']) || preg_match('/^https:/', $l->url)) && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') {
                $url = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'b/' . $id;
                // we use always http to load no https pages
                do_redirection($url, 307);
            } else {
                if (empty($l->url)) {
                    $url = $l->get_permalink();
                } else {
                    $url = $l->url;
                }
                do_redirection($url);
            }
            $l->add_click();
            exit(0);
    }
} else {
    require mnminclude . $globals['html_main'];
コード例 #30
0
<?
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// 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');

header('Content-Type: text/plain; charset=UTF-8');
if(empty($_GET['url'])) {
	echo 'KO';
	die;
}
$url = preg_replace('/ /', '+', $_GET['url']);
$all = intval($_GET['all']);
if ($all == '1') {
    $links = $db->get_results("select SQL_NO_CACHE link_id, link_votes, link_status from links where link_url like '$url%' order by link_date DESC");
} else {
    $links = $db->get_results("select SQL_NO_CACHE link_id, link_votes, link_status from links where link_url='$url'");
}
if ($links) {
	foreach ($links as $dblink) {
	    echo 'OK http://'.get_server_name().'/story.php?id='.$dblink->link_id.' '.$dblink->link_votes.' '.$dblink->link_status."\n";
	}
} else {
	echo 'KO http://'.get_server_name().'/submit.php?url='.$url;
}
?>