4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Plugins => Topic started by: thunderstrike on September 10, 2007, 02:28:29 AM

Title: [ACP - PLUGIN] - Cat hits all in 1
Post by: thunderstrike on September 10, 2007, 02:28:29 AM
Detail: This show cat hits in one page in ACP - > plugins - v2.0.

[02-28-2008] - Update

- Admin paging add.
- Add this: http://www.4homepages.de/forum/index.php?topic=6926.msg112721#msg112721
- Add define constant (step 3).

[02-28-2008] - End Update

// Step 1

In admin/plugins, create file: cat_visits.php .

Add:

Code: [Select]
<?php // PLUGIN_TITLE: Category visits
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: cat_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_cat_visits";
}

if (
$action == "show_cat_visits") {
    
    
$sql1 "
    
    SELECT COUNT(cat_id) AS total_hits
    FROM " 
CATEGORIES_TABLE 
    WHERE (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;
    
    
$condition "";
    
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
    
    include(
ROOT_PATH.'admin/includes/admin_paging.php');
    
$cat_hits_perpage = (defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) ? intval(trim(CAT_HITS_SET_PERPAGE)) : 0;
    
$link_arg $site_sess->url("cat_visits.php?action=show_cat_visits");

    
$text str_replace(array("{total_cat_images}"), array($total_hits), $lang['cat_hits_description']);

    
$getpaging = new Paging($page$cat_hits_perpage$total_hits$link_arg$text''''''''false);
    
$offset = (defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) ? $getpaging->get_offset() : "";
        
    
$paging_split_valid false;
    
$paging_stats_valid false;    
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
        
$paging_split_valid true;        
    }
        
    if (
defined('CAT_HITS_PERPAGE_ACTIVATION') && CAT_HITS_PERPAGE_ACTIVATION == && defined('CAT_HITS_SET_PERPAGE') && CAT_HITS_SET_PERPAGE 0) {
        
$paging_stats_valid true;                
    }
    
    
$condition "LIMIT ".$offset.", ".$cat_hits_perpage;
    }
    
    
$sql "
    
    SELECT cat_id, cat_name, cat_hits
    FROM " 
CATEGORIES_TABLE "
    WHERE (cat_id NOT IN ("
.get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))    
    ORDER BY cat_hits DESC
    " 
$condition;
    
    unset (
$condition);
    
    
$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['cat_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['cat_hits_no_content']; ?></td>
        </tr>
        </table>
        <?php          
    
} elseif (isset($num_rows) && $num_rows 0) {
        
        
?>

        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="100%" align="center" class="tablerow" /><br /><?php echo (($paging_stats_valid) ? $getpaging->get_paging_stats() : (($total_hits 0) ? str_replace(array("{total_cat_images}"), array($total_hits), $lang['cat_hits_description']) : $lang['cat_hits_no_content'])); ?><br /><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="100%" align="right" class="tablerow" /><br /><?php echo (($paging_split_valid) ? $getpaging->get_paging() : ""); ?><br /></td>
        </tr>
        </table>
        <table border="0" width="100%" cellpadding="1" cellspacing="1" class="tablebottom" />   
        <tr>
        <td width="50%" align="center" class="tableheader" /><?php echo $lang['cat_hits_cat_name']; ?></td>       
        <td width="50%" align="center" class="tableheader" /><?php echo $lang['cat_hits_title']; ?></td>
        </tr>
        <?php
        
while ($stats_row $site_db->fetch_array($result)) {
            
$cat_id $stats_row['cat_id'];
            
$cat_name format_text(trim($stats_row['cat_name']), 2);            
            
$cat_hits $stats_row['cat_hits'];
        
?>

        <tr>
        <td width="50%" align="center" class="tablerow" /><a href="<?php echo $site_sess->url(ROOT_PATH "categories.php?cat_id=" $cat_id); ?>" class="link" target="_blank" /><?php echo $cat_name?></a>       
        <td width="50%" align="center" class="tablerow" /><?php echo $cat_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=18686" 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]
//-----------------------------------------------------
//--- Categories hits stats ---------------------------
//-----------------------------------------------------
$lang['cat_hits_stats'] = "Category hits stats";
$lang['cat_hits_description'] = "Check for cat hits for each categories: {total_cat_images} cats.";
$lang['cat_hits_no_content'] = "No content";
$lang['cat_hits_cat_name'] = "Category name";
$lang['cat_hits_title'] = "Category hits";

// Step 3

In includes/constants.php file,

add in top ?>:

Code: [Select]
// Cat hits plugin.
define('CAT_HITS_PERPAGE_ACTIVATION', 1); // 1 for active. 0 for disable.
define('CAT_HITS_SET_PERPAGE', 10); // Add result per page.
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: mawenzi on September 10, 2007, 11:09:54 AM
... nice plugin ...
... but please change the file name of this plugin in the code ... ;)
... and the file name : cat_visits.php ...
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: thunderstrike on September 10, 2007, 12:26:13 PM
Quote
... and the file name : cat_visits.php ...

Done. ;)

