Ejemplo n.º 1
0
function render_comment(&$post, &$profile, &$parent)
{
    require 'wp-content/language/lang_chooser.php';
    //Loads the language-file
    global $request;
    $comments = "";
    $comments .= '<hr />';
    //  $cctime = date( "g:i A" , strtotime($post->created) );
    //  $ccdate = date( get_settings('date_format'), strtotime($post->created) );
    $ccurl = $request->url_for(array('resource' => 'posts', 'id' => $post->id));
    $ccrurl = 'JavaScript:inline_comment(' . $post->id . ',' . $parent->id . ');';
    $comments .= '<h4>';
    $comments .= ' <span class="meta">';
    //  $comments .= $cctime.' <em>on</em> '.$ccdate;
    $comments .= '<span class="actions">';
    $comments .= '<a href="' . $ccurl . '">Permalink</a>  | <a rel=\'nofollow\' class=\'comment-reply-link\' href="' . $ccrurl . '">' . $txt['wp_reply'] . '</a>';
    if (get_profile_id() == $post->profile_id) {
        $comments .= ' | <a href="' . get_edit_post_link($post) . '" class="post-edit-link" rel="' . $post->id . '">' . $txt['wp_Edit'] . '</a>';
        $comments .= ' | <a href="' . get_edit_post_link($post, 'remove') . '" class="post-remove-link" rel="' . $post->id . '">' . $txt['wp_remove'] . '</a>';
    }
    $comments .= '</span>';
    $comments .= '<br />';
    $comments .= '<img alt=\'image\' src=\'' . profile_get_avatar($profile) . '\' class=\'avatar avatar-32\' height=\'32\' width=\'32\' />';
    $comments .= '<a class="nick" href=\'' . base_path(true) . '' . $profile->nickname . '\'>' . $profile->nickname . '</a>&nbsp;';
    $comments .= laconica_time($post->created);
    $comments .= '</span>';
    $comments .= '</h4>';
    $comments .= '<div class="commentcontent" id="commentcontent-' . $post->id . '">';
    $comments .= '<p>' . render_notice($post->title, $post, $profile) . '</p>';
    $comments .= '</div>';
    return $comments;
}
Ejemplo n.º 2
0
function send_ping(&$model, &$rec)
{
    if (!PING) {
        return;
    }
    global $db;
    global $request;
    $req =& $request;
    $Entry =& $db->get_table('entries');
    $notify_table = $model->table;
    $recid = $rec->id;
    if (!empty($db->prefix)) {
        $chan = $db->prefix;
    } else {
        $chan = "chan";
    }
    if (REALTIME_HOST) {
        $o = owner_of($rec);
        $payload = array();
        if (environment('threaded') && isset($rec->parent_id) && $rec->parent_id > 0) {
            // push a P2 comment
            $par = $db->get_record('posts', $rec->parent_id);
            $tweet = render_comment($rec, $o, $par);
            $payload['html'] = $tweet;
            if ($rec->parent_id > 0) {
                $payload['in_reply_to'] = "#commentcontent-" . $rec->parent_id;
            } else {
                $payload['in_reply_to'] = "#content-" . $rec->parent_id;
            }
        } else {
            // push a P2 tweet
            $o = owner_of($rec);
            $tweet = '<hr />' . "\n";
            $tweet .= '<h4>' . "\n";
            $tweet .= '<span class="meta"> <span class="actions"> <a href="' . $request->url_for(array('resource' => $notify_table, 'id' => $recid)) . '" class="thepermalink">Permalink</a> | <a href="' . $request->url_for(array('resource' => $notify_table, 'id' => $recid)) . '" class="post-reply-link" rel="' . $recid . '">Reply</a> <br />' . "\n";
            $tweet .= '</span> <br />' . "\n";
            $tweet .= '<img alt="" src="' . $o->avatar . '" class="avatar avatar-48" height="48" width="48" /> <a class="nick" href="' . $o->profile . '" title="Posts by ' . $o->nickname . '">' . $o->nickname . '</a> ' . laconica_time($rec->created) . ' | <a href="">0</a> </span>' . "\n";
            $tweet .= '</h4>' . "\n";
            $tweet .= '<div class="postcontent" id="content-<?php echo $recid; ">' . "\n";
            $tweet .= '<p>' . "\n";
            $tweet .= render_notice($rec->title, $rec, $o);
            $tweet .= '</p>' . "\n";
            $tweet .= '</div>' . "\n";
            $tweet .= '<!-- // postcontent -->' . "\n";
            $tweet .= '<div class="bottom_of_entry">' . "\n";
            $tweet .= '&nbsp;' . "\n";
            $tweet .= '</div>' . "\n";
            $tweet .= '<div class="commentlist">' . "\n";
            $tweet .= '</div>' . "\n";
            $oldstyle = false;
            if ($oldstyle) {
                $tweet = '';
                $tweet .= '<li id="prologue-' . $rec->id . '" class="user_id_' . $o->id . '">';
                $tweet .= '<img alt=\'\' src=\'' . $o->avatar . '\' class=\'avatar avatar-48\' height=\'48\' width=\'48\' />';
                $tweet .= '<h4>';
                $tweet .= '<a href="' . $o->profile . '" title="Posts by ' . $o->nickname . '">' . $o->nickname . '</a>    <span class="meta">' . date("g:i A", strtotime($rec->created)) . '<em>on</em> ' . date(get_settings('date_format'), strtotime($rec->created)) . ' |';
                $tweet .= '        <span class="actions">';
                $tweet .= '    <a href="' . $request->url_for(array('resource' => $notify_table, 'action' => 'entry.html', 'id' => $recid)) . '" class="thepermalink">Permalink</a>';
                $tweet .= '                  </span>';
                $tweet .= '  <br />';
                $tweet .= '          </span>';
                $tweet .= '  </h4>';
                $tweet .= '  <div class="postcontent" id="content-' . $rec->id . '"><p>' . render_notice($rec->title, $rec, $o) . '</p></div>';
                $tweet .= '    <div class="bottom_of_entry">&nbsp;</div>';
                $tweet .= '   <ul class="commentlist">';
                //      $tweet .= '   <ul id="comments" class="commentlist">';
                $tweet .= '  </ul>';
                $tweet .= '</li>';
            }
            $payload['html'] = $tweet;
            $payload['in_reply_to'] = 0;
        }
        if (!class_exists('Services_JSON')) {
            lib_include('json');
        }
        $json = new Services_JSON();
        $load = $json->encode($payload);
        $curl = curl_init("http://" . REALTIME_HOST . ":" . REALTIME_PORT);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 1);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'ADDMESSAGE ' . $chan . ' ' . addslashes($load));
        $output = curl_exec($curl);
    }
    if (!get_profile_id()) {
        return;
    }
    if (array_key_exists('target_id', $model->field_array)) {
        $e = $Entry->find($rec->attributes['target_id']);
        if ($e) {
            $notify_table = $e->resource;
            $recid = $e->record_id;
        }
    }
    $url = environment('ping_server');
    if (empty($url)) {
        return;
    }
    $url .= "=" . $request->url_for(array('resource' => $notify_table, 'action' => 'entry.html', 'id' => $recid));
    $curl = curl_init($url);
    $method = "GET";
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_HTTPGET, $method == "GET");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($curl);
}
Ejemplo n.º 3
0
</a>
			<?php 
        }
        ?>
			<br />
			</span>
			<br />
<?php 
        echo prologue_get_avatar($current_user_id, get_the_author_email(), 48);
        ?>
		<?php 
        the_author_posts_link();
        ?>
			<?php 
        global $the_post;
        echo laconica_time($the_post->created);
        echo in_reply_to($the_post);
        ?>
 |
			<?php 
        comments_popup_link(__('0'), __('1'), __('%'));
        ?>
			<?php 
        tags_with_count('', __('Tags:'), ', ', ' ');
        ?>
		</span>
	</h4>
	<div class="postcontent<?php 
        if (current_user_can('edit_post', get_the_id())) {
            ?>
 editarea<?php