HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //opt/Newsmag/last_comments.php
<?php
/*
Template Name: Last comments
*/

// id del calciomercato
$ids = array();
$sql = "(select id from wp_posts where post_status = 'publish' and id in (select object_id from wp_term_relationships where term_taxonomy_id = 24));";
$records = $wpdb->get_results($sql);
foreach ( $records as $record )  {
        $ids[] = $record->id;
}

$wpsmilies = array(
    ':smile:' => array('file'=>'smile.png', 'title'=> 'smile'),
    ':grin:' => array('file'=>'grin.png', 'title'=> 'grin'),
    ':wink:' => array('file'=>'wink.png', 'title'=> 'wink'),
    ':mrgreen:' => array('file'=>'mrgreen.png', 'title'=> 'mrgreen'),
    ':neutral:' => array('file'=>'neutral.png', 'title'=> 'neutral'),
    ':twisted:' => array('file'=>'twisted.png', 'title'=> 'twisted'),
    ':arrow:' => array('file'=>'arrow.png', 'title'=> 'arrow'),
    ':shock:' => array('file'=>'shock.png', 'title'=> 'shock'),
    ':???:' => array('file'=>'unamused.png', 'title'=> 'unamused'),
    ':cool:' => array('file'=>'cool.png', 'title'=> 'cool'),
    ':evil:' => array('file'=>'evil.png', 'title'=> 'evil'),
    ':oops:' => array('file'=>'oops.png', 'title'=> 'oops'),
    ':razz:' => array('file'=>'razz.png', 'title'=> 'razz'),
    ':roll:' => array('file'=>'roll.png', 'title'=> 'roll'),
    ':cry:' => array('file'=>'cry.png', 'title'=> 'cry'),
    ':eek:' => array('file'=>'eek.png', 'title'=> 'eek'),
    ':lol:' => array('file'=>'lol.png', 'title'=> 'lol'),
    ':mad:' => array('file'=>'mad.png', 'title'=> 'mad'),
    ':sad:' => array('file'=>'sad.png', 'title'=> 'sad'),
    ':!:' => array('file'=>'exclamation.png', 'title'=> 'exclamation'),
    ':?:' => array('file'=>'question.png', 'title'=> 'question'),
    ':idea:' => array('file'=>'idea.png', 'title'=> 'idea'),
    ':hmm:' => array('file'=>'hmm.png', 'title'=> 'hmm'),
    ':beg:' => array('file'=>'beg.png', 'title'=> 'beg'),
    ':whew:' => array('file'=>'whew.png', 'title'=> 'whew'),
    ':chuckle:' => array('file'=>'chuckle.png', 'title'=> 'chuckle'),
    ':silly:' => array('file'=>'silly.png', 'title'=> 'silly'),
    ':envy:' => array('file'=>'envy.png', 'title'=> 'envy'),
    ':shutmouth:' => array('file'=>'shutmouth.png', 'title'=> 'shutmouth'),
    ':boxe:' => array('file'=>'boxe.gif', 'title'=> 'boxe'),
    ':laughing:' => array('file'=>'laughing.gif', 'title'=> 'laughing'),
    ':clap:' => array('file'=>'clap.gif', 'title'=> 'clap'),
    ':chiac:' => array('file'=>'chiac.gif', 'title'=> 'chiac'),
    ':giulemani:' => array('file'=>'giulemani.gif', 'title'=> 'giulemani'),
    ':piango:' => array('file'=>'piango.gif', 'title'=> 'piango'),
    ':glenn:' => array('file'=>'glenn.gif', 'title'=> 'glenn'),
    ':canna:' => array('file'=>'canna.gif', 'title'=> 'canna'),
    ':vomito:' => array('file'=>'vomito.gif', 'title'=> 'vomito'),
    ':dubbio:' => array('file'=>'dubbio.gif', 'title'=> 'dubbio'),
    ':chielpo:' => array('file'=>'chielpo.gif', 'title'=> 'chielpo'),
    ':championsleague:' => array('file'=>'championsleague.gif', 'title'=> 'championsleague'),
    ':brinda2:' => array('file'=>'brinda2.gif', 'title'=> 'brinda2'),
    ':brao:' => array('file'=>'brao.gif', 'title'=> 'brao'),
    ':boing:' => array('file'=>'boing.gif', 'title'=> 'boing'),
    ':bg_02:' => array('file'=>'bg_02.gif', 'title'=> 'bg_02'),
    ':bg_01:' => array('file'=>'bg_01.gif', 'title'=> 'bg_01'),
    ':bergamoto:' => array('file'=>'bergamoto.gif', 'title'=> 'bergamoto'),
    ':angry:' => array('file'=>'angry.gif', 'title'=> 'angry'),
    ':aggravaold2:' => array('file'=>'aggravaold2.gif', 'title'=> 'aggravaold2'),
    ':abbasso:' => array('file'=>'abbasso.gif', 'title'=> 'abbasso'),
    ':ador:' => array('file'=>'ador.gif', 'title'=> 'ador'),
    ':aereo:' => array('file'=>'aereo.gif', 'title'=> 'aereo'),
    ':sanraimondo:' => array('file'=>'sanraimondo.gif', 'title'=> 'sanraimondo'),
    ':yahoo:' => array('file'=>'yahoo.gif', 'title'=> 'yahoo'),
    ':tone:' => array('file'=>'tone.gif', 'title'=> 'tone'),
    ':sveglia:' => array('file'=>'sveglia.gif', 'title'=> 'sveglia'),
    ':wassat:' => array('file'=>'wassat.gif', 'title'=> 'wassat'),
    ':tafazzi:' => array('file'=>'tafazzi.gif', 'title'=> 'tafazzi'),
    ':mino:' => array('file'=>'mino.gif', 'title'=> 'mino'),
    ':scettico:' => array('file'=>'scettico.gif', 'title'=> 'scettico'),
    ':coppa:' => array('file'=>'coppa.gif', 'title'=> 'coppa'),
    ':mondo:' => array('file'=>'mondo.gif', 'title'=> 'mondo'),
    ':tank:' => array('file'=>'tank.gif', 'title'=> 'tank'),
    ':papudance:' => array('file'=>'papudance.gif', 'title'=> 'papudance'),
    ':gasp3:' => array('file'=>'gasp3.gif', 'title'=> 'gasp3'),
    ':wait:' => array('file'=>'wait.gif', 'title'=> 'wait'),
    ':gasp2:' => array('file'=>'gasp2.gif', 'title'=> 'gasp2'),
    ':saluta:' => array('file'=>'saluta.gif', 'title'=> 'saluta'),
    ':nosento:' => array('file'=>'nosento.gif', 'title'=> 'nosento'),
    ':ipno:' => array('file'=>'ipno.gif', 'title'=> 'ipno'),
    ':goal:' => array('file'=>'goal.gif', 'title'=> 'goal'),
    ':sad:' => array('file'=>'sad.gif', 'title'=> 'sad'),
    ':ride_molto:' => array('file'=>'ride_molto.gif', 'title'=> 'ride_molto'),
    ':reja:' => array('file'=>'reja.gif', 'title'=> 'reja'),
    ':zzzz:' => array('file'=>'zzzz.gif', 'title'=> 'zzzz'),
    ':wink:' => array('file'=>'wink.gif', 'title'=> 'wink'),
    ':prega:' => array('file'=>'prega.gif', 'title'=> 'prega'),
    ':freddo:' => array('file'=>'freddo.gif', 'title'=> 'freddo'),
    ':paura:' => array('file'=>'paura.gif', 'title'=> 'paura'),
    ':fear:' => array('file'=>'fear.gif', 'title'=> 'fear'),
    ':papudance4:' => array('file'=>'papudance4.gif', 'title'=> 'papudance4'),
    ':uff:' => array('file'=>'uff.gif', 'title'=> 'uff'),
    ':oks:' => array('file'=>'oks.gif', 'title'=> 'oks'),
    ':crying:' => array('file'=>'crying.gif', 'title'=> 'crying'),
    ':muto:' => array('file'=>'muto.gif', 'title'=> 'muto'),
    ':sedia:' => array('file'=>'sedia.gif', 'title'=> 'sedia'),
    ':dea02:' => array('file'=>'dea02.gif', 'title'=> 'dea02'),
    ':dealogo:' => array('file'=>'dealogo.gif', 'title'=> 'v'),
    ':dea:' => array('file'=>'dea.gif', 'title'=> 'dea'),
    ':nocolpa:' => array('file'=>'nocolpa.gif', 'title'=> 'nocolpa'),
    ':noguardo:' => array('file'=>'noguardo.gif', 'title'=> 'noguardo'),
    ':suni:' => array('file'=>'suni.gif', 'title'=> 'suni'),
    ':smile:' => array('file'=>'smile.gif', 'title'=> 'smile'),
    ':nonso:' => array('file'=>'nonso.gif', 'title'=> 'nonso'),
    ':denis:' => array('file'=>'denis.gif', 'title'=> 'denis'),
    ':testata:' => array('file'=>'testata.gif', 'title'=> 'testata'),
    ':nox:' => array('file'=>'nox.gif', 'title'=> 'nox'),
    ':eh:' => array('file'=>'eh.gif', 'title'=> 'eh'),
);