Quote
... but please change the file name of this plugin in the code ...

Is good like this ... why change ?  :|
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: Mr_LovaLove on September 10, 2007, 01:19:06 PM
Nice :D

it works fine with 1.7.4

can see all cats with number of hits

thanks for this Plugin
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: mawenzi on September 10, 2007, 02:11:21 PM
... but please change the file name of this plugin in the code ...
... ok, you change it ...
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: egyptsons on October 15, 2007, 04:47:23 AM
Thanks works fine :)
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: XFuzon on February 28, 2008, 06:57:08 PM
Thanks!  :D
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: thunderstrike on February 29, 2008, 05:18:02 AM
For good reply in topic, I create v2.0 . Read update date and do again step 1, 2 and I add step 3. ;)
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: Jan-Lukas on July 02, 2008, 08:10:00 PM
Klappt SUPER in der 1.7.6  8)

 :flag-de: Hier die Deutsche Sprachdatei (Danke an Nobby)

Code: [Select]
//-----------------------------------------------------
//--- Categories hits stats ---------------------------
//-----------------------------------------------------
$lang['cat_hits_stats'] = "Kategorie Zugriffsstatistik";
$lang['cat_hits_description'] = "Zeige Anzahl der Zugriff pro Kategorie: {total_cat_images} Kategorien.";
$lang['cat_hits_no_content'] = "kein Inhalt";
$lang['cat_hits_cat_name'] = "Kategorie Name";
$lang['cat_hits_title'] = "Kategorie Zugriffe";
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: AntiNSA2 on March 01, 2009, 12:28:55 PM
Hi!
I have installed the paging mod, and I recieve this error with 1.7.6

Warning: include(./../../admin/includes/admin_paging.php) [function.include]: failed to open stream: No such file or directory in /home/lifephotography/htdocs/admin/plugins/cat_visits.php on line 53

Warning: include() [function.include]: Failed opening './../../admin/includes/admin_paging.php' for inclusion (include_path='.:/usr/local/share/pear') in /home/lifephotography/htdocs/admin/plugins/cat_visits.php on line 53

Fatal error: Class 'Paging' not found in /home/lifephotography/htdocs/admin/plugins/cat_visits.php on line 59


??

Thanks for your help-
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: V@no on March 02, 2009, 03:41:28 PM
[02-28-2008] - Update

- Admin paging add.
- Add this: http://www.4homepages.de/forum/index.php?topic=6926.msg112721#msg112721
- Add define constant (step 3).
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: thorstenp on March 02, 2009, 07:05:05 PM
Hallo zusammen

gibt es davon eine Demo ?

Gruss Thorsten
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: mawenzi on March 02, 2009, 07:17:28 PM
@ thorstenp

