angelovirgus
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Aug 14, 2006
Posts: 4
|
Posted:
Mon Aug 14, 2006 4:06 am |
|
Hi,
i'm new in this forum and i'm italian...so, sorry for my bad english. I've a phpnuke raven76 and i'm interested to install the block manager to customize
and personalize my modules with different blocks.
Following the install guide of block manager i have to:
Quote: |
- Search for $side = $pos; in the "function blocks($side) file from the file mainfile.php
- Erase or hide the following lines helping yourself with
for example (phpnuke v7.x) : // $sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subscription FROM ".$prefix."_blocks WHERE bposition='$pos' AND active='1' $querylang ORDER BY weight ASC";
for example (phpnuke v6.x) : // $sql = "SELECT bid, bkey, title, content, url, blockfile, view FROM ".$prefix."_blocks WHERE bposition='$pos' AND active='1' $querylang ORDER BY weight ASC";
- Insert the following lines :
phpnuke v6.x
if (strlen($name) != 0) {
$name = str_replace(' ','_',$name);
$name = str_replace('%20','_',$name);
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$name' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
} else {
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='admin' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
}
phpnuke v7.x
if (strlen($name) != 0) {
$name = str_replace(' ','_',$name);
$name = str_replace('%20','_',$name);
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$name' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
} else {
$sql = "SELECT b.bid, b.bkey, b.title, b.content, b.url, b.blockfile, b.view, b.expire, b.action, b.subscription FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='admin' AND m.bposition='$pos' AND b.active='1' $querylang ORDER BY m.weight ASC";
} |
but in my mainfile.php i haven't this line: Code:$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subscription FROM ".$prefix."_blocks WHERE bposition='$pos' AND active='1' $querylang ORDER BY weight ASC";
|
instead in "$side = $pos; in the "function blocks($side)" i've these lines:
Code:$result = $db->sql_query("SELECT * FROM ".$prefix."_blocks WHERE bposition='$pos' AND active='1' $querylang ORDER BY weight ASC");
while($row = $db->sql_fetchrow($result)) {
$groups = $row['groups'];
$bid = intval($row['bid']);
$title = stripslashes(check_html($row['title'], "nohtml"));
$content = stripslashes($row['content']);
$url = stripslashes($row['url']);
$blockfile = $row['blockfile'];
$view = intval($row['view']);
$expire = intval($row['expire']);
$action = $row['action'];
$action = substr("$action", 0,1);
$now = time();
$sub = intval($row['subscription']);
if ($sub == 0 OR ($sub == 1 AND !paid())) {
if ($expire != 0 AND $expire <= $now) {
if ($action == "d") {
$db->sql_query("UPDATE ".$prefix."_blocks SET active='0', expire='0' WHERE bid='$bid'");
return;
} elseif ($action == "r") {
$db->sql_query("DELETE FROM ".$prefix."_blocks WHERE bid='$bid'");
return;
}
}
if ($row['bkey'] == "admin") {
adminblock();
} elseif ($row['bkey'] == "userbox") {
userblock();
} elseif (empty($row['bkey'])) {
if ($view == 0) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 2 AND is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view > 3 AND in_groups($groups)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
}
}
}
}
ecc...
|
so i don't know what i've to modify. I need help, is here somebody to help me? Thanks and i hope in an your answer. |
|
|
fkelly
Former Moderator in Good Standing
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY
|
Posted:
Mon Aug 21, 2006 6:03 pm |
|
Here's what I believe is happening angelovirgus ...
The code that you are looking for in mainfile was at some point in the evolution of Nuke changed. Code: The old code, as you note was:
$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subscription FROM ".$prefix."_blocks WHERE bposition='$pos' AND active='1' $querylang ORDER BY weight ASC";
and the newer code is:
$result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');
|
I don't know if this happened on the transition to Ravennuke or at some previous version of Nuke and it really doesn't matter. The difference is that the programmer probably just figured "we are using most or all of the fields anyway so I will just do a select * rather than enumerating all the field."
Now it appears that the block manager software uses a different version of the blocks table called "prefix_blocks_manager" where prefix is whatever prefix you are using on your system, usually "nuke". I haven't used that software but it also must be the case that the software provides some kind of administrative screen for the "enhanced" blocks management that you mention.
So theoretically you could just modify the select * statement to point to the blocks_manager table and you'd be up and running. But of course there's a catch.
Ravennuke comes with Nukescripts group management facilities built in. And one of the things you can do with that is limit access to a block to groups of users. It adds a groups field to the blocks table to facilitate this and if you go into the administration screen on a Ravennuke system and edit a block you will see that you can restrict access to a group.
This is a case where the relative ease of writing add-ons for Nuke comes back to bite us. Unless I'm mistaken, if you use the block management software you will not have access to the Ravennuke groups facilities with your blocks and you may even wind up with an error. I can't tell that without testing it and I don't have time for that. This could be "cured" if the blocks management authors went back and retrofitted the groups capabilities into their software but without it you'll have problems.
I'll take Ezekiel's word that it's a useful facility and maybe the two of you could write up sort of functional specs for what you'd like to see and we can discuss adding it "natively" to some future version of Ravennuke. I apologize but I think that most of us who are involved in any way with Ravennuke and it's support just don't have the time to go plumbing around in the depths of add on products like this; no matter how useful we might recognize they might be. |
|
|