function getFullComment($wpsmilies, $content) {
	foreach ($wpsmilies as $key => $value) {
		$img = '<img style="display:inline-block" src="/wp-content/plugins/wpdiscuz-emoticons/emoticons/img/' . $value['file'] . '">';
		$content = str_replace($key, $img, $content);
	}
	return $content;
}

function getImageFromText($html) {
        preg_match_all('/<img[^>]+>/i',$html, $result);

        //print_r($result);
        $img = array();
        foreach( $result as $img_tag) {
                preg_match_all('/(src)=("[^"]*")/i',$img_tag[0], $im);
        }
        return $im[2][0];
}
?>
<?php get_header(); ?>
<div class="td-main-content-wrap">
        <div class="td-container">
                <div class="td-container-border">
                        <div class="td-pb-row">
                                <div class="td-pb-span12 td-main-content">
						<div class="post_day mbf clearfix">
							<div class="title_bu">
								<a href="<?= the_permalink(); ?>">
									<h4> Ultimi commenti. </h4>
								</a>
							</div>
                                                        <div class="grid_12 omega">
							Attenzione, se si clicca sul titolo dell'articolo si va al post originario, se si clicca sul commento si accede direttamente alla sezione commenti.
							<br><br>
							</div>
							<div class="grid_12 omega">
								<div style="margin-left:10px; margin-right:10px;">
