4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on June 04, 2003, 08:49:17 AM

Title: [MOD] Search Statistics v1.2
Post by: V@no on June 04, 2003, 08:49:17 AM
This MOD was originaly created by www.girls-on-bikes.com ( http://4homepages.de/forum/viewforum.php?f=11 )
I just adopted it as a "public" MOD
[MOD] Search Statistics v1.5 | Works with 1.7.2 - 1.7.4 (http://www.4homepages.de/forum/index.php?topic=6033.msg95419#msg95419) thanks to ivan

------ Overview -----------
This MOD will log all searched words and phrases and count each unique word/phrase. When searched with just one word, it will be logged/count as "word" and when searched with two or more words it will be logged and count as a "phrase" and will not log/count each separate word from that phrase.

------ News ----------------
v1.2.
- Added count of who was searching word/phrase (guest, user or admin) (edit search_stats.php and set $show_more to 1 or 0)
- Date display now can be anabled/disabled (edit search_stats.php and set $show_date to 1 or 0)
v1.1.
- Added log last search date of word/phrase


All neccessery files and instruction u can find in this file:
http://gallery.vano.org/file30dl (see attachment below)

demo:
http://gallery.vano.org/search
(there is a link "Search Statistics" at the left-bottom)
Title: [MOD] Search Statistics v1.2
Post by: www.girls-on-bikes.com on June 04, 2003, 09:38:13 PM
Awesome, thanks V@no!
I'm glad to see somebody could take the idea and turn it into a real mod.
I'll have to try out the "official" version when I get home.
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 04, 2003, 10:48:03 PM
Thx xwall for finding an error in the code, I have fixed at my site, but forgot update the installation guide...
if u already have installed this MOD, find in /search.php:
Code: [Select]
if (count($split_words) < 1) {and replace with:
Code: [Select]
if (count($split_words) == 1) {
Title: [MOD] Search Statistics v1.2
Post by: bernd on June 04, 2003, 10:58:23 PM
great Mod - I'll work a little on it and will repost it as an admin plugin as for our purpose we rather not make it accessible for the users.

Thanks again - I'm sort of struggeling with getting all your mods into my installation ;)
You deliver faster than I can install 'em ...

cheers,
Bernd
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 04, 2003, 11:02:03 PM
Quote from: bernd
great Mod - I'll work a little on it and will repost it as an admin plugin as for our purpose we rather not make it accessible for the users.

yes, good idea! I think this should be done in the first place...
also, since u dont want show it to the public, then u might want make it to log all words, because right now it will log words that are not in the "bad" list (the ones, that u can set in 4images settings)
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 06, 2003, 12:50:43 PM
I just updated this mod. Now it uses only one table in the database, that means only one query needed to pull out data. Also, added date log when word/phrase was searched last time.
You'll need do again all steps and manualy delete 4images_search_words and 4images_search_phrases tables
Title: [MOD] Search Statistics v1.2
Post by: Xwall on June 07, 2003, 05:32:37 PM
Who makes the search Guest? user? admin?  :wink:

Is it possible knowledge it?  8)

Great MOD.
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 07, 2003, 08:42:56 PM
Quote from: Xwall
Who makes the search Guest? user? admin?  :wink:

Is it possible knowledge it?  8)

Great MOD.

done :D
redownload the package, read upgrade instructions at the bottom of the intallation guide.

P.S. the installer will automaticaly determin if database already exist and if it needs to be updated or create new one.
Title: [MOD] Search Statistics v1.2
Post by: Xwall on June 08, 2003, 11:15:57 AM
Excellent work!!!

The last requirement that is needed in this mod is, How many results that appear when making the search?  :wink:

Phrases (love hewitt)  Count (3)  Guests (1)  Users (2)  Admins (0)  Results (27)
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 08, 2003, 07:44:37 PM
Quote from: Xwall
The last requirement that is needed in this mod is, How many results that appear when making the search?  :wink:

Phrases (love hewitt)  Count (3)  Guests (1)  Users (2)  Admins (0)  Results (27)

do u mean to log how many images where found when searched word/phrase? :? are u sure?
but u always just can click on the phrase/word and find it out yourself...(I can add an extra code that wont count admin when hit from the search stats - that would be more accurate.)
Title: [MOD] Search Statistics v1.2
Post by: Xwall on June 09, 2003, 11:31:11 AM
Quote from: V@no

(I can add an extra code that wont count admin when hit from the search stats - that would be more accurate.)


if you can do it, do it.  8)

If to see the number of results is not the best thing, at least to know if there are results of that search (Results [Yes] [No]).

I am interested in the searches that do not have results.  :?
Title: [MOD] Search Statistics v1.2
Post by: Xwall on June 12, 2003, 11:01:34 AM
V@no why dont you put something similar like PMS (Deleted selected and Deleted all).  

Some words or phrases are crazy  8O and to erase them i must go to the Data Base.  :wink:
Title: Installation error
Post by: kaisuny on June 14, 2003, 03:24:36 AM
Install failed?
Code: [Select]

CREATE TABLE `4images_search_stats` ( `text` varchar( 255 ) NOT NULL default \'\', `word` tinyint( 1 ) NOT NULL default \'0\', `count` mediumint( 10 ) NOT NULL default \'1\', `date` int( 11 ) NOT NULL default \'0\', `guests` mediumint( 10 ) NOT NULL default \'0\', `users` mediumint( 10 ) NOT NULL default \'0\', `admins` mediumint( 10 ) NOT NULL default \'0\', KEY `text` ( `text` ) ) TYPE = MYISAM


DB Error: Bad SQL Query: CREATE TABLE `4images_search_stats` ( `text` varchar( 255 ) NOT NULL default \'\', `word` tinyint( 1 ) NOT NULL default \'0\', `count` mediumint( 10 ) NOT NULL default \'1\', `date` int( 11 ) NOT NULL default \'0\', `guests` mediumint( 10 ) NOT NULL default \'0\', `users` mediumint( 10 ) NOT NULL default \'0\', `admins` mediumint( 10 ) NOT NULL default \'0\', KEY `text` ( `text` ) ) TYPE = MYISAM
You have an error in your SQL syntax near '\'\', `word` tinyint( 1 ) NOT NULL default \'0\', `count` mediumint( 10 ) NOT NU' at line 1
CREATE TABLE `4images_search_stats` ( `text` varchar( 255 ) NOT NULL default \'\', `word` tinyint( 1 ) NOT NULL default \'0\', `count` mediumint( 10 ) NOT NULL default \'1\', `date` int( 11 ) NOT NULL default \'0\', `guests` mediumint( 10 ) NOT NULL default \'0\', `users` mediumint( 10 ) NOT NULL default \'0\', `admins` mediumint( 10 ) NOT NULL default \'0\', KEY `text` ( `text` ) ) TYPE = MYISAM


Title: Re: Installation error
Post by: V@no on June 14, 2003, 11:44:20 PM
Quote from: kaisuny
Install failed?

ooopss :oops:
please either open search_stats_install.php and replace all \' to '
or redownload the package.
Title: [MOD] Search Statistics v1.2
Post by: edwin on June 16, 2003, 11:39:15 AM
for wich version is this mod ?
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 16, 2003, 11:53:42 AM
Quote from: edwin
for wich version is this mod ?
version of what? :?
Title: [MOD] Search Statistics v1.2
Post by: edwin on June 16, 2003, 12:34:46 PM
4images,

version 1.6
version 1.7
Title: [MOD] Search Statistics v1.2
Post by: Chris on June 16, 2003, 03:52:43 PM
Version 1.7
Title: [MOD] Search Statistics v1.2
Post by: edwin on June 16, 2003, 05:41:53 PM
it's a pitty
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 16, 2003, 09:51:27 PM
Quote from: edwin
it's a pitty

I think pitty when ppl still using outdated software and still trying get support for it... ;)
Title: [MOD] Search Statistics v1.2
Post by: edwin on June 16, 2003, 11:12:51 PM
ppppfffffffff, a very strange reaction
Title: [MOD] Search Statistics v1.2
Post by: V@no on June 16, 2003, 11:37:21 PM
Quote from: edwin
ppppfffffffff, a very strange reaction

no, no offense ;) :)
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on March 19, 2005, 03:09:27 PM
All neccessery files and instruction u can find in this file:
http://come.no-ip.com/files.php?id=30

demo:
http://come.no-ip.com/search.php (there is a link "Search Statistics" at the left-bottom)

hi.

these files are gone. :(
could someone please recover and then post a link to them here?

thank you! :)

m
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on March 19, 2005, 05:42:43 PM
thanks v@no! :D

marcus
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 05, 2005, 12:36:53 AM
Does this Mod work with "Keyword Jump Menu"-Mod?
Will searchwords selected by Jump menu also be counted?
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 05, 2005, 01:16:12 AM
if I'm not misstaken the "Keyword Jump Menu" works the same as if u type a keyword in the search field and hit "search" button...if it is, then yes, this mod should count it as search keywords.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 05, 2005, 11:42:31 AM
ok, thank you.

can anybody pleas publish the "right" code of new Paging Class (which you need for Search Stats Mod) ?

In this thread
http://4homepages.de/forum/index.php?topic=5761.0
it´s confusingly encoded

Code: [Select]
if &#40;!defined&#40;'ROOT_PATH'&#41;&#41; &#123;
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 06, 2005, 12:46:00 AM
please use this mod:
http://www.4homepages.de/forum/index.php?topic=6926.0

P.S. I've updated the topic u were refering to ;)
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 06, 2005, 10:31:14 AM
thanks a lot.
It works great. And it works with Keyword Jump Menu.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 06, 2005, 12:17:09 PM
If someone wants to display date in european standard:
Falls jemand das Datum dem europäischen Standard entsprechen angezeigt haben möchte:

search_stats.php

Find
Code: [Select]
$words .= ($show_date) ? "<td nowrap title=\"".$lang['search_stats_date_alt']."\">".date("d-m-y h:i A", $result['date'])."</td>\n" : "";Replace with
Code: [Select]
$words .= ($show_date) ? "<td nowrap title=\"".$lang['search_stats_date_alt']."\">".date("d.m.y G:i", $result['date'])."</td>\n" : "";
Find
Code: [Select]
$phrases .= ($show_date) ? "<td nowrap title=\"".$lang['search_stats_date_alt']."\">".date("d-m-y h:i A", $result['date'])."</td>\n" : "";Replace with
Code: [Select]
$phrases .= ($show_date) ? "<td nowrap title=\"".$lang['search_stats_date_alt']."\">".date("d.m.y G:i", $result['date'])."</td>\n" : "";

Hier ein Übersetzungsvorschlag für die Sprachvariablen

Code: [Select]
//-----------------------------------------------------
//--- Search Statistics -------------------------------
//-----------------------------------------------------
$lang['search_stats'] = "Suchwortstatistik";
$lang['search_stats_words'] = "Suchwörter";
$lang['search_stats_phrases'] = "Suchphrasen";
$lang['search_stats_paging'] = "{words} Suchworte und {phrases} Suchphrasen auf {total_pages} Seite(n) gefunden.";
$lang['search_stats_sort'] = "Statistik sortieren nach:";
$lang['search_stats_perpage'] = "pro Seite:";
$lang['search_stats_nowords'] = "Keine Suchworte gefunden";
$lang['search_stats_nophrases'] = "Keine Suchphrasen gefunden";
$lang['search_stats_date_alt'] = "Datum der letzten Suche";
$lang['search_stats_sort_options'] = array(
"text" => "Alphabet",
"count" => "Anzahl",
"date" => "Datum",
"guests" => "Gäste",
"users" => "Mitglieder",
"admins" => "Admin"
);
$lang['search_stats_order_options'] = array(
  "ASC"  => "Aufsteigend",
  "DESC" => "Absteigend"
);
//--- End Search Statistics ---------------------------

Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 06, 2005, 02:06:34 PM
hmmm...I think the date("d-m-y h:i A", $result['date']) function should be replaced by format_date($config['date_format']." ".$config['time_format'], $result['date'])
this way it will use date format from the settings
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 12, 2005, 02:46:14 PM
I didn´t figure out how to show:

"Search was used XXX times"
on search_stats page

How can I count how often search was used for each word and phrase altogether?
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on April 13, 2005, 02:49:01 PM
hi!

i installed serach statistics without any problems. but when i point my browser to http://mysite/mygallery/search_stats.php

i get these error messages:


Code: [Select]
Warning: Invalid argument supplied for foreach() in mysite/mygallery/search_stats.php on line 95

which is in the document serach_stats.php
Code: [Select]
foreach ($lang['search_stats_sort_options'] as $key => $val) {
and

Code: [Select]
Warning: Invalid argument supplied for foreach() in mysite/mygallery/search_stats.php on line 106

which is
Code: [Select]
foreach ($lang['search_stats_order_options'] as $key => $val) {
within the layout.


what could cause this?

i also see no link at my search.php after adding {search_stats} to my serach_form.html template.

any suggestions?

everything else is working correctly.

thank you.

marcus
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 13, 2005, 02:59:46 PM
Have you set the new language variables to lang/YOURLANGUAGE/main.php?

Have you replaced paging.php ?
http://www.4homepages.de/forum/index.php?topic=6926.0
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on April 13, 2005, 03:12:08 PM
Have you set the new language variables to lang/YOURLANGUAGE/main.php?

where do i have to do that?

Have you replaced paging.php ?
http://www.4homepages.de/forum/index.php?topic=6926.0

yes.

marcus
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 13, 2005, 03:14:57 PM
try this

Code: [Select]
Step 3.
Open /lang/<yourlanguage>/main.php
At the end of the file, just before closing ?> add this:

//-----------------------------------------------------
//--- Search Statistics -------------------------------
//-----------------------------------------------------
$lang['search_stats'] = "Search Statistic";
$lang['search_stats_words'] = "Words";
$lang['search_stats_phrases'] = "Phrases";
$lang['search_stats_paging'] = "Found {words} words(s) and {phrases} phrase(s) on {total_pages} page(s).";
$lang['search_stats_sort'] = "Sort stats by:";
$lang['search_stats_perpage'] = "Per page:";
$lang['search_stats_nowords'] = "No words were found";
$lang['search_stats_nophrases'] = "No phrases were found";
$lang['search_stats_date_alt'] = "Date of last search";
$lang['search_stats_sort_options'] = array(
"text" => "Alphabet",
"count" => "Count",
"date" => "Date",
"guests" => "Guests",
"users" => "Users",
"admins" => "Admins"
);
$lang['search_stats_order_options'] = array(
  "ASC"  => "Ascending",
  "DESC" => "Descending"
);
//--- End Search Statistics ---------------------------
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on April 13, 2005, 03:32:53 PM
oh sorry. yes i did. of course.

i did everything exactly (i´m quite sure) like it was written down in v@nos install.doc.

i do coding on a mac with an application called "hyperedit" which validates and alerts errors in the php-code immediately.
i got no error messages while replacing / adding code to the documents. i am nevertheless a php-noob.

so …

 :?

thanks, m
Title: Re: [MOD] Search Statistics v1.2
Post by: marcus_s on April 14, 2005, 09:13:58 PM
no suggestions?

 :?

m
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 15, 2005, 12:39:54 AM
either u didnt add the needed code from Step 3 in the correct file/dir or u didnt upload the changed file to the server.
the errors could happend only if main.php file wasnt updated.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 16, 2005, 06:12:08 PM
I didn´t figure out how to show:

"Search was used XXX times"
on search_stats page

How can I count how often search was used for each word and phrase altogether?

Do anybody know how to count all times search was used?
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 16, 2005, 06:28:52 PM
in search_stats.php find:
Code: [Select]
  "paging" => $getpaging->get_paging(),insert above:
Code: [Select]
  "total_count" => $words+$phrases,then u can use {total_count} tag in the template.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 17, 2005, 07:33:41 PM
thanks, but I meant sth other:
I want to count all search hits together - sum each search hit up.

Keyword flower was found 35 times
Keyword portrait was found 40 times
phrases XYZ was found 22 times
...

Alltogehter "we had 512 search hits"
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 17, 2005, 08:21:56 PM
and that what the code I posted supposed to do...:?
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 17, 2005, 08:52:54 PM
no, it sums up how many words and phrases were searched for. For example: flower, potrait, landscape = 3  (point "1." on attached picture)
What I´m searching for (how many hits do each word an phrase have) : Flowers (4 times), potrait (2 times), landscape (4 times) = 10 search hits altogehther (point "2." on attached picture).

Sorry for that complicate explanation  :|
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 17, 2005, 10:00:38 PM
ah, I see now.
ok, remove the line I've mentioned above.
and insert
Code: [Select]
$sql = "SELECT SUM(*) AS num
        FROM ".SEARCH_STATS_TABLE;
$total = $site_db->query_firstrow($sql);
$site_template->register_vars("total_count", $total['num']);
below
Code: [Select]
$offset = $getpaging->get_offset();use same tag: {total_count}

P.S. not tested.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 17, 2005, 11:46:23 PM
It gives same worth as your first code ?

Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 18, 2005, 12:04:51 AM
It gives same worth as your first code ?
as I said I didnt test it.
also if u didnt remove my first code, then it will owerwrite result from the last posted code.
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 18, 2005, 11:04:45 AM
Code: [Select]
$sql = "SELECT SUM(count) AS num
        FROM ".SEARCH_STATS_TABLE;
$total = $site_db->query_firstrow($sql);
$site_template->register_vars("total_count", $total['num']);

It works, no idea what I did yesterday. Uploaded wrong file or something  :roll:

 :!: Thank you  :!:

Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on April 27, 2005, 10:01:28 AM
Hello
could you tell me how to reset the search statistic?

sincerly
vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on April 27, 2005, 10:36:16 AM
clear 4images_search_stats table via phpMyadmin?!

Title: Re: [MOD] Search Statistics v1.2
Post by: artpics on May 09, 2005, 04:21:13 AM
hello i have installed this mod all is working but i get this printed out

(http://www.artpictures.tv/fm/stat.jpg)

on screen, where in the code can i remove this please v1.71, i have deleted the DB field and run the stats_install but still the same


thanks

RT
Title: Re: [MOD] Search Statistics v1.2
Post by: artpics on May 10, 2005, 05:30:16 PM
is this why this is happening
  http://www.4homepages.de/forum/index.php?topic=6806.0

as it did not show these tags when i had 1.7 :(

edited ..................

yes i found the answer click above  :D
Title: Re: [MOD] Search Statistics v1.2
Post by: max.cady on May 12, 2005, 09:31:16 PM
Danke für den Link zu dem conditional tags mod. Ich hatte das gleiche Problem .... ist jetzt gelöst  :mrgreen:
Title: Re: [MOD] Search Statistics v1.2
Post by: artpics on May 12, 2005, 09:34:23 PM
 :D
Title: Re: [MOD] Search Statistics v1.2
Post by: Dandily on June 29, 2005, 05:16:43 PM
I have a strange thing, only phrases are added to search statistics...
i check the mysql with phpMyAdmin and there are no words, only phrases...

Search are working good, but i have no statistics about searching words.

What it could be?
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on June 30, 2005, 12:41:17 AM
recheck Step 1.2

P.S. so, where does the single word goes after the search?
For example try to search for a random, unique string, and check database if that string was added at all.

P.P.S. can we test it?
Title: Re: [MOD] Search Statistics v1.2
Post by: Dandily on June 30, 2005, 03:12:25 PM
Thanks a lot!

It was my stuipid fault...
I was trying to install this mod two times, but every time i missed step 1.2 :)

Thanks again.

P.S. I`m also from Russia, but i`m from Moscow.
Title: Re: [MOD] Search Statistics v1.2
Post by: SAD on July 05, 2005, 01:39:11 PM
Look stats only admin.

Open search_stats.php

find
Code: [Select]
include(ROOT_PATH.'includes/page_header.php');

add after

Code: [Select]
if ($user_info['user_level'] != ADMIN) {
  show_error_page($lang['no_permission']);
}
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 01, 2005, 11:24:23 PM
Hello
i have the Problem that the words are added to the Phrases - but i have added step 1.2

http://www.foto-kocher.com/search_stats.php

Code: [Select]
    elseif ($split_words[$i] != "" && strlen($split_words[$i]) >= MIN_SEARCH_KEYWORD_LENGTH && strlen($split_words[$i]) <= MAX_SEARCH_KEYWORD_LENGTH && !in_array($split_words[$i], $stopword_list)) {
// start Search_stat
if (count($split_words) == 1) {
      $sql = "UPDATE ".SEARCH_STATS_TABLE."
      SET count = count + 1, word = 1, date = ".time().", ".$who." = ".$who." + 1
      WHERE text LIKE '".addslashes(str_replace("*", "", $split_words[$i]))."' AND word = 1";
      $site_db->query($sql);
    if (!$site_db->affected_rows()) {
      $sql = "INSERT INTO ".SEARCH_STATS_TABLE."
              (text, word, date, ".$who.")
              VALUES
              ('".addslashes(str_replace("*", "", $split_words[$i]))."', 1, ".time().", 1)";
      $site_db->query($sql);
    }
}
// end Search_stat

so who else coud be the fault?
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 02, 2005, 09:00:03 AM
i Found out that this mess with phrase and word only happen with count, if i change to date it works fine!

why this happen?

and would do i have to change to have it by default sorted by date?

sincerly
vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on September 02, 2005, 12:27:28 PM
...
and would do i have to change to have it by default sorted by date?
...

in search_stats.php finde :
Code: [Select]
if (isset($session_info['srchstatssort'])) {
  $sort = $session_info['srchstatssort'];
}else{
        $sort = "count";
}

und ersetze es durch :
Code: [Select]
if (isset($session_info['srchstatssort'])) {
  $sort = $session_info['srchstatssort'];
}else{
        $sort = "date";
}

mawenzi
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 02, 2005, 12:48:21 PM
it works Mawenzi - thanks a lot!

but if you click on this to change to sort so it is showing confusion with phrase and words  :?:

vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on September 02, 2005, 01:06:13 PM
ja das sieht in deiner Suchstatistik schon etwas konfus aus ...  :?
ich würde an deiner Stelle die search_stats.php gegen die original search_stats.php austauschen ...

mawenzi
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 02, 2005, 02:07:30 PM
habe ich gestern gemacht - wobei was ist die Original datei?

gruss
vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on September 02, 2005, 02:50:20 PM
...
wobei was ist die Original datei?
...

... die search_stats.php aus der search_stats.zip ...  :wink:

mawenzi
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 02, 2005, 03:04:37 PM
das TXT löschen dann hast du meine Org datei!

gruss
vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on September 02, 2005, 03:29:03 PM
...
ich würde an deiner Stelle die search_stats.php gegen die original search_stats.php austauschen ...
...

... ergo ... du solltest das auch machen ...  :roll:
Title: Re: [MOD] Search Statistics v1.2
Post by: Vincent on September 02, 2005, 03:57:43 PM
wie kommst du darauf das es eine nicht originale ist?
ich habe sie aus dem Zip rausgenommen und auf den server gelegt!

oder hast du eine bessere Zip datei  :?

gruss
vincent
Title: Re: [MOD] Search Statistics v1.2
Post by: Jan-Lukas on September 19, 2005, 01:01:42 AM
hättest nur eine seite zurück blättern brauchen, da hättest du diesen link gefunden
http://www.4homepages.de/forum/index.php?topic=6806.0

bitte erst auf zitat klicken und dann den code nehmen :wink:
Title: Re: [MOD] Search Statistics v1.2
Post by: Jan-Lukas on September 20, 2005, 12:44:31 AM
Habe eine Frage zu dem MOD
es werden ja jetzt die Ordner in der Vorschau angezeigt
Nun möchte ich aber auch noch den Jahrgang angezeigt bekommen, der 2 Ordner vorher angezeigt wird
Wie müsste denn der Code heissen, denn mit cat_name wird ja nur der aktuelle angezeigt, und ich bräuchte 2 weiter vorne.
z.B. hier Jahrgang : 2001/02
Danke Harald
(http://www.ue-ei-portal.de/bilder/jahrgang.jpg)
Title: Re: [MOD] Search Statistics v1.2
Post by: kief24 on January 22, 2006, 09:52:55 AM
hello,

the search function still works, but on the top of the page i get this error :
Code: [Select]
DB Error: Bad SQL Query: UPDATE 4images_search_stats SET count = count + 1, word = 1, date = 1137919868, guests = guests + 1 WHERE text LIKE 'apple' AND word = 1
Can't open file: '4images_search_stats.MYI' (errno: 145)

Just discovered it, don't know how long it's there. ( edupics.com )
Someone has an idea how to deal with this ?

Thx !
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on January 22, 2006, 10:33:37 AM
Try to repare the table, if it doesnt help, then you'll need to remove the new table and re-create the table...
There something happend on your server, you also should contact your host administrator about this error.
Title: Re: [MOD] Search Statistics v1.2
Post by: insane on January 28, 2006, 12:21:35 PM
How can i fix this?
(http://img33.imageshack.us/img33/4858/unbenannt7nz.th.jpg) (http://img33.imageshack.us/my.php?image=unbenannt7nz.jpg)
Title: Re: [MOD] Search Statistics v1.2
Post by: wallpapers on March 10, 2006, 06:19:44 AM
This is a great mod, :D
it works perfect, 8)
no problems at all :lol:
thanks V@no :mrgreen:
Title: Re: [MOD] Search Statistics v1.2
Post by: sau4scr on May 04, 2006, 04:24:44 AM
Hey everyone...

ok on my search_stats.php page I have no options or drop down to choose what I would like to sort by. I have reinstalled this mod twice and got the same problem both times. I am positive I did not miss the same thing twice. If anyone has an idea of what it would be. Please take a look at my problem at http://photographybyweston.com/gallery/search_stats.php

Thanks in advance!

Weston
Title: Re: [MOD] Search Statistics v1.2
Post by: koikonut on May 04, 2006, 05:17:45 AM
Hmm, I seems that search.php has changed with the new version of 4images 1.7.2...
I can't find for example

Code: [Select]
elseif ($split_words[$i] != "" && strlen($split_words[$i]) >= MIN_SEARCH_KEYWORD_LENGTH && strlen($split_words[$i]) <= MAX_SEARCH_KEYWORD_LENGTH && !in_array($split_words[$i], $stopword_list)) {

nor

Code: [Select]
"search_keywords" => htmlspecialchars(stripslashes($org_search_keywords)),
It would be great if someone could modify the code for this version - I think others are interested in this too :-)

I attached search.php(.txt) of the 4images-Version 1.7.2

Thx, bye Konradin
Title: Re: [MOD] Search Statistics v1.2
Post by: sau4scr on May 04, 2006, 05:27:46 AM
Yes that reminds me now there was one line that had changed but I found what it was now in 1.7.2. That would be what messed it up probably. Anyone have it for 1.7.2?
Title: Re: [MOD] Search Statistics v1.2
Post by: ipicture on October 28, 2006, 09:08:36 PM
Is there a new/another download available, cause Veno´s site is not online yet?
Title: Re: [MOD] Search Statistics v1.2
Post by: pda on October 31, 2006, 08:27:29 PM
It would be nice to get this mod! Cause the download link from Vanos site is down.
Could someone please share it?

Thx for your help
Title: Re: [MOD] Search Statistics v1.2
Post by: Funix on November 02, 2006, 01:03:51 PM
hi vano

could you please attach the file?

thanks!!!
Title: Re: [MOD] Search Statistics v1.2
Post by: pda on November 29, 2006, 02:48:11 PM
see the above mentioned questions  :wink:

Need this mod to build an 4image tag cloud script
Title: Re: [MOD] Search Statistics v1.2
Post by: m.a on January 26, 2007, 03:42:36 AM
hi vano

could you please attach the file?

thanks!!!


Hi V@no,

Can you please attach the file?

Thanks in advance
m.a
Title: Re: [MOD] Search Statistics v1.2
Post by: impss on February 02, 2007, 01:58:58 PM
I would like this mod as well..

Anyone that can attach it to this post?
Title: Re: [MOD] Search Statistics v1.2
Post by: drastx on February 06, 2007, 10:12:13 AM
V@no we need file  8)
Title: Re: [MOD] Search Statistics v1.2
Post by: drastx on February 07, 2007, 04:23:33 PM
Cmon, i really need this one! ;)
Title: Re: [MOD] Search Statistics v1.2
Post by: kowalski on February 25, 2007, 12:15:50 PM
any chance of posting this file for v1.7.4 users please?
Title: Re: [MOD] Search Statistics v1.2
Post by: Jan-Lukas on March 04, 2007, 11:46:11 PM
Hi Ivan,
Hab es dir via Mail zugeschickt, und füge das Zip hier noch mal ein.

gruss Harald
Title: Re: [MOD] Search Statistics v1.2
Post by: amsy on March 05, 2007, 10:23:54 AM
hi..it is done.thank  you man
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on May 02, 2007, 11:34:21 PM
I got this Mod to work in 4images 1.7.4


There are some changes in search_stats.php because the original dint use search_stats_sort_dropdown_form in 4images 1.7.4

search_stats_install.rtf is adapted for 4images 1.7.4

the original search_stats.php is still in the zip file  remove the org_ from the file name before uploading to your site.


I hope this is of use to someone (it woks for me)


EDIT
--------------------------------------------------------------------------------------------
Copy and past is a nice thing
if you select everything that needs to be copied of course. :wink:

I updated the search_stats_install.rtf file   

Thanks Cristina.

Title: Re: [MOD] Search Statistics v1.2
Post by: cristina on May 20, 2007, 04:32:53 AM
I got this Mod to work in 4images 1.7.4

There are some changes in search_stats.php because the original dint use search_stats_sort_dropdown_form in 4images 1.7.4

search_stats_install.rtf is adapted for 4images 1.7.4

the original search_stats.php is still in the zip file  remove the org_ from the file name before uploading to your site.

I hope this is of use to someone (it woks for me)

Nice that you attached the new files... thank you so much!  :wink:

Just one thing: in Step 1 for 4images 1.7.2  and 1.7.4, there is one missing

Code: [Select]
}
at the end of the code. For those installing this MOD... don't forget to add it!

Regards.
Title: Re: [MOD] Search Statistics v1.2
Post by: tytanic11 on June 25, 2007, 12:29:40 AM
Working great on 1.7.4; exactly what my site needed.. thanks !
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on June 26, 2007, 12:38:01 AM
I cant open the image so I hope this is it

In search_stats.php

Look for
Code: [Select]
foreach ($lang['search_stats_order_options'] as $key => $val) {
$sort_dropdown .= "<INPUT type=\"radio\" name=\"order\" value=\"$key\"";
if ($order == $key) {
    $sort_dropdown .= " checked";
}
$sort_dropdown .= ">".$val."\n";
}

change to
Code: [Select]
/*
foreach ($lang['search_stats_order_options'] as $key => $val) {
$sort_dropdown .= "<INPUT type=\"radio\" name=\"order\" value=\"$key\"";
if ($order == $key) {
    $sort_dropdown .= " checked";
}
$sort_dropdown .= ">".$val."\n";
}
*/

$sort_dropdown .="\n<select name=\"order\" class=\"setperpageselect\">\n";
foreach ($lang['search_stats_order_options'] as $key => $val) {
  $sort_dropdown .= "<option value=\"$key\"";
  if ($order == $key) {
    $sort_dropdown .= " selected=\"selected\"";
  }
  $sort_dropdown .= ">".$val."</option>\n";
}
$sort_dropdown .= "</select>\n";
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on June 26, 2007, 08:45:12 PM
} is missing

Dorn that’s the second time this happens

empty search words
Strange  I tested this en I don’t get an empty string in the stats even tested a space

Did you follow the instructions correctly?  Is it possible to post your search.php?

Title: Re: [MOD] Search Statistics v1.2
Post by: knsin0 on June 29, 2007, 01:38:10 AM
Nice mod, im using 1.7.4 buggy, i followed your instructions and the search_stats.php seems to work ok, but in the search form i get this error when i try to search something:
Code: [Select]
Notice: Use of undefined constant SEARCH_STATS_TABLE - assumed 'SEARCH_STATS_TABLE' in C:\AppServ\www\search.php on line 93

Notice: Use of undefined constant SEARCH_STATS_TABLE - assumed 'SEARCH_STATS_TABLE' in C:\AppServ\www\search.php on line 98

How can i fix that?¿  What im doing wrong?¿  :?
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on June 29, 2007, 09:35:28 AM
It is like the notice says
undefined constant

the constant is defined in
Step 2.
Open /includes/constants.php
At the end of the file, just before closing ?> add this:
Code: [Select]
define('SEARCH_STATS_TABLE', $table_prefix.'search_stats');
if this is OK and you still got the notice remove the MOD  (reinstall the backup files) and start over.
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on July 01, 2007, 07:25:49 PM
missing items in list

In search_stats.php look for
Code: [Select]
$count = ($words > $phrases) ? $words : $phrases;

change to
Code: [Select]
// $count = ($words > $phrases) ? $words : $phrases;
$count = $words + $phrases; 
Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on July 01, 2007, 09:07:33 PM
@ivan,

... solche Suchwörter in der Liste wie "cÄ'te" oder mit ähnlichen Hyroglyphen werden durch Searchboots erzeugt ...
... sie entstehen aus Suchwörtern deiner Website mit Umlauten und Sonderzeichen ...
... es sind ja in der Regel engl. sprachige Boots, die Umlaute und Sonderzeichen nicht kennen ...
... folgt solch ein Boot nun einem Suchwortlink mit Umlaut, so transformiert er dieses Suchwort bzw. die Umlaute/Sonderzeichen ...
... mit diesem transformiertem Suchwort geht er in deine Suche und legt es auch so in der Datenbank ab ...
... so ... und da ist es nun, das eigenartige Wort und erscheint nun in der Auflistung deiner Search Statistik ...

... und wie kann man das verhindern / umgehen / ändern ... ?

1. man verwendet keine Suchwörter mit Umlauten / Sonderzeichen ...
2. wenn doch, dann muss man regelmäßig die Datenbank etwas aufräumen und diese Suchwörter aus der Tabelle löschen ...
3.  mehr fällt mir momentan dazu nicht ein ...

... in meiner Suchwortauflistung sieht es genauso aus und regele die Problematik entspr. Punkt 2. ... ;)
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on July 01, 2007, 09:46:52 PM
i have trouble with this code
// $count = ($words > $phrases) ? $words : $phrases;
$count = $words + $phrases; 

problem with paging > comes error 404

Strange it works for me I to had missing items in the list

as you wrote
problem with browser

image one 2007-07-01_201736.gif > database keyword in search_stats table is okay
image two 2007-07-01_202141.gif > this view in opera
image three 2007-07-01_202234.gif > this view in firefox

i have with all browser the same problems.

I think you misunderstood my PM

By the way
2007-07-01_1.gif  the item has a count of 14

in your img 2007-07-01_201736.gif you point out items that have a cont of 1 and 4 (it’s the wrong item)



in your 2007-07-01_1.gif the status bar points out the correct search phrase

when I take my Dutch browser the status bar gifs me the wrong  search phrase

(http://buggyteambelgie.dnsalias.com/img/5.jpg)

my German reading is bad  as for I can understand mawenzi post its something of English search bots   so a language thing
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on July 03, 2007, 01:27:01 PM
I took an other look ad the missing items and I am still convinced it has to be

Code: [Select]
// $count = ($words > $phrases) ? $words : $phrases;
$count = $words + $phrases;


the calculation of the page are wrong otherwise
$count = ($words > $phrases) ? $words : $phrases;
(http://buggyteambelgie.dnsalias.com/img/7.jpg)

found 32 words and 6 phrases
these or clamed to be shown on 7 pages

5 items on every page - - > 7 pages  that is only 35 items total 
I wil be missing 3 items

$count = $words + $phrases;
(http://buggyteambelgie.dnsalias.com/img/8.jpg)

found 32 words and 6 phrases
these or shown on 8 pages

5 items on every page - - > 8 pages  that is 40 items total 
last page only contains 3 items (there isn’t any more to show)

can someone else test this and let us know what the result is?

Title: Re: [MOD] Search Statistics v1.2
Post by: mawenzi on July 03, 2007, 02:27:27 PM
@ Buggy Driver

... your new code for $count is 100% correct ...  8O
... and why ...
... in the search_stats_table are shown words and ( not or ) phrases by a count of "per page" ...
... I changed my count-code in your way and tested it ... 100% correct ...

... thanks Buggy Driver for your hint ...  :mrgreen:
Title: Re: [MOD] Search Statistics v1.2
Post by: Fragezeichen on July 20, 2007, 11:02:02 PM
 Hat jemand die Files zum Download?
Ich glaube mal das die Seach.php und Seach_stats.php nicht ales sein können.

How could I found the Files-Upload?
Only two updatet Php files for Version 1.7.4 could not be all,isn´t it?

Please
Title: Re: [MOD] Search Statistics v1.2
Post by: sami1255 on July 25, 2007, 01:07:32 AM
I dont understand this either.. the word file has sub-steps as well..  please clearify..  :?: :?: :?:
Title: Re: [MOD] Search Statistics v1.2
Post by: Buggy Driver on July 28, 2007, 09:35:29 PM
The files or at the bottom of this post
http://www.4homepages.de/forum/index.php?topic=6033.msg92709#msg92709

a few posts down, or some enhancements
http://www.4homepages.de/forum/index.php?topic=6033.msg95419#msg95419

and don’t forget
http://www.4homepages.de/forum/index.php?topic=6033.msg95432#msg95432
Title: Re: [MOD] Search Statistics v1.2
Post by: Martin2006-B-2 on January 29, 2008, 04:14:59 PM
This is a GREAT Mod! Thanks to all!
Title: Re: [MOD] Search Statistics v1.2
Post by: RoadDogg on March 28, 2008, 12:07:19 AM
After updating gallery to v1.7.6 and updating this Mod {words} and {phrases} are no longer working:

$lang['search_stats_paging'] = "Found {words} words(s) and {phrases}

Has anybody an idea? I compared all files with the old ones but I cannot find how to get these variables working.
Title: Re: [MOD] Search Statistics v1.2
Post by: IWS_steffen on April 18, 2008, 06:19:50 PM
schöner und nützlicher MOD. Klappt super!

http://www.urlauberschiff-fritzheckert.de/maritim/search_stats.php (http://www.urlauberschiff-fritzheckert.de/maritim/search_stats.php)

Danke Gruß Steffen
Title: Re: [MOD] Search Statistics v1.2
Post by: AntiNSA2 on March 05, 2009, 05:39:17 PM
Where is the attachment for this mod, and has anyone got it to work with 1.7.6/????
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on March 06, 2009, 01:46:13 AM
I've attached to the original post. Hopefully it's the right file. It's dated 2005-04-05
Title: Re: [MOD] Search Statistics v1.2
Post by: AntiNSA2 on March 06, 2009, 03:47:45 AM
I cant say right or wrong, but I can say that this step:


Step 1.2.


Is impossible to do in 1.7.6  ...

can you try to make it work for 1.7.6 ?

It is very important for me to know what keywords people are searching for.

The code in step 1.2 is can not be found to alter.

Thanks V@no!
Title: Re: [MOD] Search Statistics v1.2
Post by: AntiNSA2 on March 11, 2009, 09:59:07 AM
elseif ($split_words[$i] != "" && strlen($split_words[$i]) >= MIN_SEARCH_KEYWORD_LENGTH && strlen($split_words[$i]) <= MAX_SEARCH_KEYWORD_LENGTH && !in_array($split_words[$i], $stopword_list)) {

is not in my search.php

This is my search.php
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: search.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'search';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/search_utils.php');
error_reporting(E_ALL);
$org_search_keywords $search_keywords;
$org_search_user $search_user;

if (isset(
$HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
  
$search_terms = isset($HTTP_POST_VARS['search_terms']) ? $HTTP_POST_VARS['search_terms'] : $HTTP_GET_VARS['search_terms'];
  
$search_terms $search_terms == "all" 0;
}
else {
 
$search_terms 1;
}

if (isset(
$HTTP_GET_VARS['search_fields']) || isset($HTTP_POST_VARS['search_fields'])) {
  
$search_fields = isset($HTTP_POST_VARS['search_fields']) ? trim($HTTP_POST_VARS['search_fields']) : trim($HTTP_GET_VARS['search_fields']);
}
else {
  
$search_fields "all";
}

$search_cat $cat_id;

$search_id = array();

if (
$search_user != "" && $show_result == 1) {
  
$search_user str_replace('*''%'trim($search_user));
  
$sql "SELECT ".get_user_table_field("""user_id")."
          FROM "
.USERS_TABLE."
          WHERE "
.get_user_table_field("""user_name")." LIKE '$search_user'";
  
$result $site_db->query($sql);
  
$search_id['user_ids'] = "";
  if (
$result) {
    while (
$row $site_db->fetch_array($result)) {
      
$search_id['user_ids'] .= (($search_id['user_ids'] != "") ? ", " "").$row[$user_table_fields['user_id']];
    }
    
$site_db->free_result($result);
  }
}

if (
$search_keywords != "" && $show_result == 1) {
  
$split_words prepare_searchwords($search_keywordstrue);

  
$match_field_sql = ($search_fields != "all" && isset($search_match_fields[$search_fields])) ? "AND m.".$search_match_fields[$search_fields]." = 1" "";
  
$search_word_cache = array();
  
  for (
$i 0$i sizeof($split_words); $i++) {
    if (
$split_words[$i] == "and" || $split_words[$i] == "und" || $split_words[$i] == "or" || $split_words[$i] == "oder" || $split_words[$i] == "not") {
      
$search_word_cache[$i] = ($search_terms) ? "and" $split_words[$i];
    }
    else {
      
$sql "SELECT m.image_id
              FROM ("
.WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m)
              WHERE w.word_text LIKE '"
.addslashes(str_replace("*""%"$split_words[$i]))."'
              AND m.word_id = w.word_id
              
$match_field_sql";
      
$result $site_db->query($sql);
      
$search_word_cache[$i] = array();
      while (
$row $site_db->fetch_array($result)) {
        
$search_word_cache[$i][$row['image_id']] = 1;
      }
      
$site_db->free_result();
    }
  }

  
$is_first_word 1;
  
$operator "or";
  
$image_id_list = array();
  for (
$i 0$i sizeof($search_word_cache); $i++) {
    if (
$search_word_cache[$i] == "and" || $search_word_cache[$i] == "und" || $search_word_cache[$i] == "or" || $search_word_cache[$i] == "oder" || $search_word_cache[$i] == "not") {
      if (!
$is_first_word) {
        
$operator $search_word_cache[$i];
      }
    }
    elseif (
is_array($search_word_cache[$i])) {
      if (
$search_terms) {
        
$operator "and";
      }
      foreach (
$search_word_cache[$i] as $key => $val) {
        if (
$is_first_word || $operator == "or" || $operator == "oder") {
          
$image_id_list[$key] = 1;
        }
        elseif (
$operator == "not") {
          unset(
$image_id_list[$key]);
        }
      }
      if ((
$operator == "and" || $operator == "und") && !$is_first_word) {
        foreach (
$image_id_list as $key => $val) {
          if (!isset(
$search_word_cache[$i][$key])) {
            unset(
$image_id_list[$key]);
          }
        }
      }
    }
    
$is_first_word 0;
  }

  
$search_id['image_ids'] = "";
  foreach (
$image_id_list as $key => $val) {
    
$search_id['image_ids'] .= (($search_id['image_ids'] != "") ? ", " "").$key;
  }
  unset(
$image_id_list);
}

if (
$search_new_images && $show_result == 1) {
  
$search_id['search_new_images'] = 1;
}

if (
$search_cat && $show_result == 1) {
  
$search_id['search_cat'] = $search_cat;
}

if (!empty(
$search_id)) {
  
$site_sess->set_session_var("search_id"serialize($search_id));
}

include(
ROOT_PATH.'includes/page_header.php');

$num_rows_all 0;
if (
$show_result == 1) {
  if (empty(
$search_id)) {
    if (!empty(
$session_info['search_id'])) {
      
$search_id unserialize($session_info['search_id']);
    } else {
      
$search_id unserialize($site_sess->get_session_var("search_id"));
    }
  }

  
$sql_where_query "";

  if (!empty(
$search_id['image_ids'])) {
    
$sql_where_query .= "AND i.image_id IN (".$search_id['image_ids'].") ";
  }

  if (!empty(
$search_id['user_ids'])) {
    
$sql_where_query .= "AND i.user_id IN (".$search_id['user_ids'].") ";
  }

  if (!empty(
$search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    
$new_cutoff time() - 60 60 24 $config['new_cutoff'];
    
$sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

  if (!empty(
$search_id['search_cat']) && $search_id['search_cat'] != 0) {
    
$cat_id_sql 0;
    if (
check_permission("auth_viewcat"$search_id['search_cat'])) {
      
$sub_cat_ids get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
      
$cat_id_sql .= ", ".$search_id['search_cat'];
      if (!empty(
$sub_cat_ids[$search_id['search_cat']])) {
        foreach (
$sub_cat_ids[$search_id['search_cat']] as $val) {
          if (
check_permission("auth_viewcat"$val)) {
            
$cat_id_sql .= ", ".$val;
          }
        }
      }
    }
    
$cat_id_sql $cat_id_sql !== "AND i.cat_id IN ($cat_id_sql)" "";
  }
  else {
    
$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");
    
$cat_id_sql $cat_id_sql !== "AND i.cat_id NOT IN (".$cat_id_sql.")" "";
  }

  if (!empty(
$sql_where_query)) {
    
$sql "SELECT COUNT(*) AS num_rows_all
            FROM "
.IMAGES_TABLE." i
            WHERE i.image_active = 1 
$sql_where_query
            
$cat_id_sql";
    
$row $site_db->query_firstrow($sql);
    
$num_rows_all $row['num_rows_all'];
  }
}

if (!
$num_rows_all && $show_result == 1)  {
  
$msg preg_replace("/".$site_template->start."search_keywords".$site_template->end."/"$search_keywords$lang['search_no_results']);
}

//-----------------------------------------------------
//--- Show Search Results -----------------------------
//-----------------------------------------------------
if ($num_rows_all && $show_result == 1)  {
  
$link_arg $site_sess->url(ROOT_PATH."search.php?show_result=1");

  include(
ROOT_PATH.'includes/paging.php');
  
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
  
$offset $getpaging->get_offset();
  
$site_template->register_vars(array(
    
"paging" => $getpaging->get_paging(),
    
"paging_stats" => $getpaging->get_paging_stats()
  ));

  
$imgtable_width ceil((intval($config['image_table_width'])) / $config['image_cells']);
  if ((
substr($config['image_table_width'], -1)) == "%") {
    
$imgtable_width .= "%";
  }

  
$additional_sql "";
  if (!empty(
$additional_image_fields)) {
    foreach (
$additional_image_fields as $key => $val) {
      
$additional_sql .= ", i.".$key;
    }
  }

  
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
          FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
          WHERE i.image_active = 1
          
$sql_where_query
          AND c.cat_id = i.cat_id 
$cat_id_sql
          ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
          LIMIT 
$offset$perpage";
  
$result $site_db->query($sql);

  
$thumbnails "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";

  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
    
show_image($image_row"search");
    
$thumbnails .= $site_template->parse_template("thumbnail_bit");
    
$thumbnails .= "\n</td>\n";
    
$count++;
    if (
$count == $config['image_cells']) {
      
$thumbnails .= "</tr>\n";
      
$count 0;
    }
  } 
// end while
  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover >= 1) {
      for (
$i 0$i $leftover$i++) {
        
$thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$thumbnails .= "</tr>\n";
    }
  }
  
$thumbnails .= "</table>\n";
  
$content $thumbnails;
  unset(
$thumbnails);
// end if
else {
  
$site_template->register_vars(array(
    
"search_keywords" => format_text(stripslashes($org_search_keywords), 2),
    
"search_user" => format_text(stripslashes($org_search_user), 2),
    
"lang_search_by_keyword" => $lang['search_by_keyword'],
    
"lang_search_by_username" => $lang['search_by_username'],
    
"lang_new_images_only" => $lang['new_images_only'],
    
"lang_search_terms" => $lang['search_terms'],
    
"lang_or" => $lang['or'],
    
"lang_and" => $lang['and'],
    
"lang_category" => $lang['category'],
    
"lang_search_fields" => $lang['search_fields'],
    
"lang_all_fields" => $lang['all_fields'],
    
"lang_name_only" => $lang['name_only'],
    
"lang_description_only" => $lang['description_only'],
    
"lang_keywords_only" => $lang['keywords_only'],
    
"category_dropdown" => get_category_dropdown($cat_id)
  ));

  if (!empty(
$additional_image_fields)) {
    
$additional_field_array = array();
    foreach (
$additional_image_fields as $key => $val) {
      if (isset(
$lang[$key.'_only'])) {
        
$additional_field_array['lang_'.$key.'_only'] = $lang[$key.'_only'];
      }
    }
    if (!empty(
$additional_field_array)) {
      
$site_template->register_vars($additional_field_array);
    }
  }
  
$content $site_template->parse_template("search_form");
}

//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"content" => $content,
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"lang_search" => $lang['search']
));
$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>


with 1.7.6 if you could up grade you mod instructions that would be great!
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on March 11, 2009, 01:56:36 PM
In v1.7.6 search for:
    if ($split_words[$i] == "and" || $split_words[$i] == "und" || $split_words[$i] == "or" || $split_words[$i] == "oder" || $split_words[$i] == "not") {
      $search_word_cache[$i] = ($search_terms) ? "and" : $split_words[$i];
    }
    else {
Title: Re: [MOD] Search Statistics v1.2
Post by: AntiNSA2 on March 12, 2009, 10:53:01 PM
A Very important mod.Thank you very much for giving me this info. It works great.
Title: Re: [MOD] Search Statistics v1.2
Post by: fefed22 on March 29, 2009, 05:06:43 PM
hello with this mod i have an error

i have make the last change for the 1.7.6

Code: [Select]
Notice: Undefined variable: who in C:\xampp\htdocs\4images\search.php on line 83

Notice: Undefined variable: who in C:\xampp\htdocs\4images\search.php on line 83

DB Error: Bad SQL Query: UPDATE 4images_search_stats SET count = count + 1, word = 1, date = 1238338945, = + 1 WHERE text LIKE 'chien' AND word = 1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= + 1 WHERE text LIKE 'chien' AND word = 1' at line 2
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on March 30, 2009, 03:30:31 AM
Hello and welcome to 4images forum.

You must have made a mistake in step 1.
Title: Re: [MOD] Search Statistics v1.2
Post by: stdio on April 09, 2010, 03:47:48 AM
Hi V@no.

In v1.7.6 search for:
    if ($split_words[$i] == "and" || $split_words[$i] == "und" || $split_words[$i] == "or" || $split_words[$i] == "oder" || $split_words[$i] == "not") {
      $search_word_cache[$i] = ($search_terms) ? "and" : $split_words[$i];
    }
    else {
Does this mod work with the latest version of 4images? I tried to install it but I can't find the code in step 1.2. I know you posted a fix for version 1.7.6. Does this also apply for 1.7.7? Please advise.

Thank you.
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 09, 2010, 03:55:59 AM
yes, it seems in v1.7.7 is the same as in 1.7.6
does it work? - I don't know...you tell us ;)
Title: Re: [MOD] Search Statistics v1.2
Post by: stdio on April 09, 2010, 04:02:35 AM
In step 1.3 this code:

Code: [Select]
"search_keywords" => htmlspecialchars(stripslashes($org_search_keywords)),does not exist in search.php, instead THIS exists in search.php:
   
Code: [Select]
"search_keywords" => format_text(stripslashes($org_search_keywords), 2),is it the same? Should I add it after that?

Thanks!
Title: Re: [MOD] Search Statistics v1.2
Post by: V@no on April 09, 2010, 06:38:22 AM
yes
you should install [MOD] Search Statistics v1.5 | Works with 1.7.2 - 1.7.4 (http://www.4homepages.de/forum/index.php?topic=6033.msg95419#msg95419) instead.