Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: husmen73 (Gulhin) on July 24, 2008, 03:02:17 PM

Title: Search Logs
Post by: husmen73 (Gulhin) on July 24, 2008, 03:02:17 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1291)

This mod written by husmen73 and [Sinan]

search logs will log searching words on your web site

(http://www.simplemachines.org/community/index.php?action=dlattach;topic=251428.0;attach=62453)
Title: Re: Search Logs
Post by: BuЯЯЯЯaK on July 24, 2008, 03:21:14 PM
Thanx hüsmen =)

Very nice :)
Title: Re: Search Logs
Post by: Apllicmz on July 24, 2008, 04:33:32 PM
good work
ncie mod
Title: Re: Search Logs
Post by: ApplianceJunk on July 24, 2008, 07:55:17 PM
Hi,

Were does it log the words?
What changes does this mod make to the forum?

Title: Re: Search Logs
Post by: ApplianceJunk on July 24, 2008, 08:33:46 PM
Ok, I download it and when I go to install the only error I get is this one.

QuoteExecute Modification    ./Sources/Subs.php    Test failed

I'm running SMF 1.1.5 and using dilbert theme.
I'm guessing that the ./Sources/Subs.php has nothing to do with any theme.

I run the manual instructions and see it say's to find this part in ./Sources/Subs.php

Quote// Set up the menu privileges.
   $context['allow_search'] = allowedTo('search_posts');
   $context['allow_admin'] = allowedTo(array('admin_forum', 'manage_boards', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_attachments', 'manage_smileys'));
   $context['allow_edit_profile'] = !$user_info['is_guest'] && allowedTo(array('profile_view_own', 'profile_view_any', 'profile_identity_own', 'profile_identity_any', 'profile_extra_own', 'profile_extra_any', 'profile_remove_own', 'profile_remove_any', 'moderate_forum', 'manage_membergroups'));
   $context['allow_memberlist'] = allowedTo('view_mlist');

Would I be correct is saying that I get the above error because it can not find that code in ./Sources/Subs.php and the reason it can not find it is because ./Sources/Subs.php has already been changed by some other mod I have installed?

What options do I have here to install this mod?

I have attatched my ./Sources/Subs.php if it's of any help.

Thanks,
Title: Re: Search Logs
Post by: qtime on July 25, 2008, 03:40:24 AM
Quote from: ApplianceJunk on July 24, 2008, 07:55:17 PM
Hi,

Were does it log the words?
What changes does this mod make to the forum?


yes like to know where the log words can be viewed
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on July 25, 2008, 06:24:29 AM
Quote from: ApplianceJunk on July 24, 2008, 08:33:46 PM
Ok, I download it and when I go to install the only error I get is this one.
Find;
$context['allow_memberlist'] = allowedTo('view_mlist');
Replace with;
$context['allow_memberlist'] = allowedTo('view_mlist');
$context['allow_searchlog'] = allowedTo('searchlog');

Installation after you should give permissions to other members see
Title: Re: Search Logs
Post by: Minare on July 25, 2008, 07:09:28 AM
Congrats Aslanbac and Sinan

it seems like u will do great mods ;)
Title: Re: Search Logs
Post by: Kimmie on July 25, 2008, 08:07:20 PM
Where does it log the words?
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on July 26, 2008, 03:20:52 AM
Quote from: Kimmie on July 25, 2008, 08:07:20 PM
Where does it log the words?
on database
Title: Re: Search Logs
Post by: Kimmie on July 26, 2008, 03:39:58 AM
Quote from: Aslanbac (husmen73) on July 26, 2008, 03:20:52 AM
Quote from: Kimmie on July 25, 2008, 08:07:20 PM
Where does it log the words?
on database

I know that...lol What I meant was, where does that page show up on the forum? The screenshot you have on the mod page really doesnt show much. Is this an Admin page, is this a page that you see when you click on a menu button, is it on the stats page?
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on July 26, 2008, 03:45:57 AM
showing on the menu

link - index.php?action=searchlog
Title: Re: Search Logs
Post by: Kimmie on July 26, 2008, 04:57:14 PM
Quote from: Aslanbac (husmen73) on July 26, 2008, 03:45:57 AM
showing on the menu

link - index.php?action=searchlog

Thanks :)
Title: Re: Search Logs
Post by: Alpay on July 31, 2008, 02:06:40 AM
Thanks husmen73 and [Sinan] , good job.
Title: Re: Search Logs
Post by: edi67 on August 01, 2008, 03:33:34 AM
very nice, i hope will be done for smf 2.0 i cannot wait
thx
Title: Re: Search Logs
Post by: Minare on August 01, 2008, 04:56:54 AM
By the way, this is a google mania mod, google indexes all searched logs  :D
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 01, 2008, 08:31:07 AM
Quote from: edi67 on August 01, 2008, 03:33:34 AM
very nice, i hope will be done for smf 2.0 i cannot wait
thx
We will wait core package for 2.0
Title: Re: Search Logs
Post by: ArkServer on August 02, 2008, 08:08:04 AM
is it possible to make it work on 1.1.2 ? i've tried it manually but failed. it's for my site here http://www.engineeringserver.com/forum/
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 02, 2008, 10:22:13 AM
Quote from: ArkServer on August 02, 2008, 08:08:04 AM
is it possible to make it work on 1.1.2 ? i've tried it manually but failed. it's for my site here http://www.engineeringserver.com/forum/
You absolutely update to 1.1.5
SMF 1.1.2 have some security issues
Title: Re: Search Logs
Post by: ArkServer on August 05, 2008, 07:57:20 AM
Thanks i've taken yoru advice but when i install it it's succesful but when i click http://www.engineeringserver.com/forum/index.php?action=searchlog nothing shows up with the default and custom theme.
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 05, 2008, 01:54:27 PM
Did you search something on your site?
Title: Re: Search Logs
Post by: ArkServer on August 05, 2008, 04:24:26 PM
Quote from: Aslanbac (husmen73) on August 05, 2008, 01:54:27 PM
Did you search something on your site?

