4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Plugins => Topic started by: thunderstrike on September 10, 2007, 01:27:21 AM
-
Detail: This show image hits in one page in ACP - > plugins.
// Step 1
In admin/plugins, create file: image_visits.php .
Add:
<?php // PLUGIN_TITLE: Image visits
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: image_visits.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.4 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) fweitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
require(ROOT_PATH.'admin/admin_global.php');
show_admin_header();
if ($action == "") {
$action = "show_image_visits";
}
if ($action == "show_image_visits") {
$additional_sql = "";
if (isset($additional_image_fields) && is_array($additional_image_fields) && !empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", " . $key;
}
}
$sql = "
SELECT image_id, image_name, image_date, image_hits" . $additional_sql . "
FROM " . IMAGES_TABLE . "
WHERE image_active = 1 AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
ORDER BY image_date, image_hits DESC
";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
?>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" class="tableheader" /><?php echo $lang['image_hits_stats']; ?></td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
</table>
<?php
if (isset($num_rows) && $num_rows <= 0) {
?>
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="tablebottom" />
<tr>
<td width="100%" align="center" class="tablerow" /><br /><?php echo $lang['image_hits_no_content']; ?></td>
</tr>
</table>
<?php
} elseif (isset($num_rows) && $num_rows > 0) {
$sql1 = "SELECT COUNT(image_id) AS total_hits FROM " . IMAGES_TABLE . " WHERE image_active = 1 AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))";
$row = $site_db->query_firstrow($sql1);
$total_hits = (isset($row['total_hits'])) ? $row['total_hits'] : 0;
?>
<table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />
<tr>
<td width="100%" align="center" class="tablerow" /><br /><?php echo $lang['image_hits_description']; ?> (Total: <b><?php echo $total_hits; ?></b>).<br /><br /></td>
</tr>
</table>
<table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />
<tr>
<td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_image_name']; ?></td>
<td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_added_on']; ?></td>
<td width="33%" align="center" class="tableheader" /><?php echo $lang['image_hits_title']; ?></td>
</tr>
<?php
while ($stats_row = $site_db->fetch_array($result)) {
$image_id = $stats_row['image_id'];
$image_name = format_text(stripslashes($stats_row['image_name']), 2);
$image_date = format_date($config['date_format'] . " " . $config['format_time'], $stats_row['image_date']);
$image_hits = $stats_row['image_hits'];
?>
<tr>
<td width="33%" align="center" class="tablerow" /><a href="<?php echo $site_sess->url(ROOT_PATH . "details.php?image_id=" . $image_id); ?>" class="link" target="_blank" /><?php echo $image_name; ?></a>
<td width="33%" align="center" class="tablerow" /><?php echo $image_date; ?></td>
<td width="33%" align="center" class="tablerow" /><?php echo $image_hits; ?></td>
</tr>
<?php
}
}
?>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" class="tablerow" /> </td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" class="tableheader" /> </td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" class="tablerow" /><br /><span class="smalltext">Created by <a href="http://www.4homepages.de/forum/index.php?action=profile;u=20285" class="link" target="_blank" />Thunderstrike</a> . 2007-2008</span><br />
<span class="smalltext"><a href="http://www.4homepages.de/forum/index.php?topic=18685" class="link" target="_blank" />Support topic</a> .</span><br />
<br /></td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" align="center" class="tableheader" /> </td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
show_admin_footer();
?>
// Step 2
In lang/english/admin.php file,
find:
$lang['resizing_image_error'] = "Error converting image file!";
add after:
//-----------------------------------------------------
//--- Images hits stats -------------------------------
//-----------------------------------------------------
$lang['image_hits_stats'] = "Image hits stats";
$lang['image_hits_description'] = "Check for image hits for each images";
$lang['image_hits_no_content'] = "No content";
$lang['image_hits_image_name'] = "Image name";
$lang['image_hits_added_on'] = "Added on";
$lang['image_hits_title'] = "Image hits";
-
... nice plugin ... and a very long list ... ;)
... but the the image date / added on works not correctly ...
... and please change the file name in the code ...
-
... but the the image date / added on works not correctly ...
Is this line, I know. :(
$image_date = format_date($config['date_format'], $config['format_time'], $stats_row['image_date']);
... and please change the file name in the code ...
Image visits is good.
-
I think I find for image_date ... I edit 1st post ...
-
well, its order by what ??
its works :P need to make it order by number of hits
-
Is there ...
ORDER BY image_date, image_hits DESC
-
yes find it :P
now works better for me :P
ORDER BY image_hits ,image_date DESC
-
... and please change the file name in the code ...
... it is not File: batch_import.php ...
... it is File: image_visits.php ...
-
Ohhh ! ok - thank - post edit. ;)
-
Hello,
it is possible to add like on "[ACP - PLUGIN] - Cat hits all in 1" Step 3 a "IMAGE_HITS_PERPAGE_ACTIVATION"?
If so, but how?
Thanks
btw: great plugin