... Installationsaufwand ca. 5min ...
... dann hast du eine Demo in deinem ACP ...
... bei Nichtgefallen die cat_visits.php einfach wieder löschen und alles ist Geschichte ...
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: AntiNSA2 on March 03, 2009, 05:26:19 AM
V@no... is this the same problem as the other two mods with the path? Why am i the only 4images guy having this problem, is it because I am using 1.7.6?
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: V@no on March 03, 2009, 07:38:55 AM
If you are referring to the plugins you had problem with recently, then no, this is not the same, this case is your fault not following the instructions precisely ;)
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: AntiNSA2 on March 03, 2009, 08:21:27 AM
yes... you are absolutely correct... I will bang head against wall now.
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: Hagen-Roderich on July 09, 2009, 03:43:59 PM
Hallo,
ich habe den MOD installiert, läuft soweit. Leider wird mir im ACP oberhalb der Auswertung folgende Fehlermeldung angezeigt:

Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/47852/"domain"/media/admin/plugins/cat_visits.php:1) in /is/htdocs/47852/"domain"/media/admin/admin_functions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/47852/"domain"/media/admin/plugins/cat_visits.php:1) in /is/htdocs/47852/"domain"/media/admin/admin_functions.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/47852/"domain"/media/admin/plugins/cat_visits.php:1) in /is/htdocs/47852/"domain"/media/admin/admin_functions.php on line 170

Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/47852/"domain"/media/admin/plugins/cat_visits.php:1) in /is/htdocs/47852/"domain"/media/admin/admin_functions.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/47852/"domain"/media/admin/plugins/cat_visits.php:1) in /is/htdocs/47852/"domain"/media/admin/admin_functions.php on line 172



Ich habe die Lösung 1 aus http://www.4homepages.de/forum/index.php?topic=3378.0 probiert - hat nix gebracht.

8 steps need when ask question -

- PHP version (ACP - > phpinfo())       - 4.4.7
- mySQL version (ACP - > phpinfo())   - Client API version 5.0.32
- 4images version                             - 1.7.6
- Post screenshot / URL                    - nein
- Post code in BB Code (no need full file for code) or post attach file  - nein
- It doesn't work. What is say - what is do for no work                     - MOD funktioniert, Fehlermeldung stört die Ansicht
- Install MOD ? If so - please say (troubleshooting)                           - http://www.4homepages.de/forum/index.php?topic=3303.0 / http://www.4homepages.de/forum/index.php?topic=6760.0
- Read FAQ ? Install Bug fixes ?                  - nur ein Teil der FAQ gelesen  :oops:

Was kann ich noch tun (außer PHP zulernen)?
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: V@no on July 09, 2009, 05:17:48 PM
Hello and welcome to 4images forum.

This might be helpful: UNICODE / UTF8 / UTF16 related (http://www.4homepages.de/forum/index.php?topic=25252.0)
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: Hagen-Roderich on July 10, 2009, 08:42:05 AM
Hello and welcome to 4images forum.

This might be helpful: UNICODE / UTF8 / UTF16 related (http://www.4homepages.de/forum/index.php?topic=25252.0)

Thank you.
I have safed the "cat_visits.php" with Notepad++ (before i was useing AlphaCode Studio http://www.mirage228.net/load.php?get=project.php&pid=1) and the error has gone.
Only  " " stand still in the first line. (It´s not a bug it´s feature)

Btw:
It is possible to exclude some named categories?
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: tennis-ecards on November 27, 2011, 01:32:02 PM
Ich habe dasselbe Problem wie AntiNSA2.
Ich habe erst [MOD] Universal Paging Class v1.1.2 installiert und dann die Schritte wie hier beschrieben ausgeführt.
Liegt es daran, dass ich nichts mit dem ersten Punkt "Admin paging add." anfangen kann? Was soll das heißen?

Danke und Gruß
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: Rembrandt on November 27, 2011, 01:39:10 PM
....Liegt es daran, dass ich nichts mit dem ersten Punkt "Admin paging add." anfangen kann? Was soll das heißen?
..
du mußt den anderen mod auch noch installieren.
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: tennis-ecards on November 27, 2011, 02:25:03 PM
habs gefunden. super, funktioniert gut.

a) wie müsste man das für cat_downolads machen, also für kategorien geordnet nach downloads?

b)eigentlich habe ich genau das gesucht, nur eben nicht für den admin-bereich sondern frei zugänglich für alle User.
kann man cat_visits.php ändern, so dass es nicht für den admin bereich ist?
Title: Re: [ACP - PLUGIN] - Cat hits all in 1
Post by: tennis-ecards on January 11, 2012, 07:35:22 PM
hat keiner eine Idee?

habs gefunden. super, funktioniert gut.

a) wie müsste man das für cat_downolads machen, also für kategorien geordnet nach downloads?

b)eigentlich habe ich genau das gesucht, nur eben nicht für den admin-bereich sondern frei zugänglich für alle User.
kann man cat_visits.php ändern, so dass es nicht für den admin bereich ist?