No but i figured out what the problem was, it didn't create the database tables for me so i had it done manually.  ;D
Title: Re: Search Logs
Post by: Sudhakar Arjunan on August 14, 2008, 04:54:31 PM
Hi I look my error log every day and get this error stored for many time an hour.


http://forum.itacumens.com/index.php?action=search2;params=YWR2YW5jZWR8J3wwfCJ8YnJkfCd8MTIsMTUsMjMsNjgsNzAsMzAsNDUsMzEsMzIsMzMsMTksMzUsMzYsMzcsMzgsMzQsNjcsNjYsMTYsNDksNTAsNzYsNTYsNTEsNTIsNTMsNTQsNTUsNjEsNzEsNzIsMTcsMjgsNzMsMzksMTQsNDAsNDEsMjksNDIsNDMsNzQsNDQsMjAsMjEsMjIsNjksNDgsNTcsMjcsMjQsMjUsNzUsNjAsNjMsNjQsNjUsNjIsMjYsNTksMTgsNDYsNDcsMTMsNTh8InxzaG93X2NvbXBsZXRlfCd8fCJ8c3ViamVjdF9vbmx5fCd8fCJ8c29ydHwnfHJlbGV2YW5jZXwifHNvcnRfZGlyfCd8ZGVzY3wifHNlYXJjaHwnfEJQTyBDT01QQU5ZIENIRU5OQUk=;start=120
Apply Filter: Only show the errors with the same message
8: Undefined index: searchlog_invalid_word
File: /home/itacumen/public_html/forum/Sources/Errors.php
Line: 337


Kindly have a check and help me to avoid this time of search error from users side.
Title: Re: Search Logs
Post by: Sudhakar Arjunan on August 14, 2008, 04:55:10 PM
Quote from: karlbenson on August 14, 2008, 10:05:46 AM
The search query isn't too big. It has been converted to base64.

The cause of the issue is due to a missing language string $txt['searchlog_invalid_word'] is being called in Errors.php
But that language string appears to be missing from whatever language set you are using.

Could anyone figure the error out.
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 15, 2008, 04:41:19 AM
Please add it into your Modifications.english.php file

$txt['searchlog_invalid_word'] = 'You haven\'t search anything, please write something';
Title: Re: Search Logs
Post by: Sudhakar Arjunan on August 15, 2008, 06:16:21 AM
Thanks for it.

