PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Mod Requests (http://www.phpdig.net/forum/forumdisplay.php?f=23)
-   -   phpnuke integration (http://www.phpdig.net/forum/showthread.php?t=901)

InvalidResponse 05-31-2004 02:57 PM

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&amp;query_string=".urlencode($my_query_strin g_link)."&amp;site=".$content['site_id']."&amp;limite=$limite&amp;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&amp;file=search&amp;refine=1&amp;q uery_string=".urlencode($my_query_string_link)."&amp;site=".$content['site_id']."&amp;limite=$limite&amp;option=$option'>".$content['site_url']."</a>";

-----------------------

then find this line:
$l_path = ", ".phpdigMsg('this_path')." : <a class='phpdig' href='".SEARCH_PAGE."?refine=1&amp;query_string=".urlencode($my_query_strin g_link)."&amp;site=".$content['site_id']."&amp;path=".$content['path']."&amp;limite=$limite&amp;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&amp;file=search&amp;refine=1&amp;q uery_string=".urlencode($my_query_string_link)."&amp;site=".$content['site_id']."&amp;path=".$content['path']."&amp;limite=$limite&amp;option=$option' >".ereg_replace('%20*',' ',$content['path'])."</a>";

------------------------

then find this line:
$url_bar = SEARCH_PAGE."?browse=1&amp;query_string=".urlencode($my_query_string_link). "$refine_url&amp;limite=$limite&amp;option=$option&amp;lim_start=";

and replace (or comment it out) with:
$url_bar = "modules.php?op=modload&name=phpdig&amp;file=search&amp;browse=1&amp;query_ string=".urlencode($my_query_string_link)."$refine_url&amp;limite=$limite&a mp;option=$option&amp;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 :D

..I'll check back to see if there are any problems.

enjoy.
-IR

synnalagma 06-03-2004 02:37 AM

I have done what you're suggesting but for e-xoops and xoops (wich are fork of phpnuke I think).

It's a kind of entire rewritting, some things are missing, see post about optimization

There's no problem for me to send you the code... (it's under GPL).

ChadK 06-03-2004 01:12 PM

Great work for Postnuke but we were actually concerned with PHP-Nuke ;)

ChadK 06-03-2004 01:29 PM

Hey InvalidResponse, that seems to work great! :)

InvalidResponse 06-03-2004 08:08 PM

...good to hear Chad.. it's a temporary workaround, but will work fine for the time being..

Xoops on the other hand is Object Oriented.. I'm not very familiar with the architecture, but it would take some tweeking (inclusion of classes..etc.).. Xoops and pn are both the offspring of PhpNuke, but neither maintain much of the original code.. I've been meaning to do an install of Xoops.. they've really grown a lot since my last preview.. even then it was an incredible project.

take care guys..
-IR

ChadK 06-10-2004 06:28 PM

My only bit of confusion InvalidResponse is how do I admin the php-nuke module version?
I want to change things like showing the summary and snippets but can't figure out how to get the admin mode of the module version... ;)

InvalidResponse 06-11-2004 12:31 PM

..hi Chad.. I didn't do any integration for the admin area.. I just wanted to wrap the search results.. so you would need to access the admin area as a stand-alone:
http://www.yoursitename.com/modules/phpdig/admin

-IR


All times are GMT -8. The time now is 08:42 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.