<?php           
$totalComments = 100;                                                
$args = array(
    'orderby' => 'comment_date',
    'order' => 'DESC',
    'post__not_in' => $ids,
    'number' => $totalComments,
    'status' => 'approve', //Change this to the type of comments to be displayed
    'offset' => $offset
);

$comments = get_comments($args);
foreach($comments as $comment) :
	$args = array(
    	'p' => $comment->comment_post_ID
    );
    $the_query = new WP_Query($args);
    $the_query->the_post();

    $avatar =  $wpdb->get_var( "select concat('/wp-content/uploads/avatar/',user_id,'/',avatar) from wp_plugin_atalantini_avatar where user_id in (select ID from wp_users where user_id = '" . $comment->user_id . "')");

?>

<div  class="vc_row">
	<div style="float:left; ">
<img src="<?= get_avatar_url($comment->user_id); ?>" style="float:left; height:64px; max-width:100px;"  height="64">
	</div>
        <div style="float:right; ;margin-left:20px;">
        <a href="<?= the_permalink(); ?>#comment-<?= $comment->comment_ID ?>" style="float:right; font-size:20px; font-weight:bold;">&nbsp;&nbsp;<?= $comment->comment_author ?></a>
        <br><div style="float:right"><b>
        <a href="<?= the_permalink(); ?>#comment-<?= $comment->comment_ID ?>" class="comment_text">
                Identificativo IP: <?= $comment->comment_author_IP ?>
        </a>
        </b>
        </div>

	</div>
</div>
<div class="clearfix"></div>
<div  class="vc_row">
	<div>
<blockquote style="border:1px solid #000;background-color:#f4f4f4; margin-left:0px; margin-right:0px;;">
       <b><a href="<?= the_permalink(); ?>#comment_<?= $comment->comment_ID ?>" class="comment_text">Ha scritto in riferimento a: "<?= strip_tags(the_title()); ?>" il giorno <?= comment_date( 'd-m-Y H:i:s', $comment->comment_ID ); ?></a></b>
        </blockquote>
	<a href="<?= the_permalink(); ?>#comment-<?= $comment->comment_ID ?>"><?= getFullComment($wpsmilies, $comment->comment_content) ?></a>
	</div>
</div>
<div class="clearfix"></div>
<hr>
<br>
<?php
endforeach;
?>                         
</div>
</div>
</div>
</div>
</div>

<?php get_footer(); ?>