Hope the error is no more.

Good Mod and very Useful for administrators to read what the users are searching for.

Great Mod Once.
Title: Re: Search Logs
Post by: ディン1031 on August 15, 2008, 10:12:40 AM
Theres a bug in the mod a huge one ;) you can never open a second page at the moment *g*

You use $_REQUEST['search'] to check of something search but this is not correct you should use $search_params['search'], because if you go to the second page the $_REQUEST['search'] does not exist any more.

Search in the Search.php for

createSearchLog($_REQUEST['search'], ( db_affected_rows($request) ? 1 : 0 ));
replace it with
createSearchLog($search_params['search'], ( db_affected_rows($request) ? 1 : 0 ));

Than it should fix the problem ;).



And i little thing to make it more comfortable :D

<file name="$languagedir/ManagePermissions.turkish.php">
<operation>
<search position="end" error="skip" />


it's better to use

<file name="$languagedir/ManagePermissions.turkish.php" error="skip">
<operation>
<search position="end" />


The difference is that now if the file not exists he will skip this file, and i think that is what you want to do =).

Hope i could help you to make you mod better =)

Bye
DIN1031

Title: Re: Search Logs
Post by: Sudhakar Arjunan on August 15, 2008, 10:33:28 AM
Quote from: ディン1031 on August 15, 2008, 10:12:40 AM
Theres a bug in the mod a huge one ;) you can never open a second page at the moment *g*

You use $_REQUEST['search'] to check of something search but this is not correct you should use $search_params['search'], because if you go to the second page the $_REQUEST['search'] does not exist any more.

Search in the Search.php for

createSearchLog($_REQUEST['search'], ( db_affected_rows($request) ? 1 : 0 ));
replace it with
createSearchLog($search_params['search'], ( db_affected_rows($request) ? 1 : 0 ));

Than it should fix the problem ;).

Thanks for this bug ディン1031.
I have updated the mod in my forum.
Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 15, 2008, 01:10:45 PM
Thank you ディン1031, I have updated it on ModSite
Title: Re: Search Logs
Post by: xrunner on August 15, 2008, 06:23:56 PM
I got the latest version and no search log tab ever showed up at the top, even after searching.

:-\
Title: Re: Search Logs
Post by: Sudhakar Arjunan on August 15, 2008, 11:33:19 PM
Hi Currently it started showing all the logs.

This would be good , Shows the number of counts like.

1st time user searched for books.
2nd time user searched for books.

Shows like books, books.

Instead could you make books(2).

And if started going more than 100 pages in search log. Wil it be a problem for loading search page everytime.
Title: Re: Search Logs
Post by: [SiNaN] on August 16, 2008, 11:04:31 PM
xrunner:

Are you using a custom theme? If yes, you should make the theme file edits manually on your custom theme too.

asudhakar:

Not a bad idea actually, but I knew that it worked like that. Anyway, I'll check it again.

It wont be a problem if it reaches 100 pages; but if you like, you can delete old logs from admin panel. You can define the day and logs, before that day are deleted.
Title: Re: Search Logs
Post by: xrunner on August 17, 2008, 08:25:26 AM
Quote from: [SiNaN] on August 16, 2008, 11:04:31 PM

Are you using a custom theme? If yes, you should make the theme file edits manually on your custom theme too.

No, it's the default theme. The installation script reported no errors when installing either.

Title: Re: Search Logs
Post by: husmen73 (Gulhin) on August 17, 2008, 12:07:18 PM
Quote from: xrunner on August 17, 2008, 08:25:26 AM
No, it's the default theme. The installation script reported no errors when installing either.
Can you see SearchLog menu item on Search menu on Admin panel
Title: Re: Search Logs
Post by: Basie on August 17, 2008, 12:57:48 PM
Quote10.     Execute Modification     ./Sources/Subs.php     Test failed

