Created
September 28, 2011 02:37
-
-
Save dodyw/1246850 to your computer and use it in GitHub Desktop.
dir_stat widget update, fix link count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function w_dir_stat($option) { | |
global $lep; | |
$param = etc_read_option($option); | |
$query = "select count(res_id) as count from lep_resource where status = 1 and suspended = 0"; | |
$active_links = $lep->db->GetOne($query); | |
$query = "select count(res_id) as count from lep_resource where status = 0"; | |
$pending_links = $lep->db->GetOne($query); | |
$last_24h = strtotime("-1 day"); | |
$query = "select count(res_id) as count from lep_resource where created_at > '{$last_24h}'"; | |
$last_24h_links = $lep->db->GetOne($query); | |
$query = "select count(category_id) as count from lep_category where status = 1"; | |
$categories = $lep->db->GetOne($query); | |
ob_start(); | |
?> | |
<div class="sidebar_box"> | |
<?php if ($param['show_title']) : ?> | |
<h3><?php print _t($param['title']); ?></h3> | |
<?php endif; ?> | |
<ul> | |
<li>Links: <?php print $active_links; ?></li> | |
<li>Pending: <?php print $pending_links; ?></li> | |
<li>New submission in 24h: <?php print $last_24h_links; ?></li> | |
<li>Categories: <?php print $categories; ?></li> | |
</ul> | |
</div> | |
<?php | |
$html = ob_get_contents(); | |
ob_end_clean(); | |
return $html; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment