HEX
Server: Apache
System: Linux c119.dattaweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: c1190199 (57165)
PHP: 7.4.33
Disabled: mail, system, shell, exec, system_exec, shell_exec, mysql_pconnect, passthru, popen, proc_open, proc_close, proc_nice, proc_terminate, proc_get_status, escapeshellarg, escapeshellcmd, eval, dl, imap_mail, libvirt_connect, gnupg_init, unsetenv, apache_setenv, pcntl_exec, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, opcache_get_status, opcache_reset, opcache_get_configuration
Upload Files
File: /home/c1190199/public_html/wp-content/themes/infocus/lib/functions/posts.php
<?php
/**
 * Popular and Related Posts Modules
 */
function webtreats_related_post() {
	global $post, $wpdb;
	$backup = $post;  // backup the current object
	$tags = wp_get_post_tags($post->ID);
	$tagIDs = array();
	if ($tags) {
	  $tagcount = count($tags);
	  for ($i = 0; $i < $tagcount; $i++) {
	    $tagIDs[$i] = $tags[$i]->term_id;
	  }
	  $args=array(
	    'tag__in' => $tagIDs,
	    'post__not_in' => array($post->ID),
	    'showposts'=>3,
	    'caller_get_posts'=>1
	  );
	  $my_query = new WP_Query($args);
	  if( $my_query->have_posts() ) { $related_post_found = true; ?>
		<h3>Related Posts</h3>
			<ul class="thumbnail_list">		
	    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
		<?php $post_id = get_the_ID(); ?> 
		<?php $meta_image = get_post_meta($post->ID, "post_image", true);
			  $get_year = get_the_time('Y', $post->ID); $get_month = get_the_time('m', $post->ID);
				if(!$meta_image){
					$meta_image = get_template_directory_uri() .'/images/empty_thumb.gif';
				}else{
					$meta_image = WEBTREATS_SCRIPTS_FOLDER .'/thumb.php?src=' .$meta_image. '&amp;w=60&amp;h=60&amp;zc=1&amp;q=100';
				}
				?>
				<li>
					<a class="alignleft" href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
					<span class="small_frame"><img src="<?php echo $meta_image; ?>" width="60" height="60" alt="<?php echo $post_title; ?>"/></span></a>
					<a class="thumbnail_title" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><br/>
					<a class="date" href="<?php echo get_month_link($get_year, $get_month); ?>"><?php the_time('F j, Y'); ?></a>
					<div class="clearboth"></div>
				</li>				
	    <?php endwhile; ?>
			</ul>		
	  <?php }
	}
	$post = $backup;  // copy it back
	//wp_reset_query(); // to use the original query again
	
	//show recent posts if no related found
	if(!$related_post_found){
		$posts = get_posts('numberposts=3&offset=0');
		if($posts){ ?>
		<h3>Recent Posts</h3>
		<ul class="thumbnail_list">
			<?php foreach($posts as $post){
					$post_title = stripslashes($post->post_title);
					$post_date = $post->post_date;
					$post_date = mysql2date('F j, Y', $post_date, false);
					$permalink = get_permalink($post->ID);
					$meta_image = get_post_meta($post->ID, "post_image", true);
					if(!$meta_image){
						$meta_image = get_template_directory_uri() .'/images/empty_thumb.gif';
					}else{
						$meta_image = WEBTREATS_SCRIPTS_FOLDER .'/thumb.php?src=' .$meta_image. '&amp;w=60&amp;h=60&amp;zc=1&amp;q=100';
					}
					?>			
			<li>
				<a class="alignleft" href="<?php echo $permalink; ?>" title="<?php echo $post_title; ?>">
				<span class="small_frame"><img src="<?php echo $meta_image; ?>" width="60" height="60" alt="<?php echo $post_title; ?>"/></span></a>
				<a class="thumbnail_title" href="<?php echo $permalink; ?>" rel="bookmark"><?php echo $post_title; ?></a><br/>
				<a class="date" href="#"><?php echo $post_date; ?></a>
				<div class="clearboth"></div>
			</li>
				<?php } ?>
		</ul>
			<?php }
	}
	wp_reset_query();
}

function webtreats_popular_post() {
	global $wpdb;
	$pop_posts = get_option('webtreats_popular_posts');
	if (empty($pop_posts) || $pop_posts < 1) $pop_posts = 3;
	$now = gmdate("Y-m-d H:i:s",time());
	$lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("m")-12,date("d"),date("Y")));
	$popularposts = "SELECT ID, post_title, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'stammy' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND post_date > '$lastmonth' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT ".$pop_posts;
	$posts = $wpdb->get_results($popularposts);
	$popular = '';
	if($posts){ ?>
		<h3>Popular Posts</h3>
			<ul class="thumbnail_list">
				
		<?php foreach($posts as $post){ 
				$post_title = stripslashes($post->post_title);
				$post_date = $post->post_date;
				$post_date = mysql2date('F j, Y', $post_date, false);
				$permalink = get_permalink($post->ID);
				$meta_image = get_post_meta($post->ID, "post_image", true);
				$get_year = get_the_time('Y', $post->ID); $get_month = get_the_time('m', $post->ID);
					if(!$meta_image){
						$meta_image = get_template_directory_uri() .'/images/empty_thumb.gif';
					}else{
						$meta_image = WEBTREATS_SCRIPTS_FOLDER .'/thumb.php?src=' .$meta_image. '&amp;w=60&amp;h=60&amp;zc=1&amp;q=100';
					}
					?>
					<li>
						<a class="alignleft" href="<?php echo $permalink; ?>" title="<?php echo $post_title; ?>">
						<span class="small_frame"><img src="<?php echo $meta_image; ?>" width="60" height="60" alt="<?php echo $post_title; ?>"/></span></a>
						<a class="thumbnail_title" href="<?php echo $permalink; ?>" rel="bookmark"><?php echo $post_title; ?></a><br/>
						<a class="date" href="<?php echo get_month_link($get_year, $get_month); ?>"><?php echo $post_date; ?></a>
						<div class="clearboth"></div>
					</li>
		<?php } ?>
		</ul>
	<?php }		
}

function webtreats_author_info() { ?>
<div class="gradient_box_middle" id="about_the_author">
	<div class="gradient_box_top">
		<div class="gradient_box_bottom">
			<span class="sprite"></span>
			<?php echo get_avatar( get_the_author_email(), '80' ); ?>
			<p class="padding"><strong><?php the_author_link(); ?> - </strong><?php the_author_description(); ?></p>
			<div class="clearboth"></div>	
		</div>	
	</div>	
</div>	
<?php 
}
?>