:(
Title: Re: Search Logs
Post by: [SiNaN] on August 17, 2008, 02:13:36 PM
xrunner:

What's your default language?

Basie:

We just have a one line addition in Subs.php, which you can make manually:

Subs.php

Find:

    $context['allow_memberlist'] = allowedTo('view_mlist');

Replace:

    $context['allow_memberlist'] = allowedTo('view_mlist');
    $context['allow_searchlog'] = allowedTo('searchlog');
Title: Re: Search Logs
Post by: Ni©holąś™ on August 17, 2008, 02:15:33 PM
good job!
Title: Re: Search Logs
Post by: xrunner on August 18, 2008, 07:28:03 AM
Quote from: Aslanbac (husmen73) on August 17, 2008, 12:07:18 PM
Quote from: xrunner on August 17, 2008, 08:25:26 AM
No, it's the default theme. The installation script reported no errors when installing either.
Can you see SearchLog menu item on Search menu on Admin panel

No. My default language is English
Title: Re: Search Logs
Post by: [SiNaN] on August 18, 2008, 07:31:42 AM
Is it utf-8? Can you attach your Modifications.english.php file here so that we can check it?
Title: Re: Search Logs
Post by: xrunner on August 18, 2008, 07:37:17 AM
Quote from: [SiNaN] on August 18, 2008, 07:31:42 AM
Is it utf-8? Can you attach your Modifications.english.php file here so that we can check it?

You mean before or after the installation of the mod? It's not installed now because it wasn't working.
Title: Re: Search Logs
Post by: [SiNaN] on August 18, 2008, 07:41:33 AM
I meant after. Can you try installing it again and attach your Modifications.english.php file here?
Title: Re: Search Logs
Post by: xrunner on August 18, 2008, 07:42:05 AM
Quote from: [SiNaN] on August 18, 2008, 07:41:33 AM
I meant after. Can you try installing it again and attach your Modifications.english.php file here?

I'm off to work, I'll have to do it later, thanks.
Title: Re: Search Logs
Post by: [SiNaN] on August 18, 2008, 08:04:17 AM
Okay, when you have time. ;)
Title: Re: Search Logs
Post by: xrunner on August 18, 2008, 07:42:52 PM
Now I get two errors -

7.     Execute Modification     ./Sources/ManagePermissions.php     Test failed
13.     Execute Modification     ./Themes/default/index.template.php     Test failed

Title: Re: Search Logs
Post by: Minare on August 19, 2008, 01:52:19 AM
@xrunner

continue with installation and :

open and find this in Sources/ManagePermissions.php :

'who_view' => false,
'search_posts' => false,


Replace with :


'search_posts' => false,
'searchlog' => false,
'delete_searchlog' => false,


then, open and find this in index.template.php :

// Edit Profile... [profile]

replace with :

// Search Logs Page
if(!empty($modSettings['searchlog_enable']) && $context['allow_searchlog'])
echo ($current_action == 'searchlog' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'searchlog' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=searchlog">' , $txt['searchlog_menu'] , '</a>
</td>' , $current_action == 'searchlog' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Edit Profile... [profile]


if you are using a different theme, u better put its index.temp file here and we check

good luck
Title: Re: Search Logs
Post by: timned88 on August 25, 2008, 09:15:38 PM
i installed this mode and i am getting the following error message:
Fatal error: Function name must be a string in /home/themagi2/public_html/forum/Sources/Search.php on line 1869

line 1869 =       $word = $funcx['htmlspecialchars'](stripslashes($word), ENT_QUOTES)

when i set up the site, i had to change $func to $funcx so it would play nice with joomla.  any idea what else is going wrong?
Title: Re: Search Logs
Post by: [SiNaN] on August 26, 2008, 04:01:04 AM
After making it $func, do you still get error?
Title: Re: Search Logs
Post by: timned88 on August 26, 2008, 05:02:19 AM
yes,  that didnt work either. 
Title: Re: Search Logs
Post by: [SiNaN] on August 26, 2008, 05:12:15 AM
I didn't understand the relation with Joomla? It should be $func.
Title: Re: Search Logs
Post by: timned88 on August 26, 2008, 05:23:24 AM
joomla also uses $func and when i tried to run SMF within a joomla wrapper i had some problems.
Title: Re: Search Logs
Post by: [SiNaN] on August 26, 2008, 09:51:01 AM
$func variable has many uses in SMF. Don't you get errors on other pages?