PDA

View Full Version : phpnuke integration


snorkpants
05-04-2004, 07:38 AM
Hi,
Has anyone converted phpdig to reside as a module in phpnuke?

I would be interested if anyone has tried. I can't seem to get it working yet as it doesn't want to find the config file.

Any thoughts??


Thanks

Snorkpants.

circusnews
05-09-2004, 12:10 PM
I am looking to do exactly the same thing. Can you share with me what you have done so far?

snorkpants
05-09-2004, 12:42 PM
I have replied to your email too... Of course I'll share what I have done already.. although it's not a lot since I seem to have got a bit stuck. perhaps we can help each other out on it.

I'll pack the source up asap andlet you know

Regards,

Snorkx

circusnews
05-09-2004, 03:42 PM
I sent this via email as well. I have not started real work on the PHPNuke module yet, but I have done work on a number of other modules, and have dealt with this problem before. Causes vary, but when I get what you've done so far I can see if I can track down the cause. If not, I will try to use the aproach used by the folks over at TNG and create a glue layer between the two. We will make it work, of that I am sure.

----------------------------------------------------------------------------
Steven Santos

Email : Steven@StevenSantos.com
Web : www.CircusNews.com
Postal: PO Box 620753
Newton, Ma. 02462

ChadK
05-21-2004, 08:14 PM
So.. anyone get this working?

circusnews
05-21-2004, 08:35 PM
No, life has gotten in the way. I have blocked out some time to work on it next weekend, will post my results as I go.

snorkpants
05-22-2004, 05:37 AM
same here... had loads of work to do on other projects but will get back to it asasp.. main probs I'm having atm are that there are global vars going missing.

Will try to post summit soon.

circusnews
05-22-2004, 01:12 PM
Thats usually just missing or incorect include statements. If thats your biggest problem, then thats easy to fix. Mine has been mapping PHPDig vars to PHPNuke equivelents. If you have that solved, then you are several steps ahead of me.

ChadK
05-28-2004, 11:49 AM
Let us know when you get time to finish this :)

circusnews
05-28-2004, 12:03 PM
Or you could trow in and help with the development. Just a thought.

ChadK
05-28-2004, 08:29 PM
I'd love to but I'm an ASP guy.. I'd only screw up the PHP if I tried.. :(

I suppose if there's a specific piece that isn't working I could debug that but I'm not sure I'm ready to tackle the whole thing yet. I could assist.. but not sure how much help I'd be. Anyone have a project set up anywhere for this?

circusnews
05-29-2004, 09:13 AM
Nope, no project for it yet - but feel free to start one. At this point I am thinking that this is going to be a %50 rewrite of PHPDig to get it to work. And if I am going to go that far, I may as well make the whole thing work better.

Here are my thoughts on this:

- Database Abstraction

- APIs

- Seperate out PHPDig in to Nuke mods:

-- Crawler

-- Search Engine

-- Search interface/API

===========================================
Abstraction Layer.
One of the things that bugs me about PHPDig is that it only works with MySQL. If we are porting this to Nuke, lets take advantage of the database abstraction layer in Nuke.

===========================================
API Abstraction Layer.
The more I think about it, the more I don't like the idea of trying to map PHPDig VARS to Nuke equivs. It's messy and problematic. Given the modular nature of the PHPDig code, if we are going to do this, lets do a rewrite with Nuke API's, and then rebuild a standalone option as well.

===========================================
Modules.
The more I think about this, the more I think that it makes good design sence to have the crawler and search engine as seperate modules. By doing this, we also make it possible for others to develop additional add-ons to this system that we have not yet thought of.

===========================================
Modules - The Crawler
PHPNuke has a lot of modules that would seem to act as natural starting places for the crawler to start (web links, news story links, etc), and more modules that are developed all the time. By seperating out the crawler, and providing a place to plug in, we can have the crawler automaticaly crawl these things (as set by admin)

===========================================
Modules - The Search Engine
The search engine itself should be as modular as possible. Thankfuly, PHPDig is very modular.

As we do this, lets remember that PHPNuke already has a seach engine used for the site itself. While well intentioned, I hate it. It does however, have a lot of things we can learn from it

1. Searching the existing tables, and linking to the proper module search feature. While a big part of me does not like how this works, its a lot better than having PHPDig reindex the whole site. What I would really like is a method of allowing you to choose (via drop down menu) what index you want to search. I know it will get more complex than that, but so be it.

2. Off site searching. Lets continue to make it real easy for other site to include a seach bar.

Other thoughts?

InvalidResponse
05-30-2004, 09:48 PM
..hi.

I've got it wrapped for PostNuke using the older method of coding.. more similar to phpNuke.. I will put together some documentation if you guys are interested.. it should fold right into phpNuke..

..I only wrapped an index & search page.. so you'll need to administer it in the same way..

..let me know.
-IR

circusnews
05-31-2004, 05:45 AM
I would love to see what you've done! My project will take more than a few weeks, and having something that just works now may be enough for my needs anyways.

InvalidResponse
05-31-2004, 02:10 PM
..sure thing..

I'll try to document it as easy as possible.. I was trying to go around the API, but found in some cases it was easier to mod it.

I also used a "post" method instead of "get" to hide the variables.. but you can opt to "get" them.

inclusion if the config.php file works fine for the UI (user interface), modularizing extends the core, so it doesn't mind.. the admin interface, won't cooperate being seperated from the core as it is..

it's a really cool little app.. v1.8.1 shows definite promise.

I thought I'd rewrite it into pnAPI compliance using smarty templating..but in comparing 1.8.0 and 1.8.1 I'm seeing some massive leaps in progress.

I'll type something up ASAP..

you can preview it @ http://www.mashdeco.com/phpdig.html

thanks..take care!
-IR

InvalidResponse
05-31-2004, 03: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_string_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;query_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_string_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;query_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&amp;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, 03: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, 02:12 PM
Great work for Postnuke but we were actually concerned with PHP-Nuke ;)

ChadK
06-03-2004, 02:29 PM
Hey InvalidResponse, that seems to work great! :)

InvalidResponse
06-03-2004, 09: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, 07: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, 01: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