• [ACP - PLUGIN] - Image hits all in 1 3 0 5 1
Currently:  

Author Topic: [ACP - PLUGIN] - Image hits all in 1  (Read 29026 times)

0 Members and 2 Guests are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
[ACP - PLUGIN] - Image hits all in 1
« 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:

Code: [Select]
<?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" />&nbsp;</td>
    </tr>
    </table>
    <table border="0" width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td width="100%" align="center" class="tableheader" />&nbsp;</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" />&nbsp;</td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <?php              


show_admin_footer(); 
?>


// Step 2

In lang/english/admin.php file,

find:

Quote
$lang['resizing_image_error'] = "Error converting image file!";

add after:

Code: [Select]
//-----------------------------------------------------
//--- 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";
« Last Edit: September 10, 2007, 01:57:16 PM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #1 on: September 10, 2007, 11:20:48 AM »
... 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 ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #2 on: September 10, 2007, 12:24:06 PM »
Quote
... but the the image date / added on works not correctly ...

Is this line, I know. :(

Quote
$image_date = format_date($config['date_format'], $config['format_time'], $stats_row['image_date']);

Quote
... and please change the file name in the code ...

Image visits is good.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #3 on: September 10, 2007, 01:25:50 PM »
I think I find for image_date ... I edit 1st post ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #4 on: September 10, 2007, 01:26:24 PM »
well, its order by what ??

its works :P need to make it order by number of hits
English Please :@

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #5 on: September 10, 2007, 01:30:32 PM »
Is there ...

Quote
ORDER BY image_date, image_hits DESC
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #6 on: September 10, 2007, 01:43:41 PM »
yes find it :P

now works better for me :P

Quote
ORDER BY  image_hits ,image_date DESC
English Please :@

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #7 on: September 10, 2007, 01:54:42 PM »
... and please change the file name in the code ...

... it is not File: batch_import.php ...
... it is File: image_visits.php ...                           
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #8 on: September 10, 2007, 01:57:30 PM »
Ohhh ! ok - thank - post edit. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: [ACP - PLUGIN] - Image hits all in 1
« Reply #9 on: July 22, 2009, 09:31:55 AM »
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