install PhpDig in ../modules/phpdig
..this hack works with PostNuke.. PHPNuke's URL's vary slightly.. make sure you match them appropriately..
..I used a nuke_dig_ prefix for the tables.. it'll make it easier to further integrate into the core of your CMS.
back-up your files first
my index.php:
++++++++++++++++++++++++++
<?php
if (!eregi("modules.php", $PHP_SELF)){// || $_SERVER['REQUEST_METHOD'] != "POST") {
die ("You can't access this file directly...");
}
include ('header.php');
$relative_script_path = 'modules/phpdig';
if (is_file("$relative_script_path/includes/config.php")) {
include "$relative_script_path/includes/config.php";
}
else {
die("Cannot find config.php file.\n");
}
if (is_file("$relative_script_path/libs/search_function.php")) {
include "$relative_script_path/libs/search_function.php";
}
else {
die("Cannot find search_function.php file.\n");
}
// extract vars
extract(phpdigHttpVars(
array('query_string'=>'string',
'refine'=>'integer',
'refine_url'=>'string',
'site'=>'integer',
'limite'=>'integer',
'option'=>'string',
'lim_start'=>'integer',
'browse'=>'integer',
'path'=>'string'
)
));
$template = "$relative_script_path/templates/grey.html";
phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse,
$site, $path, $relative_script_path, $template);
include 'footer.php';
?>
========================
we're using the grey template for this example, but you can use any one you please.
========================
My search.php:
++++++++++++++++++++++++++
<?php
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
include ('header.php');
$relative_script_path = 'modules/phpdig';
if (is_file("$relative_script_path/includes/config.php")) {
include "$relative_script_path/includes/config.php";
}
else {
die("Cannot find config.php file.\n");
}
if (is_file("$relative_script_path/libs/search_function.php")) {
include "$relative_script_path/libs/search_function.php";
}
else {
die("Cannot find search_function.php file.\n");
}
// extract vars
extract(phpdigHttpVars(
array('query_string'=>'string',
'refine'=>'integer',
'refine_url'=>'string',
'site'=>'integer',
'limite'=>'integer',
'option'=>'string',
'lim_start'=>'integer',
'browse'=>'integer',
'path'=>'string'
)
));
$template = "$relative_script_path/templates/grey.html";
phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse,
$site, $path, $relative_script_path, $template);
include 'footer.php';
?>
========================
Open ../modules/phpdig/templates/grey.html
+++++++++++++++++++++++++++++
remove <phpdig:form_head/>
find this line:
==============
<div align="center"><b><phpdig:form_title/></b></div>
enter this:
<div align="center"><b><phpdig:form_title/></b></div>
<table width="100%" align="center">
<tr>
<td align="left" width="69%">
<div align="center"><b>
<form action='modules.php' method='post'> <!-- NOTICE THE POST METHOD.. YOU MAY OPT TO USE GET -->
<input type='hidden' name='op' value='modload'/>
<input type='hidden' name='name' value='phpdig'/>
<input type='hidden' name='file' value='search'/>
<input type='hidden' name='site' value='0'/>
<input type='hidden' name='path' value=''/>
<input type='hidden' name='result_page' value='modules/phpdig/search.php'/>
<input type='text' class='phpdiginputtext' size='15' maxlength='50' name='query_string' value=''/>
<input type='submit' class='phpdiginputsubmit' name='search' value='Go...'/>
<input type='hidden' name='limite' class='phpdigselect' value='10'>
===============
the above replaces:
<phpdig:form_field/><phpdig:form_button/>
================
the image path in the template needs to be changed too:
IE: background="modules/phpdig/tpl_img/g.gif">
================
Open ../modules/phpdig/includes/config.php
++++++++++++++++++++++++++
at the top:
if ((isset($relative_script_path)) && ($relative_script_path != ".") && ($relative_script_path != "..") &&
($relative_script_path != "modules/phpdig")) {
__exit();
}
===============
comment out the template variable:
//$template = "$relative_script_path/templates/phpdig.html";
=====================================
Open ../modules/phpdig/libs/search_function.php
+++++++++++++++++++++
find this line:
$l_site = "<a class='phpdig' href='".SEARCH_PAGE."?refine=1&query_string=".urlencode($my_query_strin g_link)."&site=".$content['site_id']."&limite=$limite&option=$option'>".$content['site_url']."</a>";
replace it (or comment it out) and add this:
$l_site = "<a class='phpdig' href='modules.php?op=modload&name=phpdig&file=search&refine=1&q uery_string=".urlencode($my_query_string_link)."&site=".$content['site_id']."&limite=$limite&option=$option'>".$content['site_url']."</a>";
-----------------------
then find this line:
$l_path = ", ".phpdigMsg('this_path')." : <a class='phpdig' href='".SEARCH_PAGE."?refine=1&query_string=".urlencode($my_query_strin g_link)."&site=".$content['site_id']."&path=".$content['path']."&limite=$limite&option=$option' >".ereg_replace('%20*',' ',$content['path'])."</a>";
and replace (or comment it out) with this line:
$l_path = ", ".phpdigMsg('this_path')." : <a class='phpdig' href='modules.php?op=modload&name=phpdig&file=search&refine=1&q uery_string=".urlencode($my_query_string_link)."&site=".$content['site_id']."&path=".$content['path']."&limite=$limite&option=$option' >".ereg_replace('%20*',' ',$content['path'])."</a>";
------------------------
then find this line:
$url_bar = SEARCH_PAGE."?browse=1&query_string=".urlencode($my_query_string_link). "$refine_url&limite=$limite&option=$option&lim_start=";
and replace (or comment it out) with:
$url_bar = "modules.php?op=modload&name=phpdig&file=search&browse=1&query_ string=".urlencode($my_query_string_link)."$refine_url&limite=$limite&a mp;option=$option&lim_start=";
==========================
..I think that's the jist of it..hope it is anyway..
administer as a standalone.. it should work fine for the time being..I'd wait until it matures some before porting it..
a great, great product.. I was looking for something to spider my site for broken links, but got side-tracked
..I'll check back to see if there are any problems.
enjoy.
-IR