![]() |
Advanced Search (search by exact date range)
This is a very simple but powerful mod that allows you to add the option to allow users to
search by (date range) instead of just using the default limited vB options! This allows for much better control of search results, allowing for exact searches by date range! INSTALLER SUPPORTS supports : vB 3.0.3, 3.0.4, 3.0.5, 3.0.6 language : English (US) OS support: Linux/Unix/Windows (because of line endings) The installer.... 1. The installer will (install and or uninstall) this mod, with install and uninstall tester! 2. What it will install... A. Installs the Admin Panel (Advance Date Option) This allows for the administrator to configure the date range format from the Admin Panel! (dynamic control) 1/2/3 -> mm/dd/yyyy 3.2.1 -> yyyy.dd.mm 2-1-3 -> dd-mm-yyyy B. Installs a full error control handler... This gives members helpful information when a search error is encounted! C. Auto loads the language phrases! The installer checks the datastore and language groups, making sure all data to run the Advance Search is present, if not it updates the caches so the language phrases are auto loaded! D. Installs a (smart search date relevance control) The relevance control, is designed to allow each member to search for results based on their own time zone! The control also uses a cache system, so searches can be loaded into the exsiting vB search table, but are indexed by the date and not by the standard vB search control! This allows for each search to be more unique in regards to the query matching the starting and ending date range! E. Add the option to the users search pref control NOTES: Each directory contains a read_me files, giving detailed information about that install process! Other Notes! Time to install : 2 minutes! Test Installer : YES Test Uninstaller: YES Auto Installer : YES Auto Uninstaller: YES DB CHANGES : NONE SCRIPT CHANGES : 1 script 'search.php' -> adds (1) main function 'q_builder()', and replaces and adds (8) sections of code within the rest of 'search.php'! The template 'search_forums' is the only thing you must install via the Admin Panel! Images showing the control are below! Any questions, just ask! I have been overseas for a while, but I am back now, so I will always be around to help anyone needing help with installing this! Here is the step by step install, for the template and the search.php script! Also a simple DB installer for the admin panel and language phrases! EDITING and INSTALLING THE TEMPLATE go to your Admin Panel left nav -> left click -> Styles & Templates scroll down to -> Search in Templates -> left click right window -> select box -> Search in Style select the style to add this Advanced Search Option to... in the -> tex box -> Search for Text enter -> search_forums check the -> radio button -> Search Titles Only -> check -> yes click the submit button -> Find Style Manager Opens! left click on the template -> search_forums The template should now be open! Notes: Because you may have edited this template, we will search, add and replace by finding code patterns that we will add the Advanced Search Option before or after the code pattern that we are looking for... 1. ADD FIND THIS Code:
<legend>$vbphrase[find_posts_from]</legend> REPLACE WITH Code:
<legend>$vbphrase[find_posts_from]</legend> FIND THIS Code:
<option value="before" $beforeafterselected[before]>$vbphrase[and_older]</option> REPLACE WITH Code:
<option value="before" $beforeafterselected[before]>$vbphrase[and_older]</option> FIND THIS Code:
<select style="width:100%" name="forumchoice[]" size="13" multiple="multiple"> REPLACE WITH Code:
<select style="width:100%" name="forumchoice[]" size="18" multiple="multiple"> All done with the template edits! click the 'Save' button to save the changes! Go back to the Admin Panel! Now lets install the changes to 'search.php'... NOTE: Make a backup of 'search.php', NOW!!! EDITING search.php Notes: Each Find This contains line numbers for REF! open -> 'vB install folder/search.php' FIND THIS Starting @ -> line 64 Code:
64 $globalize = array( Code:
$globalize = array( FIND THIS Starting @ -> line 139 Code:
139 globalize($_REQUEST, array( Code:
globalize($_REQUEST, array( FIND THIS Starting @ -> line 163 Code:
163 $prefs = array( Code:
$prefs = array( FIND THIS @ -> line 188 Code:
188 if ($varname != 'query' AND $varname != 'searchuser') Code:
if ($varname != 'query' AND $varname != 'searchuser' AND $varname != 'eoptdate' AND $varname != 'soptdate') FIND THIS Starting @ -> line 198 Code:
198 $query = htmlspecialchars_uni($query); Code:
$query = htmlspecialchars_uni($query); FIND THIS @ -> line 395 Code:
395 $searchhash = md5(strtolower(iif($phrasequery, '"' . $query . '"', $query)) . "||" . strtolower($searchuser) . "||$exactname||$starteronly||$forumchoice||$childforums||$titleonly||$showposts||$searchdate||$beforeafter||$replyless||$replylimit||$searchthreadid"); Code:
$searchhash = md5(strtolower(iif($phrasequery, '"' . $query . '"', $query)) . "||" . strtolower($searchuser) . "||$exactname||$starteronly||$forumchoice||$childforums||$titleonly||$showposts||" . ( $find_opt > 0 ? $soptdate . chr ( 124 ) . chr ( 124 ) . $eoptdate : $searchdate . chr ( 124 ) . chr ( 124 ) . $beforeafter ) . "||$replyless||$replylimit||$searchthreadid"); FIND THIS Starting @ -> line 1101 Code:
1101 if ($searchdate != 'lastvisit') Code:
if ( $find_opt == 0 ) FIND THIS Starting @ -> line 1137 Code:
1137 unset($datecut); Code:
unset($datecut); FIND THIS Starting @ -> line 2339 Code:
2339 $prefs = addslashes(serialize(array( Code:
$prefs = addslashes(serialize(array( FIND THIS @ -> line 2403 ( the end of the 'search'php' file! Code:
2403 ?> Code:
function q_builder ( $start, $end, $ut, $tf ) ALL DONE with 'search.php'.... Save changes close 'search.php' Now copy this script and place it in the vB install directory! Then run it from your browser! http://www.site.com/install.php After delete this script! Code:
<?php After the install is done, you will find the Advance Search Control in the Admin Panel! vBulletin Options >> Date and Time Options >> at the bottom! You now have the 'Advanced Search By Date Range', installed on your forum! C, ya... Sonia |
I tried running this in my root directory and got this:
"MODIFICATION REPORT INSTALL ERROR: can not READ OR WRITE to ./search.php install has failed The above is the result of your last action, if any error is found, please report to me on the forum!" I know you mentioned that in your instructions, but how would I go about changing the permissions of the install file? Instead of an automatic install file, it would be more helpful to me to have it go through the steps like other install hacks have done. |
@fridayweb... just chmod the search.php file to 777...
btw, this installer is a real pain dear Sonya... this would be more efficient to have a text documentation with the steps of changes... because it's not working... if we even had a luck to hack our search.php file, the hack simply scrap everything, and this is not a big deal! i'll try to recover the bug... EDIT: found the problem here... when the new function was added in search.php, the installed deleted the last " } " on my file, so this messed out the entire file! |
Hi
Could you send me the search file after doing the install, when you get the error! I think it because, I do a -2 on the last change, I am going to my Unix server to test this now! Send to fataqui@ya-right.com I will also post a step by step in a few minutes! Fo those that want to do it by hand! I just ran the install and uninstall on 7 different servers, 2 Unix, 3 Linux, 2 windows, and I don't get any errors running the install or uninstall! Let me finish writing the step by step version! C, ya... Sonia |
Hi Sonya... it would be useless to send you my serach.php, as the problem is the EOF... mine was edited before!... that's all ;)
good work though! |
Thanks for the step by step! I was able to get everything done except when it came to the very last part and the new install.php.
This is the error I got: "Column count doesn't match value count at row 1" Any suggestions? |
Ok, maybe I'm missing something here...
I imported the xml per the instructions. I've installed using the installer per the instructions. The search.php shows the new options. The admincp does not show the admin menu for this mod. And if I try to search by date it will not allow it as no text was entered into the search field. (default vb option) Amy I missing something on the install? Am I missing the point of the mod altogether? I thought this mod will allow users to simply search by date and not have to enter any search "text" in. This is the functionality that we need. Thoughts? |
Nevermind! I found a better one that does what I need it to and I only have to edit 1 line of code...
https://vborg.vbsupport.ru/showthrea...ht=search+date |
This should be built into VB. Don't know why it's not.
However, got this error on install: Code:
INSTALL ERROR: can not find replace search pattern(s) -> 3, install has failed Edit: Found the source of the problem. I'm using VB 3.03, patched up to 3.07. This line: Quote:
The code is entirely different. |
Hello,
You have an error in your time array: Code:
'(0+[1-9]{1}|1+[1-2]{1})' The correct code should be: Code:
'(0+[1-9]{1}|1+[0-2]{1})' Thanks, Ronald |
All times are GMT. The time now is 10:06 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|