function print_text($length = 0, $html_id = false)
 {
     global $current_user, $globals;
     if ($length > 0 && mb_strlen($this->content) > $length + $length / 2) {
         $this->content = preg_replace('/&\\w*$/', '', mb_substr($this->content, 0, $length));
         $expand = '...&nbsp;&nbsp;' . '<a href="javascript:load_html(\'get_commentmobile.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">&#187;&nbsp;' . _('ver todo el comentario') . '</a>';
     }
     echo put_smileys(save_text_to_html($this->content)) . $expand;
     echo "\n";
 }
Exemple #2
0
function get_post($time, $type, $postid, $userid)
{
    global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items;
    $event = $db->get_row("select user_login, post_user_id, post_content, media.size as media_size from posts LEFT JOIN media ON (media.type='post' and media.id = posts.post_id and media.version = 0), users where post_id = {$postid} and user_id={$userid}");
    if (!$event) {
        return;
    }
    $json['link'] = post_get_base_url($postid);
    $json['ts'] = $time;
    $json['type'] = $type;
    $json['who'] = $event->user_login;
    $json['status'] = _('nótame');
    $json['title'] = put_smileys(text_to_summary(preg_replace('/(@[\\S.-]+)(,\\d+)/', '$1', $event->post_content), 130));
    if (mb_strlen(trim($json['title'])) == 0) {
        $json['title'] = '...';
    }
    $json['votes'] = 0;
    $json['com'] = 0;
    $json['uid'] = $userid;
    $json['id'] = $postid;
    if ($userid > 0) {
        $json['icon'] = get_avatar_url($userid, -1, 20);
    }
    if ($event->media_size > 0) {
        $json['thumb'] = $globals['base_static'] . Upload::get_cache_relative_dir($postid) . "/media_thumb-post-{$postid}.jpg";
    }
    $key = $time . ':' . $type . ':' . $postid;
    $events[$key] = $json;
    if ($time > $last_timestamp) {
        $last_timestamp = $time;
    }
}
Exemple #3
0
	function print_text($length = 0, $html_id=false) {
		global $current_user, $globals;

		if (!$html_id) $html_id = $this->id;

		if (!$this->basic_summary && (
					($this->author == $current_user->user_id && $globals['now'] - $this->date < $globals['comment_edit_time']) 
					|| (($this->author != $current_user->user_id || $this->type == 'admin')
					&& $current_user->user_level == 'god')) ) { // gods can always edit 
			$expand = '&nbsp;&nbsp;<a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'c-'.$html_id.'\',0,'.$this->id.')" title="'._('editar comentario').'"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>';

		} 
		if ($length > 0 && mb_strlen($this->content) > $length + $length/2) {

			$this->content = preg_replace('/[&<\{]\w*$/', '', mb_substr($this->content, 0 , $length));
			// Check all html tags are closed
			if (preg_match('/<\w+>/', $this->content)) {
				$this->content = close_tags($this->content);
			}
			$this->content = preg_replace('/&\w*$|<\w{1,6}>([^<>]*)$/', "$1", mb_substr($this->content, 0 , $length));
			$expand .= '&nbsp;&nbsp;' .
				'<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-'.$this->id.'\',0,'.$this->id.')" title="'._('resto del comentario').'">&#187;&nbsp;'._('ver todo el comentario').'</a>';
		}

		echo put_smileys($this->put_comment_tooltips(save_text_to_html($this->content, 'comments'))) . $expand;
		echo "\n";
	}
    $title = _('Nótame') . ': ' . _('notas');
}
do_header($title);
$post = new Post();
if ($sql) {
    $posts = $db->get_col($sql);
}
if ($posts) {
    foreach ($posts as $post_id) {
        $post = Post::from_db($post_id);
        if (!$post) {
            continue;
        }
        $title = text_to_summary($post->clean_content(), 40);
        $title = $post->username . ': ' . htmlentities2unicodeentities($title);
        $content = htmlentities2unicodeentities(put_smileys($post->to_html($post->clean_content())));
        echo "\t<item>\n";
        echo "\t\t<title>{$title}</title>\n";
        echo "\t\t<link>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</link>\n";
        echo "\t\t<pubDate>" . date("r", $post->date) . "</pubDate>\n";
        echo "\t\t<dc:creator>{$post->username}</dc:creator>\n";
        echo "\t\t<guid>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</guid>\n";
        // Insert GEO
        if ($latlng = geo_latlng('user', $post->author)) {
            echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n";
        }
        echo "\t\t<description><![CDATA[{$content}";
        echo '</p><p>&#187;&nbsp;' . _('autor') . ': <strong>' . $post->username . '</strong></p>';
        echo "]]></description>\n";
        echo "\t</item>\n\n";
    }
Exemple #5
0
function get_post($time, $type, $postid, $userid)
{
    global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items;
    $event = $db->get_row("select SQL_CACHE user_login, post_user_id, post_content from posts, users where post_id = {$postid} and user_id={$userid}");
    if (!$event) {
        return;
    }
    $json['link'] = post_get_base_url($event->user_login) . "/{$postid}";
    $json['ts'] = $time;
    $json['type'] = $type;
    $json['who'] = $event->user_login;
    $json['status'] = _('nótame');
    $json['title'] = put_smileys(text_to_summary(preg_replace('/(@[\\S.-]+)(,\\d+)/', '$1', $event->post_content), 130));
    $json['votes'] = 0;
    $json['com'] = 0;
    $json['uid'] = $userid;
    $json['id'] = $postid;
    if ($userid > 0) {
        $json['icon'] = get_avatar_url($userid, -1, 20);
    }
    $key = $time . ':' . $type . ':' . $postid;
    $events[$key] = $json;
    if ($time > $last_timestamp) {
        $last_timestamp = $time;
    }
}
Exemple #6
0
    stats_increment('ajax');
}
include_once mnminclude . 'post.php';
if (!empty($_GET['id'])) {
    if (preg_match('/([\\w\\.\\-_]+)-(\\d+)/', $_GET['id'], $matches) > 0) {
        $user = $db->escape($matches[1]);
        $date = $matches[2];
        $id = (int) $db->get_var("select post_id from posts, users where user_login = '******' and post_user_id = user_id and post_date < FROM_UNIXTIME({$date}) order by post_date desc limit 1");
        if (!$id > 0) {
            echo '<strong>Error: </strong>' . _('usuario o nota no encontrada');
            die;
        }
    } else {
        $id = intval($_GET['id']);
    }
} else {
    die;
}
$post = new Post();
$post->id = $id;
$post->read();
if (!$post->read) {
    die;
}
echo '<div style="font-size:8.5pt;width:280px; margin-right:15px; overflow:hidden">';
if ($post->avatar) {
    echo '<img src="' . get_avatar_url($post->author, $post->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 5px 0;"/>';
}
echo '<a href="' . post_get_base_url($post->username) . '" target="_blank"><strong>' . $post->username . '</strong></a> (' . $post->src . ')<br/>';
echo put_smileys(save_text_to_html($post->content));
echo '</div>';
Exemple #7
0
 function print_text($length = 0)
 {
     global $current_user, $globals;
     if (!$this->basic_summary && ($this->author == $current_user->user_id && time() - $this->date < $globals['posts_edit_time'] || $current_user->user_level == 'god' && time() - $this->date < $globals['posts_edit_time_admin'])) {
         // Admins can edit up to 10 days
         $expand = '&nbsp;&nbsp;&nbsp;<a href="javascript:post_edit(' . $this->id . ')" title="' . _('editar') . '"><img class="mini-icon-text" src="' . $globals['base_static'] . 'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>';
     } elseif ($length > 0) {
         $this->content = text_to_summary($this->content, $length);
     }
     echo put_smileys($this->put_tooltips(save_text_to_html($this->content, 'posts'))) . $expand;
     echo "\n";
 }
Exemple #8
0
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
include mnminclude . 'comment.php';
include mnminclude . 'link.php';
header('Content-Type: text/html; charset=utf-8');
stats_increment('ajax');
$id = intval($_GET['id']);
if (!$id > 0) {
    die;
}
$comment = new Comment();
$comment->id = $id;
$comment->read();
if (!$comment->read) {
    die;
}
$link = new Link();
$link->id = $comment->link;
$link->read_basic();
echo '<div style="font-size:8.5pt;width:280px; margin-right:15px; overflow:hidden">';
if ($comment->avatar) {
    echo '<img src="' . get_avatar_url($comment->author, $comment->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 4px 0;"/>';
}
echo '<a href="' . $link->get_relative_permalink() . '#comment-' . $comment->order . '" target="_blank"><strong>' . $comment->username . '</strong></a><br/>';
echo put_smileys(text_to_summary($comment->content, 500));
echo '</div>';
stats_increment('ajax');
if (!empty($_GET['id'])) {
    if (!empty($_GET['link'])) {
        $link = intval($_GET['link']);
        $order = intval($_GET['id']);
        $id = $db->get_var("select comment_id from comments where comment_link_id={$link} and comment_order={$order}");
        if (!$id > 0) {
            die;
        }
    } else {
        $id = intval($_GET['id']);
    }
} else {
    die;
}
$comment = new Comment();
$comment->id = $id;
$comment->read();
if (!$comment->read) {
    die;
}
if ($comment->type != 'admin') {
    if ($comment->avatar) {
        echo '<img src="' . get_avatar_url($comment->author, $comment->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 4px 0;"/>';
    }
    echo '<strong>' . $comment->username . '</strong><br/>';
} else {
    echo '<strong>' . get_server_name() . '</strong><br/>';
}
echo put_smileys(save_text_to_html(mb_substr($comment->content, 0, 1000)));
Exemple #10
0
}
do_header($title);
if ($comments) {
    foreach ($comments as $comment_id) {
        $comment = Comment::from_db($comment_id);
        if ($comment->type == 'admin') {
            if ($individual_user) {
                continue;
            } else {
                $comment->username = get_server_name();
            }
        }
        if ($comment->user_level == 'disabled') {
            $content = '[' . _('Usuario deshabilitado') . ']';
        } else {
            $content = put_smileys(save_text_to_html(htmlentities2unicodeentities($comment->content)));
        }
        echo "\t<item>\n";
        $link = Link::from_db($comment->link);
        echo "\t\t<meneame:comment_id>{$comment->id}</meneame:comment_id>\n";
        echo "\t\t<meneame:link_id>{$comment->link}</meneame:link_id>\n";
        echo "\t\t<meneame:order>{$comment->c_order}</meneame:order>\n";
        echo "\t\t<meneame:user>{$comment->username}</meneame:user>\n";
        echo "\t\t<meneame:votes>" . intval($comment->votes) . "</meneame:votes>\n";
        echo "\t\t<meneame:karma>" . intval($comment->karma) . "</meneame:karma>\n";
        echo "\t\t<meneame:url>" . 'http://' . get_server_name() . $comment->get_relative_individual_permalink() . "</meneame:url>\n";
        // Title must not carry htmlentities
        echo "\t\t<title>#{$comment->order} " . htmlentities2unicodeentities($link->title) . "</title>\n";
        echo "\t\t<link>" . $link->get_permalink() . "/000" . $comment->order . "</link>\n";
        echo "\t\t<pubDate>" . date("r", $comment->date) . "</pubDate>\n";
        echo "\t\t<dc:creator>{$comment->username}</dc:creator>\n";
Exemple #11
0
 function print_text($length = 0)
 {
     global $current_user, $globals;
     if ($this->author == $current_user->user_id && time() - $this->date < 3600 || $current_user->user_level == 'god' && time() - $this->date < 864000) {
         // Admins can edit up to 10 days
         $expand = '&nbsp;&nbsp;&nbsp;<a href="javascript:get_votes(\'post_edit.php\',\'edit_post\',\'pcontainer-' . $this->id . '\',0,' . $this->id . ')" title="' . _('editar') . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>';
     }
     echo put_smileys($this->put_tooltips(save_text_to_html($this->content))) . $expand;
     echo "\n";
 }
Exemple #12
0
 function print_text($length = 0, $single_link = true)
 {
     global $current_user, $globals;
     if ($this->author == $current_user->user_id && $globals['now'] - $this->date < $globals['comment_edit_time'] || $current_user->user_level == 'god') {
         // gods can always edit
         $expand = '&nbsp;&nbsp;<a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'ccontainer-' . $this->id . '\',0,' . $this->id . ')" title="' . _('editar comentario') . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>';
     } elseif ($length > 0 && mb_strlen($this->content) > $length + $length / 2) {
         $this->content = preg_replace('/&\\w*$/', '', mb_substr($this->content, 0, $length));
         $expand = '...&nbsp;&nbsp;' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">&#187;&nbsp;' . _('ver todo el comentario') . '</a>';
     }
     echo put_smileys($this->put_comment_tooltips(save_text_to_html($this->content))) . $expand;
     echo "\n";
 }
Exemple #13
0
    //
    $id = 0;
    $sql = "SELECT post_id FROM posts WHERE {$from_time} ORDER BY post_date DESC LIMIT {$rows}";
    $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(post_date) FROM posts ORDER BY post_date DESC LIMIT 1");
    $title = _('Nótame: notas');
}
do_header($title);
$post = new Post();
$posts = $db->get_col($sql);
if ($posts) {
    foreach ($posts as $post_id) {
        $post->id = $post_id;
        $post->read();
        $title = strip_tags(text_to_summary($post->content, 40));
        $title = $post->username . ': ' . htmlentities2unicodeentities($title);
        $content = htmlentities2unicodeentities(put_smileys(save_text_to_html($post->content)));
        echo "\t<item>\n";
        echo "\t\t<title>{$title}</title>\n";
        echo "\t\t<link>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</link>\n";
        echo "\t\t<pubDate>" . date("r", $post->date) . "</pubDate>\n";
        echo "\t\t<dc:creator>{$post->username}</dc:creator>\n";
        echo "\t\t<guid>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</guid>\n";
        // Insert GEO
        if ($latlng = geo_latlng('user', $post->author)) {
            echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n";
        }
        echo "\t\t<description><![CDATA[{$content}";
        echo '</p><p>&#187;&nbsp;' . _('autor') . ': <strong>' . $post->username . '</strong></p>';
        echo "]]></description>\n";
        echo "\t</item>\n\n";
    }