Author |
Message |
draxx
Involved
Joined: Nov 19, 2003
Posts: 282
|
Posted:
Sat Sep 21, 2013 12:09 am |
|
PS: FYI for those that want to know here is the SQL they used to tell me to create the table:
Code:
CREATE TABLE nuke_blocks_manager (
bid int(10) NOT NULL default '0',
title varchar(255) NOT NULL default '0',
bposition char(1) NOT NULL default '',
weight int(10) NOT NULL default '1',
KEY title (title)
) TYPE=MyISAM;
|
...note there was a whole set of files for the admin directory to order the blocks. I could not find where to upload them but I am happy to share.
Here were the instructions:
Quote: |
How to proceed :
Make a safety backup of your mainfile.php
Generate "MySQL" tables by helping yourself with your PhpMyAdmin or another SQL base manager Launch the MySQL.sql request.
Copy the WB_BlocksManager files :
blocks_manager.php to /admin/modules
case.blocks_manager.php to /admin/case
links.blocks_manager.php to /admin/links
wb_blocksmanager.gif to /images/admin/
Search for "function blocks($side) in your mainfile.php file.
Insert the "$name" inside "global" of your function blocks($side)
for example: global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user, $name;
Search for $side = $pos; in the function blocks($side) file from the file mainfile.php
Erase or hide the following lines helping yourself with
forexample : // $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";
Insert the following lines:
if (isset($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 WHERE b.bposition='$pos' AND b.active='1' $querylang ORDER BY b.weight ASC";
}
At the end of /admin/language menu, add the following lines
lang-english.txt -> lang-english.php
lang-french.txt -> lang-french.php
Caution !
Check table's prefix (*), "mysql.sql uses "nuke"
|
Here is how I coded the change in 2009
Code:
//OLD $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');
Changed that to this:
if (isset($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 {
//OLD $result = $db->sql_query('SELECT * FROM '.$prefix.'_blocks WHERE bposition=\''.$pos.'\' AND active=1 '.$querylang.' ORDER BY weight ASC');
$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 WHERE b.bposition='$pos' AND b.active='1' $querylang ORDER BY b.weight ASC";
}
$result = $db->sql_query($sql);
|
But now I see this in the blocks function that was not there in 2009:
Code:function blocks($side) {
global $admin, $currentlang, $db,[b] $moveableblocks[/b], $multilingual, $prefix, $storynum, $user;
|
Questions:
1. What is $moveableblocks?
2 And is it going to effect or be effected by the change I'm trying to make?
3 And is the sql call coded properly and to meet the RN standard?
|
|
|
|
|
wHiTeHaT
Life Cycles Becoming CPU Cycles
Joined: Jul 18, 2004
Posts: 579
|
Posted:
Sat Sep 21, 2013 8:59 am |
|
this should work:
Code:
function blocks($side) {
global $admin, $currentlang, $db, $moveableblocks, $multilingual, $prefix, $storynum, $user, $name, $myLanguage;
$myLanguage = _LANGUAGES;
if ($multilingual == 1) {
$querylang = 'AND (b.blanguage=\'' . $currentlang . '\' OR b.blanguage=\'\')';
} else {
$querylang = '';
}
$side = strtolower(substr($side, 0, 1));
if (!preg_match('/[lrcdt]/', $side)) {
die('invalid parameter passed to blocks function in mainfile = ' . $side);
}
if (strlen($name) != 0) {
$name = str_replace(' ','_',$name);
$name = str_replace('%20','_',$name);
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_blocks b, ' . $prefix . '_blocks_manager m WHERE b.active=1 AND b.bid=m.bid AND m.title=\'' . $name . '\' AND m.bposition=\'' . $side . '\' ' . $querylang . ' ORDER BY b.weight ASC');
} else {
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_blocks b, ' . $prefix . '_blocks_manager m WHERE b.active=1 AND b.bid=m.bid AND m.title=\'admin\' AND m.bposition=\'' . $side . '\' ' . $querylang . ' ORDER BY b.weight ASC');
}
|
while................... |
Last edited by wHiTeHaT on Sat Sep 21, 2013 2:27 pm; edited 1 time in total |
|
|
|
wHiTeHaT
|
Posted:
Sat Sep 21, 2013 9:02 am |
|
$moveableblocks , seems to be used in admin/modules/themes.php
I assume it is used with a theme, supporting the theme setting. |
|
|
|
|
draxx
|
Posted:
Sat Sep 21, 2013 2:24 pm |
|
Well .... when I altered the code I made all the blocks everywhere go away. LOL! I tried several variants of code and themes to no avail.
The admin panel works and it enters the data into the database as it did in '09
I think now perhaps the block functions have deviated out of the realm of my ability to code it. |
|
|
|
|
wHiTeHaT
|
Posted:
Sat Sep 21, 2013 2:29 pm |
|
edited the code, sorry had a different value.
Try again. |
|
|
|
|
draxx
|
Posted:
Sat Sep 21, 2013 2:51 pm |
|
Thanks Whitehat! The change started making blocks! Yay! But all the titles of the blocks are not the title of the block but rather they are the title of the module page I am sitting on. |
Last edited by draxx on Sat Sep 21, 2013 3:45 pm; edited 1 time in total |
|
|
|
draxx
|
Posted:
Sat Sep 21, 2013 2:53 pm |
|
Correction- the admin block is titled properly - and the personal menu for admin is titled properly - the rest are the title of module page and not the block. |
|
|
|
|
wHiTeHaT
|
Posted:
Sun Sep 22, 2013 2:26 am |
|
then i assume you changed the rest of the code...
i provide you with the full function:
Code:
function blocks($side) {
global $admin, $currentlang, $db, $moveableblocks, $multilingual, $prefix, $storynum, $user, $name;
if ($multilingual == 1) {
$querylang = 'AND (b.blanguage=\'' . $currentlang . '\' OR b.blanguage=\'\')';
} else {
$querylang = '';
}
$side = strtolower(substr($side, 0, 1));
if (!preg_match('/[lrcdt]/', $side)) {
die('invalid parameter passed to blocks function in mainfile = ' . $side);
}
if (strlen($name) != 0) {
$name = str_replace(' ','_',$name);
$name = str_replace('%20','_',$name);
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_blocks b, ' . $prefix . '_blocks_manager m WHERE b.active=1 AND b.bid=m.bid AND m.title=\'' . $name . '\' AND m.bposition=\'' . $side . '\' ' . $querylang . ' ORDER BY b.weight ASC');
} else {
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_blocks b, ' . $prefix . '_blocks_manager m WHERE b.active=1 AND b.bid=m.bid AND m.title=\'admin\' AND m.bposition=\'' . $side . '\' ' . $querylang . ' ORDER BY b.weight ASC');
}
while($row = $db->sql_fetchrow($result, SQL_ASSOC)) {
$groups = $row['groups'];
$bid = $row['bid'];
$title = $row['title'];
$content = $row['content'];
$url = $row['url'];
$blockfile = $row['blockfile'];
$view = $row['view'];
$expire = $row['expire'];
$action = $row['action'];
$action = substr($action, 0, 1);
$now = time();
$sub = $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);
}
}
}
}
}
|
|
|
|
|
|
draxx
|
Posted:
Sun Sep 22, 2013 4:09 pm |
|
Thank you WHiTeHaT for your attention and efforts.
I have copied the text of the function in its entirety and while it divies out the blocks properly I still have the issue that the title of all the blocks is not the block title but the module title I am viewing them on in the moment. |
|
|
|
|
wHiTeHaT
|
Posted:
Mon Sep 23, 2013 12:09 pm |
|
What if you change m.title to m.module_title and in the database table, nuke_blocks_manager also rename title in module_title? |
|
|
|
|
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm
Joined: Aug 13, 2009
Posts: 1122
|
Posted:
Mon Sep 23, 2013 5:43 pm |
|
try this one draxx
Code:<?php
function blocks($side) {
global $admin, $currentlang, $db, $moveableblocks, $multilingual, $prefix, $storynum, $user, $name;
if ($multilingual == 1) {
$querylang = 'AND (`b.blanguage` = \'' . $currentlang . '\' OR `b.blanguage` = \'\')';
} else {
$querylang = '';
}
$side = strtolower(substr($side, 0, 1));
if (!preg_match('/[lrcdt]/', $side)) {
die('invalid parameter passed to blocks function in mainfile = ' . $side);
}
if (strlen($name) != 0) {
$name = str_replace(' ','_',$name);
$name = str_replace('%20','_',$name);
$result = $db->sql_query('SELECT * FROM `' . $prefix . '_blocks` b, ' . $prefix . '_blocks_manager` m WHERE `b.active` = 1 AND `b.bid` = `m.bid` AND `m.title` = \'' . $name . '\' AND m.bposition = \'' . $side . '\' ' . $querylang . ' ORDER BY `b.weight` ASC');
} else {
$result = $db->sql_query('SELECT * FROM `' . $prefix . '_blocks` b, ' . $prefix . '_blocks_manager` m WHERE `b.active` = 1 AND `b.bid` = `m.bid` AND `m.title` = \'admin\' AND `m.bposition` = \'' . $side . '\' ' . $querylang . ' ORDER BY `b.weight` ASC');
}
while($row = $db->sql_fetchrow($result, SQL_ASSOC)) {
$groups = $row['groups'];
$bid = $row['bid'];
$title = $row['title'];
$content = $row['content'];
$url = $row['url'];
$blockfile = $row['blockfile'];
$view = $row['view'];
$expire = $row['expire'];
$action = $row['action'];
$action = substr($action, 0, 1);
$now = time();
$sub = $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);
}
}
}
}
}
|
|
|
|
|
|
draxx
|
Posted:
Wed Sep 25, 2013 12:37 am |
|
I have tried that wHiTe and the problem remained.
Sorry Hicux - your mod took me backwards and with it I got no blocks anywhere. |
|
|
|
|
wHiTeHaT
|
Posted:
Wed Sep 25, 2013 1:51 pm |
|
Then you changed the other block functions (render and themeside and blockfile include).
And if it's not them, then you changed something in your theme.
Did you tested also with another theme?
If the problem persist , then you can exclude failure from the theme. |
|
|
|
|
draxx
|
Posted:
Thu Sep 26, 2013 10:18 am |
|
Nope I have actually not modified anything in the core like that or the other block functions - which is why I'm soooooo stumped!
It does it on all of the themes (I had already checked that) |
|
|
|
|
wHiTeHaT
|
Posted:
Thu Sep 26, 2013 1:50 pm |
|
Not posseble.
if you want you can email or pm me your ftp & phpmyadmin.
Unless i get listed to some NSA bureau. |
|
|
|
|
draxx
|
Posted:
Wed Oct 23, 2013 9:31 pm |
|
Okay I'm back. Sorry for the delay - I became obsessed with making a facebook login work.
Okay I redid everything again and _IF_ I do as suggested:
Quote: | What if you change m.title to m.module_title and in the database table, nuke_blocks_manager also rename title in module_title? | then it worked BUT it broke the admin files to determine the blocks.
Knowing this is there any other way?
@wHiTeHaT I have no problems sharing the devsite - is all you need ftp access? |
|
|
|
|
wHiTeHaT
|
Posted:
Thu Oct 24, 2013 12:56 pm |
|
if it is working now as you say this admin file should get the manager working again:
Code:<?php
if (!defined('ADMIN_FILE')) {
die ("Access Denied");
}
global $prefix, $db;
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {
/*********************************************************/
/* Blocks_Manager Functions */
/*********************************************************/
function BlocksManager($wb_name) {
global $db, $prefix, $currentlang, $multilingual, $bgcolor2;
OpenHeader(_BLOCKMGR);
$wb_url="admin.php?op=BlocksManager&wb_name=";
echo "<center><form action=\"admin.php\" method=\"post\">\n"
._BLOCKMGR_MODULEDROP." <select name=\"wb_name\" size=\"1\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
if (!isset($wb_name)) { $wb_name = "admin"; }
echo "<option value=\"".$wb_url."admin\""; if ($wb_name=="admin") { echo " selected"; } echo ">admin</option>\n";
$result = $db->sql_query("SELECT m.module_id, m.module_name, ms.active, ms.inmenu FROM ".$prefix."_mmmodules m , ".$prefix."_mmmodule_settings ms WHERE ms.module_id = m.module_id AND ms.active=1 AND m.language_id=1 ORDER BY m.module_name ASC");
while(list($module_id, $module_name, $active, $inmenu) = $db->sql_fetchrow($result)) {
echo "<option value=\"".$wb_url.$module_name."\""; if ($wb_name==$module_name) { echo " selected"; } echo ">$module_name</option>\n";
if (!isset($wb_name)) { $wb_name = $module_name; }
}
echo "</select>\n"
."</form>\n</center>\n";
echo "<table border=\"0\" width=\"100%\">\n<tr>\n"
."<td align=\"center\" bgcolor=\"$bgcolor2\">"._BLOCKMGR_TITLE."</td>\n"
."<td align=\"center\" bgcolor=\"$bgcolor2\">"._BLOCKMGR_POSITION."</td>\n"
."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\">"._BLOCKMGR_WEIGHT."</td>\n"
."<td align=\"center\" bgcolor=\"$bgcolor2\">"._BLOCKMGR_STATUS."</td>\n"
."<td align=\"center\" bgcolor=\"$bgcolor2\">"._BLOCKMGR_VIEW."</td>\n";
if ($multilingual == 1) {
echo "<td align=\"center\" bgcolor=\"$bgcolor2\">"._BLOCKMGR_LANGUAGE."</td>\n";
}
$i=0;
$sql = "SELECT b.bid, b.bkey, b.title, b.url, m.bposition, m.weight, b.active, b.blanguage, b.blockfile, b.view FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.module_title='$wb_name' ORDER BY m.bposition, weight";
$result = $db->sql_query($sql);
while(list($bid, $bkey, $title, $url, $bposition, $weight, $active, $blanguage, $blockfile, $view) = $db->sql_fetchrow($result)) {
$weight1 = $weight - 1;
$weight3 = $weight + 1;
$res1 = $db->sql_query("SELECT bid FROM ".$prefix."_blocks_manager WHERE module_title='$wb_name' AND weight='$weight1' AND bposition='$bposition'");
list($con1) = $db->sql_fetchrow($res1);
$res2 = $db->sql_query("SELECT bid FROM ".$prefix."_blocks_manager WHERE module_title='$wb_name' AND weight='$weight3' AND bposition='$bposition'");
list($con2) = $db->sql_fetchrow($res2);
$wb_url = "admin.php?op=BlocksManager_BlockPosition&wb_name=$wb_name&bid=$bid&position=";
$t_position = "<form action=\"admin.php\" method=\"post\">\n";
$t_position .= "<select name=\"bposition\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
// if (!isset($wb_name)) { $wb_name = "admin"; }
$t_position .= "<option value=\"".$wb_url."l\"";
if ($bposition=="l") { $t_position .= " selected"; } $t_position .= ">"._BLOCKMGR_LEFT."</option>\n";
$t_position .= "<option value=\"".$wb_url."c\"";
if ($bposition=="c") { $t_position .= " selected"; } $t_position .= ">"._BLOCKMGR_CENTERUP."</option>\n";
$t_position .= "<option value=\"".$wb_url."d\"";
if ($bposition=="d") { $t_position .= " selected"; } $t_position .= ">"._BLOCKMGR_CENTERDOWN."</option>\n";
$t_position .= "<option value=\"".$wb_url."r\"";
if ($bposition=="r") { $t_position .= " selected"; } $t_position .= ">"._BLOCKMGR_RIGHT."</option>\n";
$t_position .= "</select>\n</form>\n";
echo "<tr>\n"
."<td align=\"center\">$title</td>\n"
."<td align=\"center\">$t_position</td>\n"
."<td align=\"center\">$weight</td>\n"
."<td align=\"center\">\n";
if ($con1) {
echo"<a href=\"admin.php?op=BlocksManager_BlockOrder&wb_name=$wb_name&weight=$weight&bidori=$bid&weightrep=$weight1&bidrep=$con1\">"
."<img src=\"images/up.gif\" alt=\""._BLOCKMGR_BLOCKUP."\" title=\""._BLOCKMGR_BLOCKUP."\" border=\"0\" hspace=\"3\">"
."</a>\n";
}
if ($con2) {
echo "<a href=\"admin.php?op=BlocksManager_BlockOrder&wb_name=$wb_name&weight=$weight&bidori=$bid&weightrep=$weight3&bidrep=$con2\">"
."<img src=\"images/down.gif\" alt=\""._BLOCKMGR_BLOCKDOWN."\" title=\""._BLOCKMGR_BLOCKDOWN."\" border=\"0\" hspace=\"3\">"
."</a>\n";
}
echo"</td>\n";
$block_act = $active;
if ($active == 1) {
$active = _BLOCKMGR_ACTIVE;
$change = _BLOCKMGR_DEACTIVATE;
} elseif ($active == 0) {
$active = "<i>"._BLOCKMGR_INACTIVE."</i>";
$change = _BLOCKMGR_ACTIVATE;
}
echo "<td align=\"center\">$active</td>\n";
if ($view == 0) {
$who_view = _MVALL;
} elseif ($view == 1) {
$who_view = _MVUSERS;
} elseif ($view == 2) {
$who_view = _MVADMIN;
} elseif ($view == 3) {
$who_view = _MVANON;
} elseif ($view == 4) {
$who_view = 'NSN GROUP USERS';
}
echo "<td align=\"center\">$who_view</td>\n";
if ($multilingual == 1) {
if ($blanguage == "") {
$blanguage = _ALL;
} else {
$blanguage = ucfirst($blanguage);
}
echo "<td align=\"center\">$blanguage</td>\n";
}
echo "</tr>\n";
$wb_tabblocks[$i] = $bid;
$i++;
}
echo "</table>\n";
echo "<br>\n";
echo "<center><b>"._BLOCKMGR_ADDNEWBLOCK."</b></center>\n"
."<form name=\"BM_EDIT\" action=\"admin.php\" method=\"post\">\n"
."<table width=\"80%\" align=\"center\">\n"
."<tr>\n";
//List all inactive Blocks for selected module
echo "<td align=\"center\" valign=\"top\">\n"
._BLOCKMGR_ACTIVE_BLOCKS."<br>\n"
."<select name=\"bida[]\" size=\"10\" multiple>\n";
$sql = "SELECT bid, title FROM ".$prefix."_blocks ORDER BY title ASC";
$result = $db->sql_query($sql);
while (list($bid, $title) = $db->sql_fetchrow($result)) {
$ii = 0; $wb_affiche = 1;
while ($ii < $i) { if ($wb_tabblocks[$ii] == $bid) { $wb_affiche = 0; } $ii++; }
if ($wb_affiche == 1) { echo "<option value=\"".$bid."\">$title</option>\n"; }
}
echo "</select><br>\n"
."<input type=\"submit\" value=\""._BLOCKMGR_ADD_BLOCK."\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Add';\">\n"
."</td>\n";
//List all active Blocks for selected module
echo "<td align=\"center\" valign=\"top\">\n"
._BLOCKMGR_INACTIVE_BLOCKS."<br>\n"
."<select name=\"bidr[]\" size=\"10\" multiple>\n";
$sql = "SELECT b.bid, b.title FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.module_title='$wb_name' ORDER BY m.module_title ASC";
$result = $db->sql_query($sql);
while(list($bid, $title) = $db->sql_fetchrow($result)) {
echo "<option value=\"$bid\">$title</option>\n";
}
echo "</select><br>\n"
."<input type=\"submit\" value=\""._BLOCKMGR_REMOVE_BLOCK."\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Remove';\">\n"
."</td>\n"
."</tr>\n"
."</table>\n"
."<input type=\"hidden\" name=\"wb_name\" value=\"$wb_name\">\n"
."<input type=\"hidden\" name=\"op\" value=\"BlocksManager_Add\">\n"
."</form>\n";
CloseFooter();
}
function BlocksManager_Add($bid, $wb_name) {
global $db, $prefix;
$sql = "SELECT MAX(weight) FROM ".$prefix."_blocks_manager WHERE module_title='$wb_name'";
$result = $db->sql_query($sql);
list($weight) = $db->sql_fetchrow($result);
foreach($bid as $bKey => $bValue) {
$weight++;
$db->sql_query("INSERT INTO ".$prefix."_blocks_manager VALUES ('$bValue', '$wb_name', 'l', '$weight')");
}
BlocksManager_FixWeight($title);
header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_Remove($bid, $wb_name) {
global $db, $prefix;
foreach($bid as $bKey => $bValue) {
$db->sql_query("DELETE FROM ".$prefix."_blocks_manager WHERE bid='$bValue' AND module_title='$wb_name'");
}
BlocksManager_FixWeight($title);
header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_FixWeight($wb_name) {
global $db, $prefix;
$position[] = 'l';
$position[] = 'r';
$position[] = 'c';
$position[] = 'd';
$position[] = '';
foreach($position as $pKey => $pValue) {
$result = $db->sql_query("SELECT bid FROM ".$prefix."_blocks_manager WHERE module_title='$wb_name' AND bposition='$pValue' ORDER BY weight ASC");
$weight = 0;
while(list($bid) = $db->sql_fetchrow($result)) {
$weight++;
if ($pValue != '') : $db->sql_query("UPDATE ".$prefix."_blocks_manager SET weight='$weight' WHERE module_title='$wb_name' AND bid='$bid'");
else : $db->sql_query("UPDATE ".$prefix."_blocks_manager SET weight='$weight', bposition='r' WHERE module_title='$wb_name' AND bid='$bid'");
endif;
}
}
header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_BlockPosition($bid, $wb_name, $position) {
global $db, $prefix;
$db->sql_query("UPDATE ".$prefix."_blocks_manager SET bposition='$position' WHERE bid='$bid' AND module_title='$wb_name'");
BlocksManager_FixWeight($wb_name);
header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_BlockOrder($wb_name, $weightrep, $weight, $bidrep, $bidori) {
global $db, $prefix;
$result = $db->sql_query("UPDATE ".$prefix."_blocks_manager SET weight='$weight' WHERE bid='$bidrep'");
$result2 = $db->sql_query("UPDATE ".$prefix."_blocks_manager SET weight='$weightrep' WHERE bid='$bidori'");
BlocksManager_FixWeight($wb_name);
header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function OpenHeader($title="") {
include("header.php");
GraphicAdmin();
title($title);
OpenTable();
}
function CloseFooter() {
CloseTable();
include("footer.php");
}
switch($op) {
case "BlocksManager":
BlocksManager($wb_name);
break;
case "BlocksManager_Add":
BlocksManager_Add($bida, $wb_name);
break;
case "BlocksManager_Remove":
BlocksManager_Remove($bidr, $wb_name);
break;
case "BlocksManager_BlockPosition":
BlocksManager_BlockPosition($bid, $wb_name, $position);
break;
case "BlocksManager_BlockOrder":
BlocksManager_BlockOrder($wb_name, $weightrep, $weight, $bidrep, $bidori);
break;
}
} else {
echo "Access Denied";
}
?>
|
|
|
|
|
|
draxx
|
Posted:
Thu Oct 24, 2013 5:54 pm |
|
If I use the code you supply it does not work - There are many things wrong with it. I notice they are also 6K smaller.
But perhaps I am confused - Is what you supply the whole contents of the admin file or should I replace only the listed functions?
Here is the whole admin file:
Code:
<?php
/************************************************************************/
/* WB_BlocksManager v0.2 */
/* Module for phpnuke 6.x by Paulo FERREIRA */
/* Copyright (C) 2003 Paulo Ferreira */
/* Web: http://www.phpnuke-belgique.org/ */
/* Email: [ Only registered users can see links on this board! Get registered or login! ] */
/* */
/* Modifications by James Johnston, 02/07/2004 */
/* Email: [ Only registered users can see links on this board! Get registered or login! ] */
/* Mods: Easy Position Change, Block Position by Module, */
/* Multi Add/Remove of Selected Blocks */
/* */
/* */
/* Updated 2004-08-31 for nuke 7.4 by spcdata http://www.nextnet.se */
/* */
/* =====================================================================*/
/* PHP-NUKE: Web Portal System */
/* =====================================================================*/
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if (!eregi("admin.php", $_SERVER['PHP_SELF']) AND !eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
global $prefix, $db;
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {
/*********************************************************/
/* Blocks_Manager Functions */
/*********************************************************/
function BlocksManager($wb_name) {
global $bgcolor2, $bgcolor4, $prefix, $db, $currentlang, $multilingual;
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>"._BLOCKMGR_BLOCKSADMIN_MANAGER."</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$wb_url="admin.php?op=BlocksManager&wb_name=";
echo "<div align=\"center\">\n"
."<form action=\"admin.php\" method=\"post\">\n"
.""._BLOCKMGR_MODULEDROP." <select name=\"wb_name\" size=\"1\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
$result = $db->sql_query("SELECT mid, title, custom_title, active, view, inmenu FROM ".$prefix."_modules WHERE active=1 ORDER BY title ASC");
while(list($mid, $title, $custom_title, $active, $view, $inmenu) = $db->sql_fetchrow($result)) {
echo "<option value=\"".$wb_url.$title."\""; if ($wb_name==$title) { echo " selected"; } echo ">$title</option>\n";
if (!isset($wb_name)) { $wb_name = $title; }
}
echo "</select> \n"
."</form></div>\n";
echo "<table border=\"1\" width=\"100%\"><tr>"
."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._TITLE."</b></td>"
."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\"><b>"._POSITION."</b></td>"
."<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\"><b>"._WEIGHT."</b></td>"
."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._TYPE."</b></td>"
."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._STATUS."</b></td>"
."<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._VIEW."</b></td>";
if ($multilingual == 1) {
echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._LANGUAGE."</b></td>";
}
// echo "<td align=\"center\" bgcolor=\"$bgcolor2\"><b>"._FUNCTIONS."</b></tr>";
$i=0;
$sql = "SELECT b.bid, b.bkey, b.title, b.url, m.bposition, m.weight, b.active, b.blanguage, b.blockfile, b.view FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$wb_name' ORDER BY bposition, weight";
$result1 = $db->sql_query($sql);
while(list($bid, $bkey, $title, $url, $bposition, $weight, $active, $blanguage, $blockfile, $view) = $db->sql_fetchrow($result1)) {
$weight1 = $weight - 1;
$weight3 = $weight + 1;
$res = $db->sql_query("select bid from ".$prefix."_blocks_manager where title='$wb_name' AND weight='$weight1' AND bposition='$bposition'");
list ($bid1) = $db->sql_fetchrow($res);
$con1 = "$bid1";
$res2 = $db->sql_query("select bid from ".$prefix."_blocks_manager where title='$wb_name' AND weight='$weight3' AND bposition='$bposition'");
list ($bid2) = $db->sql_fetchrow($res2);
$con2 = "$bid2";
echo "<tr>"
."<td align=\"center\">$title</td>";
if ($bposition == "l") {
$bposition = ""._LEFT."</td><td align=\"center\"><a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=r\">"
."<img src=\"images/center_l.gif\" border=\"0\" alt=\""._MOVERIGHT."\" title=\""._MOVERIGHT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=c\">"
."<img src=\"images/up.gif\" alt=\""._MOVECENTERUP."\" title=\""._MOVECENTERUP."\" border=\"0\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=d\">"
."<img src=\"images/down.gif\" alt=\""._MOVECENTERDOWN."\" title=\""._MOVECENTERDOWN."\" border=\"0\">"
."</a>";
} elseif ($bposition == "r") {
$bposition = ""._RIGHT."</td><td align=\"center\"><a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=l\">"
."<img src=\"images/center_r.gif\" border=\"0\" alt=\""._MOVELEFT."\" title=\""._MOVELEFT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=c\">"
."<img src=\"images/up.gif\" alt=\""._MOVECENTERUP."\" title=\""._MOVECENTERUP."\" border=\"0\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=d\">"
."<img src=\"images/down.gif\" alt=\""._MOVECENTERDOWN."\" title=\""._MOVECENTERDOWN."\" border=\"0\">"
."</a>";
} elseif ($bposition == "c") {
$bposition = ""._CENTERUP."</td><td align=\"center\"><a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=l\">"
."<img src=\"images/center_r.gif\" border=\"0\" alt=\""._MOVELEFT."\" title=\""._MOVELEFT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=r\">"
."<img src=\"images/center_l.gif\" border=\"0\" alt=\""._MOVERIGHT."\" title=\""._MOVERIGHT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=d\">"
."<img src=\"images/down.gif\" alt=\""._MOVECENTERDOWN."\" title=\""._MOVECENTERDOWN."\" border=\"0\">"
."</a>";
} elseif ($bposition == "d") {
$bposition = ""._CENTERDOWN."</td><td align=\"center\"><a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=l\">"
."<img src=\"images/center_r.gif\" border=\"0\" alt=\""._MOVELEFT."\" title=\""._MOVELEFT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=r\">"
."<img src=\"images/center_l.gif\" border=\"0\" alt=\""._MOVERIGHT."\" title=\""._MOVERIGHT."\">"
."</a>"
."<a href=\"admin.php?op=BlocksManager_BlockPosition&bid=$bid&title=$wb_name&position=c\">"
."<img src=\"images/up.gif\" alt=\""._MOVECENTERUP."\" title=\""._MOVECENTERUP."\" border=\"0\">"
."</a>";
}
echo "<td align=\"center\">$bposition</td>"
."<td align=\"center\">";
// ." ".$row1[weight]." </td>";
echo "$weight</td><td align=\"center\">";
if ($con1) {
echo"<a href=\"admin.php?op=BlocksManager_BlockOrder&weight=$weight&bidori=$bid&weightrep=$weight1&bidrep=$con1\"><img src=\"images/up.gif\" alt=\""._BLOCKUP."\" title=\""._BLOCKUP."\" border=\"0\" hspace=\"3\"></a>";
}
if ($con2) {
echo "<a href=\"admin.php?op=BlocksManager_BlockOrder&weight=$weight&bidori=$bid&weightrep=$weight3&bidrep=$con2\"><img src=\"images/down.gif\" alt=\""._BLOCKDOWN."\" title=\""._BLOCKDOWN."\" border=\"0\" hspace=\"3\"></a>";
}
echo"</td>";
if ($bkey == "") {
if ($url == "") {
$type = "HTML";
} elseif ($url != "") {
$type = "RSS/RDF";
}
if ($blockfile != "") {
$type = _BLOCKFILE2;
}
} elseif ($bkey != "") {
$type = _BLOCKSYSTEM;
}
echo "<td align=\"center\">$type</td>";
$block_act = $active;
if ($active == 1) {
$active = _ACTIVE;
$change = _DEACTIVATE;
} elseif ($active == 0) {
$active = "<i>"._INACTIVE."</i>";
$change = _ACTIVATE;
}
echo "<td align=\"center\">$active</td>";
if ($view == 0) {
$who_view = _MVALL;
} elseif ($view == 1) {
$who_view = _MVUSERS;
} elseif ($view == 2) {
$who_view = _MVADMIN;
} elseif ($view == 3) {
$who_view = _MVANON;
}
echo "<td align=\"center\">$who_view</td>";
if ($multilingual == 1) {
if ($blanguage == "") {
$blanguage = _ALL;
} else {
$blanguage = ucfirst($blanguage);
}
echo "<td align=\"center\">$blanguage</td>";
}
/* echo "<td align=\"center\"><font class=\"content\">";
if ($bkey == "") {
echo "<a href=\"admin.php?op=BlocksManager_Delete&bid=$bid&title=$wb_name\">"._BLOCKMGR_WB_DELETE."</a>";
} elseif ($bkey != "") {
echo ""._BLOCKMGR_WB_DELETE."";
}
echo "</td>";
*/
echo "</tr>";
$wb_tabblocks[$i] = $bid;
$i++;
}
echo "</table><br>"
."<center>[ <a href=\"admin.php?op=BlocksManager_FixWeight&wb_name=$wb_name\">"._FIXBLOCKS."</a> ]</center><br>"
."<br><br>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._BLOCKMGR_ADDNEWBLOCK_MANAGER."</b></font></center><br><br>"
."<form name=\"BM_EDIT\" action=\"admin.php\" method=\"post\">"
."<table border=\"0\" width=\"80%\" align=\"center\">"
."<tr>";
//List all inactive Blocks for selected module
echo "<td align=\"center\" valign=\"top\">"
._BLOCKMGR_ACTIVE_BLOCKS."<br><select name=\"bida[]\" size=\"10\" multiple>";
$sql = "SELECT bid, title FROM ".$prefix."_blocks ORDER BY title ASC";
$result = $db->sql_query($sql);
while(list($bid, $title) = $db->sql_fetchrow($result)) {
$ii=0; $wb_affiche=1;
while ($ii<$i) {
if ($wb_tabblocks[$ii]==$bid) { $wb_affiche=0; }
$ii++;
}
if ($wb_affiche==1) { echo "<option value=\"".$bid."\">$title</option>\n"; }
}
echo "</select><br>"
."<input type=\"submit\" value=\""._BLOCKMGR_ADD_BLOCK."\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Add';\">"
."</td>";
//List all active Modules
echo "<td align=\"center\" valign=\"top\">"
.""._BLOCKMGR_MODULES."<br><select name=\"title[]\" size=\"10\" multiple>\n";
$result = $db->sql_query("SELECT mid, title, custom_title, active, view, inmenu FROM ".$prefix."_modules WHERE active=1 ORDER BY title ASC");
while(list($mid, $title, $custom_title, $active, $view, $inmenu) = $db->sql_fetchrow($result)) {
echo "<option value=\"$title\"";
if ($wb_name==$title) { echo " selected"; } echo ">$title</option>\n";
if (!isset($wb_name)) { $wb_name = $title; }
}
echo "</select><br>"
."</td>\n";
//List all active Blocks for selected module
echo "<td align=\"center\" valign=\"top\">"
._BLOCKMGR_INACTIVE_BLOCKS."<br><select name=\"bidr[]\" size=\"10\" multiple>";
$sql = "SELECT b.bid, b.title FROM ".$prefix."_blocks b, ".$prefix."_blocks_manager m WHERE b.bid=m.bid AND m.title='$wb_name' ORDER BY title ASC";
$result = $db->sql_query($sql);
while(list($bid, $title) = $db->sql_fetchrow($result)) {
echo "<option value=\"$bid\">$title</option>\n";
}
echo "</select><br>"
."<input type=\"submit\" value=\""._BLOCKMGR_REMOVE_BLOCK."\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Remove';\"></td>";
echo "</tr><tr><td align=\"center\" colspan=\"2\"><br>"
."</td>"
."</tr>"
."</table>"
."<input type=\"hidden\" name=\"wb_name\" value=\"$wb_name\">"
."<input type=\"hidden\" name=\"op\" value=\"BlocksManager_Add\">"
."</form>";
CloseTable();
include("footer.php");
}
function BlocksManager_Add($bid, $title, $wb_name) {
global $prefix, $db;
foreach($title as $tKey => $tValue) {
foreach($bid as $bKey => $bValue) {
$sql = "SELECT bposition, weight FROM ".$prefix."_blocks WHERE bid='$bValue'";
echo "$sql<br>";
$result = $db->sql_query($sql);
list($bposition, $weight) = $db->sql_fetchrow($result);
$db->sql_query("INSERT INTO ".$prefix."_blocks_manager VALUES ('$bValue', '$tValue', '$bposition', '$weight')");
// echo "INSERT INTO ".$prefix."_blocks_manager VALUES ('$bValue', '$tValue', '$bposition', '$weight')<br>";
}
}
Header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_Remove($bid, $title, $wb_name) {
global $prefix, $db;
foreach($title as $tKey => $tValue) {
foreach($bid as $bKey => $bValue) {
$db->sql_query("DELETE FROM ".$prefix."_blocks_manager WHERE bid='$bValue' AND title='$tValue'");
// echo "DELETE FROM ".$prefix."_blocks_manager WHERE bid='$bValue' AND title='$tValue'<br>";
}
}
Header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_FixWeight($wb_name) {
global $prefix, $db;
$leftpos = "l";
$rightpos = "r";
$centeruppos = "c";
$centerdnpos = "d";
//Fix Left Block Weights
$result = $db->sql_query("select bid, title from ".$prefix."_blocks_manager where title='$wb_name' AND bposition='$leftpos' order by weight ASC");
$weight = 0;
while(list($bid, $title) = $db->sql_fetchrow($result)) {
$weight++;
$db->sql_query("update ".$prefix."_blocks_manager set weight='$weight' where title='$wb_name' AND bid='$bid'");
echo "$bid, $title, $weight<br>\n";
}
//Fix Right Block Weights
$result = $db->sql_query("select bid from ".$prefix."_blocks_manager where title='$wb_name' bposition='$rightpos' order by weight ASC");
$weight = 0;
while(list($bid) = $db->sql_fetchrow($result)) {
$weight++;
$db->sql_query("update ".$prefix."_blocks_manager set weight='$weight' where title='$wb_name' AND bid='$bid'");
}
//Fix Center Up Block Weights
$result = $db->sql_query("select bid from ".$prefix."_blocks_manager where title='$wb_name' bposition='$centeruppos' order by weight ASC");
$weight = 0;
while(list($bid) = $db->sql_fetchrow($result)) {
$weight++;
$db->sql_query("update ".$prefix."_blocks_manager set weight='$weight' where title='$wb_name' AND bid='$bid'");
}
//Fix Center Down Block Weights
$result = $db->sql_query("select bid from ".$prefix."_blocks_manager where title='$wb_name' bposition='$centerdnpos' order by weight ASC");
$weight = 0;
while(list($bid) = $db->sql_fetchrow($result)) {
$weight++;
$db->sql_query("update ".$prefix."_blocks_manager set weight='$weight' where title='$wb_name' AND bid='$bid'");
}
Header("Location: admin.php?op=BlocksManager&wb_name=$wb_name");
}
function BlocksManager_BlockPosition($bid, $title, $position) {
global $prefix, $db;
$db->sql_query("UPDATE ".$prefix."_blocks_manager SET bposition='$position' WHERE bid='$bid' AND title='$title'");
// echo "UPDATE ".$prefix."_blocks_manager SET bposition='$position' WHERE bid='$bid' AND title='$title'";
Header("Location: admin.php?op=BlocksManager&wb_name=$title");
}
function BlocksManager_BlockOrder($weightrep,$weight,$bidrep,$bidori) {
global $prefix, $db;
$result = $db->sql_query("update ".$prefix."_blocks_manager set weight='$weight' where bid='$bidrep'");
$result2 = $db->sql_query("update ".$prefix."_blocks_manager set weight='$weightrep' where bid='$bidori'");
Header("Location: admin.php?op=BlocksManager");
}
switch($op) {
case "BlocksManager":
BlocksManager($wb_name);
break;
case "BlocksManager_Add":
BlocksManager_Add($bida, $title, $wb_name);
break;
case "BlocksManager_Remove":
BlocksManager_Remove($bidr, $title, $wb_name);
break;
case "BlocksManager_BlockPosition":
BlocksManager_BlockPosition($bid, $title, $position);
break;
case "BlocksManager_FixWeight":
BlocksManager_FixWeight($wb_name);
break;
case "BlocksManager_BlockOrder":
BlocksManager_BlockOrder ($weightrep,$weight,$bidrep,$bidori);
break;
}
} else {
Header("Location: index.php");
die();
}
?>
|
|
|
|
|
|
hicuxunicorniobestbuildpc
|
Posted:
Fri Oct 25, 2013 2:31 am |
|
I downloaded the whole module and I read the installation guide. U need to modify mainfile. I am gonna try it myself and I will tell u later. |
|
|
|
|
wHiTeHaT
|
Posted:
Fri Oct 25, 2013 2:57 pm |
|
You only need this file to have the WB block managers running.
you just need to replace admin/modules/blocks_manager.php content with the one i posted. |
|
|
|
|
draxx
|
Posted:
Fri Oct 25, 2013 5:20 pm |
|
wHiTeHaT wrote: | You only need this file to have the WB block managers running.
you just need to replace admin/modules/blocks_manager.php content with the one i posted. |
That is exactly what I did and it did not work. It was broken beyond description.
I think your code is not complete because your code is 6K smaller than the original. ??? |
|
|
|
|
misterstereus
Regular
Joined: Aug 03, 2012
Posts: 56
Location: Rome Italy
|
Posted:
Sat Oct 26, 2013 12:14 am |
|
Hello test this if work
Code:
<?php
define ( "_BLOCKS_MANAGER", "Manager Blocchi" );
define ( "_BLOCKMGR", "Decidi Posizione Blocchi per Modulo" );
define ( "_BLOCKMGR_MODULEDROP", "Lista Blocchi per il Modulo :" );
define ( "_BLOCKMGR_ADDNEWBLOCK", "Aggiungi/Rimuovi Blocchi Selezionati dal Modulo Scelto" );
define ( "_BLOCKMGR_ACTIVE_BLOCKS", "Blocchi Non Attivi" );
define ( "_BLOCKMGR_INACTIVE_BLOCKS", "Blocchi Attivi" );
define ( "_BLOCKMGR_ADD_BLOCK", "Aggiungi" );
define ( "_BLOCKMGR_REMOVE_BLOCK", "Rimuovi" );
define ( "_BLOCKMGR_TITLE", "Titolo" );
define ( "_BLOCKMGR_POSITION", "Posizione" );
define ( "_BLOCKMGR_WEIGHT", "Weight" );
define ( "_BLOCKMGR_STATUS", "Stato" );
define ( "_BLOCKMGR_VIEW", "Visibile a" );
define ( "_BLOCKMGR_LANGUAGE", "Lingua" );
define ( "_BLOCKMGR_LEFT", "Sinistra" );
define ( "_BLOCKMGR_CENTERUP", "Centra Sopra" );
define ( "_BLOCKMGR_CENTERDOWN", "Centra Sotto" );
define ( "_BLOCKMGR_RIGHT", "Destra" );
define ( "_BLOCKMGR_BLOCKUP", "Sposta in Alto" );
define ( "_BLOCKMGR_BLOCKDOWN", "Sposta in Basso" );
define ( "_BLOCKMGR_DEACTIVATE", "Disattiva" );
define ( "_BLOCKMGR_ACTIVATE", "Attiva" );
define ( "_BLOCKMGR_INACTIVE", "Non Attivo" );
define ( "_BLOCKMGR_ACTIVE", "Attivo" );
if (! defined ( 'ADMIN_FILE' )) {
die ( "Access Denied" );
}
global $prefix, $db, $wb_name;
$aid = substr ( "$aid", 0, 25 );
$row = $db->sql_fetchrow ( $db->sql_query ( "SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'" ) );
if ($row ['radminsuper'] == 1) {
/**
* ******************************************************
*/
/* Blocks_Manager Functions */
/**
* ******************************************************
*/
function BlocksManager($wb_name) {
global $db, $prefix, $currentlang, $multilingual, $bgcolor2;
OpenHeader ( _BLOCKMGR );
$wb_url = "admin.php?op=BlocksManager&wb_name=";
echo "<center><form action=\"admin.php\" method=\"post\">\n" . _BLOCKMGR_MODULEDROP . " <select name=\"wb_name\" size=\"1\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
if (! isset ( $wb_name )) {
$wb_name = "admin";
}
echo "<option value=\"" . $wb_url . "admin\"";
if ($wb_name == "admin") {
echo " selected";
}
echo ">admin</option>\n";
$result = $db->sql_query ( "SELECT mid, title, custom_title, active, view, inmenu FROM " . $prefix . "_modules WHERE active=1 ORDER BY title ASC" );
while ( list ( $mid, $title, $custom_title, $active, $view, $inmenu ) = $db->sql_fetchrow ( $result ) ) {
echo "<option value=\"" . $wb_url . $title . "\"";
if ($wb_name == $title) {
echo " selected";
}
echo ">$title</option>\n";
if (! isset ( $wb_name )) {
$wb_name = $title;
}
}
echo "</select>\n" . "</form>\n</center>\n";
echo "<table border=\"0\" width=\"100%\">\n<tr>\n" . "<td align=\"center\" bgcolor=\"$bgcolor2\">" . _BLOCKMGR_TITLE . "</td>\n" . "<td align=\"center\" bgcolor=\"$bgcolor2\">" . _BLOCKMGR_POSITION . "</td>\n" . "<td align=\"center\" bgcolor=\"$bgcolor2\" colspan=\"2\">" . _BLOCKMGR_WEIGHT . "</td>\n" . "<td align=\"center\" bgcolor=\"$bgcolor2\">" . _BLOCKMGR_STATUS . "</td>\n" . "<td align=\"center\" bgcolor=\"$bgcolor2\">" . _BLOCKMGR_VIEW . "</td>\n";
if ($multilingual == 1) {
echo "<td align=\"center\" bgcolor=\"$bgcolor2\">" . _BLOCKMGR_LANGUAGE . "</td>\n";
}
$i = 0;
$sql = "SELECT b.bid, b.bkey, b.title, b.url, m.bposition, m.weight, b.active, b.blanguage, b.blockfile, b.view FROM " . $prefix . "_blocks b, " . $prefix . "_blocks_manager m WHERE b.bid=m.bid AND m.title='$wb_name' ORDER BY bposition, weight";
$result = $db->sql_query ( $sql );
while ( list ( $bid, $bkey, $title, $url, $bposition, $weight, $active, $blanguage, $blockfile, $view ) = $db->sql_fetchrow ( $result ) ) {
$weight1 = $weight - 1;
$weight3 = $weight + 1;
$res1 = $db->sql_query ( "SELECT bid FROM " . $prefix . "_blocks_manager WHERE title='$wb_name' AND weight='$weight1' AND bposition='$bposition'" );
list ( $con1 ) = $db->sql_fetchrow ( $res1 );
$res2 = $db->sql_query ( "SELECT bid FROM " . $prefix . "_blocks_manager WHERE title='$wb_name' AND weight='$weight3' AND bposition='$bposition'" );
list ( $con2 ) = $db->sql_fetchrow ( $res2 );
$wb_url = "admin.php?op=BlocksManager_BlockPosition&wb_name=$wb_name&bid=$bid&position=";
$t_position = "<form action=\"admin.php\" method=\"post\">\n";
$t_position .= "<select name=\"bposition\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">\n";
// if (!isset($wb_name)) { $wb_name = "admin"; }
$t_position .= "<option value=\"" . $wb_url . "l\"";
if ($bposition == "l") {
$t_position .= " selected";
}
$t_position .= ">" . _BLOCKMGR_LEFT . "</option>\n";
$t_position .= "<option value=\"" . $wb_url . "c\"";
if ($bposition == "c") {
$t_position .= " selected";
}
$t_position .= ">" . _BLOCKMGR_CENTERUP . "</option>\n";
$t_position .= "<option value=\"" . $wb_url . "d\"";
if ($bposition == "d") {
$t_position .= " selected";
}
$t_position .= ">" . _BLOCKMGR_CENTERDOWN . "</option>\n";
$t_position .= "<option value=\"" . $wb_url . "r\"";
if ($bposition == "r") {
$t_position .= " selected";
}
$t_position .= ">" . _BLOCKMGR_RIGHT . "</option>\n";
$t_position .= "</select>\n</form>\n";
echo "<tr>\n" . "<td align=\"center\">$title</td>\n" . "<td align=\"center\">$t_position</td>\n" . "<td align=\"center\">$weight</td>\n" . "<td align=\"center\">\n";
if ($con1) {
echo "<a href=\"admin.php?op=BlocksManager_BlockOrder&wb_name=$wb_name&weight=$weight&bidori=$bid&weightrep=$weight1&bidrep=$con1\">" . "<img src=\"images/up.gif\" alt=\"" . _BLOCKMGR_BLOCKUP . "\" title=\"" . _BLOCKMGR_BLOCKUP . "\" border=\"0\" hspace=\"3\">" . "</a>\n";
}
if ($con2) {
echo "<a href=\"admin.php?op=BlocksManager_BlockOrder&wb_name=$wb_name&weight=$weight&bidori=$bid&weightrep=$weight3&bidrep=$con2\">" . "<img src=\"images/down.gif\" alt=\"" . _BLOCKMGR_BLOCKDOWN . "\" title=\"" . _BLOCKMGR_BLOCKDOWN . "\" border=\"0\" hspace=\"3\">" . "</a>\n";
}
echo "</td>\n";
$block_act = $active;
if ($active == 1) {
$active = _BLOCKMGR_ACTIVE;
$change = _BLOCKMGR_DEACTIVATE;
} elseif ($active == 0) {
$active = "<i>" . _BLOCKMGR_INACTIVE . "</i>";
$change = _BLOCKMGR_ACTIVATE;
}
echo "<td align=\"center\">$active</td>\n";
if ($view == 0) {
$who_view = _MVALL;
} elseif ($view == 1) {
$who_view = _MVUSERS;
} elseif ($view == 2) {
$who_view = _MVADMIN;
} elseif ($view == 3) {
$who_view = _MVANON;
}
echo "<td align=\"center\">$who_view</td>\n";
if ($multilingual == 1) {
if ($blanguage == "") {
$blanguage = _ALL;
} else {
$blanguage = ucfirst ( $blanguage );
}
echo "<td align=\"center\">$blanguage</td>\n";
}
echo "</tr>\n";
$wb_tabblocks [$i] = $bid;
$i ++;
}
echo "</table>\n";
echo "<br />\n";
echo "<center><b>" . _BLOCKMGR_ADDNEWBLOCK . "</b></center>\n" . "<form name=\"BM_EDIT\" action=\"admin.php\" method=\"post\">\n" . "<table width=\"80%\" align=\"center\">\n" . "<tr>\n";
// List all inactive Blocks for selected module
echo "<td align=\"center\" valign=\"top\">\n" . _BLOCKMGR_ACTIVE_BLOCKS . "<br />\n" . "<select name=\"bida[]\" size=\"10\" multiple>\n";
$sql = "SELECT bid, title FROM " . $prefix . "_blocks ORDER BY title ASC";
$result = $db->sql_query ( $sql );
while ( list ( $bid, $title ) = $db->sql_fetchrow ( $result ) ) {
$ii = 0;
$wb_affiche = 1;
while ( $ii < $i ) {
if ($wb_tabblocks [$ii] == $bid) {
$wb_affiche = 0;
}
$ii ++;
}
if ($wb_affiche == 1) {
echo "<option value=\"" . $bid . "\">$title</option>\n";
}
}
echo "</select><br />\n" . "<input type=\"submit\" value=\"" . _BLOCKMGR_ADD_BLOCK . "\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Add';\">\n" . "</td>\n";
// List all active Blocks for selected module
echo "<td align=\"center\" valign=\"top\">\n" . _BLOCKMGR_INACTIVE_BLOCKS . "<br />\n" . "<select name=\"bidr[]\" size=\"10\" multiple>\n";
$sql = "SELECT b.bid, b.title FROM " . $prefix . "_blocks b, " . $prefix . "_blocks_manager m WHERE b.bid=m.bid AND m.title='$wb_name' ORDER BY title ASC";
$result = $db->sql_query ( $sql );
while ( list ( $bid, $title ) = $db->sql_fetchrow ( $result ) ) {
echo "<option value=\"$bid\">$title</option>\n";
}
echo "</select><br />\n" . "<input type=\"submit\" value=\"" . _BLOCKMGR_REMOVE_BLOCK . "\" onclick=\"document.BM_EDIT.op.value='BlocksManager_Remove';\">\n" . "</td>\n" . "</tr>\n" . "</table>\n" . "<input type=\"hidden\" name=\"wb_name\" value=\"$wb_name\">\n" . "<input type=\"hidden\" name=\"op\" value=\"BlocksManager_Add\">\n" . "</form>\n";
CloseFooter ();
}
function BlocksManager_Add($bid, $wb_name) {
global $db, $prefix;
$sql = "SELECT MAX(weight) FROM " . $prefix . "_blocks_manager WHERE title='$wb_name'";
$result = $db->sql_query ( $sql );
list ( $weight ) = $db->sql_fetchrow ( $result );
foreach ( $bid as $bKey => $bValue ) {
$weight ++;
$db->sql_query ( "INSERT INTO " . $prefix . "_blocks_manager VALUES ('$bValue', '$wb_name', 'r', '$weight')" );
}
BlocksManager_FixWeight ( $title );
header ( "Location: admin.php?op=BlocksManager&wb_name=$wb_name" );
}
function BlocksManager_Remove($bid, $wb_name) {
global $db, $prefix;
foreach ( $bid as $bKey => $bValue ) {
$db->sql_query ( "DELETE FROM " . $prefix . "_blocks_manager WHERE bid='$bValue' AND title='$wb_name'" );
}
BlocksManager_FixWeight ( $title );
header ( "Location: admin.php?op=BlocksManager&wb_name=$wb_name" );
}
function BlocksManager_FixWeight($wb_name) {
global $db, $prefix;
$position [] = 'l';
$position [] = 'r';
$position [] = 'c';
$position [] = 'd';
$position [] = '';
foreach ( $position as $pKey => $pValue ) {
$result = $db->sql_query ( "SELECT bid FROM " . $prefix . "_blocks_manager WHERE title='$wb_name' AND bposition='$pValue' ORDER BY weight ASC" );
$weight = 0;
while ( list ( $bid ) = $db->sql_fetchrow ( $result ) ) {
$weight ++;
if ($pValue != '') :
$db->sql_query ( "UPDATE " . $prefix . "_blocks_manager SET weight='$weight' WHERE title='$wb_name' AND bid='$bid'" );
else :
$db->sql_query ( "UPDATE " . $prefix . "_blocks_manager SET weight='$weight', bposition='r' WHERE title='$wb_name' AND bid='$bid'" );
endif;
}
}
header ( "Location: admin.php?op=BlocksManager&wb_name=$wb_name" );
}
function BlocksManager_BlockPosition($bid, $wb_name, $position) {
global $db, $prefix;
$db->sql_query ( "UPDATE " . $prefix . "_blocks_manager SET bposition='$position' WHERE bid='$bid' AND title='$wb_name'" );
BlocksManager_FixWeight ( $wb_name );
header ( "Location: admin.php?op=BlocksManager&wb_name=$wb_name" );
}
function BlocksManager_BlockOrder($wb_name, $weightrep, $weight, $bidrep, $bidori) {
global $db, $prefix;
$result = $db->sql_query ( "UPDATE " . $prefix . "_blocks_manager SET weight='$weight' WHERE bid='$bidrep'" );
$result2 = $db->sql_query ( "UPDATE " . $prefix . "_blocks_manager SET weight='$weightrep' WHERE bid='$bidori'" );
BlocksManager_FixWeight ( $wb_name );
header ( "Location: admin.php?op=BlocksManager&wb_name=$wb_name" );
}
function OpenHeader($title = "") {
include ("header.php");
GraphicAdmin ();
title ( $title );
OpenTable ();
}
function CloseFooter() {
CloseTable ();
include ("footer.php");
}
switch ($op) {
case "BlocksManager" :
BlocksManager ( $wb_name );
break;
case "BlocksManager_Add" :
BlocksManager_Add ( $bida, $wb_name );
break;
case "BlocksManager_Remove" :
BlocksManager_Remove ( $bidr, $wb_name );
break;
case "BlocksManager_BlockPosition" :
BlocksManager_BlockPosition ( $bid, $wb_name, $position );
break;
case "BlocksManager_BlockOrder" :
BlocksManager_BlockOrder ( $wb_name, $weightrep, $weight, $bidrep, $bidori );
break;
}
} else {
echo "Access Denied";
}
?>
|
mainfile
Code:
function blocks($side) {
global $admin, $currentlang, $db, $moveableblocks, $multilingual, $prefix, $storynum, $user, $name;
if ($multilingual == 1) {
$querylang = 'AND (`blanguage`=\'' . $currentlang . '\' OR `blanguage`=\'\')';
} else {
$querylang = '';
}
$side = strtolower ( substr ( $side, 0, 1 ) );
if (! preg_match ( '/[lrcdt]/', $side )) {
die ( 'invalid parameter passed to blocks function in mainfile = ' . $side );
}
$pos = $side;
// $result = $db->sql_query('SELECT * FROM ' . $prefix . '_blocks WHERE bposition=\'' . $side . '\' AND active=1 ' . $querylang . ' ORDER BY weight ASC');
if (strlen ( $name ) != 0) {
$name = str_replace ( ' ', '_', $name );
$name = str_replace ( '%20', '_', $name );
$sql = "SELECT b.bid, b.groups, 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.groups, 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";
}
$result = $db->sql_query ( $sql );
while ( $row = $db->sql_fetchrow ( $result, SQL_ASSOC ) ) {
$groups = $row ['groups'];
$bid = $row ['bid'];
$title = $row ['title'];
$content = $row ['content'];
$url = $row ['url'];
$blockfile = $row ['blockfile'];
$view = $row ['view'];
$expire = $row ['expire'];
$action = $row ['action'];
$action = substr ( $action, 0, 1 );
$now = time ();
$sub = $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 );
}
}
}
}
}
|
In my site it work [ Only registered users can see links on this board! Get registered or login! ] |
|
|
|
|
draxx
|
Posted:
Sat Oct 26, 2013 1:08 am |
|
What version of ravennuke do you run misterstereus ? |
|
|
|
|
misterstereus
|
Posted:
Sat Oct 26, 2013 1:35 am |
|
Last version v2.51
add me to Skype if you have search misterstereus from Rome Italy |
|
|
|
|
hicuxunicorniobestbuildpc
|
Posted:
Sat Oct 26, 2013 3:38 am |
|
Ciao Mistereus
Why if we are trying to reach a better way to handle module, blocks and language you want to put everything together?
Code:<?php
define ( "_BLOCKS_MANAGER", "Manager Blocchi" );
define ( "_BLOCKMGR", "Decidi Posizione Blocchi per Modulo" );
define ( "_BLOCKMGR_MODULEDROP", "Lista Blocchi per il Modulo :" );
define ( "_BLOCKMGR_ADDNEWBLOCK", "Aggiungi/Rimuovi Blocchi Selezionati dal Modulo Scelto" );
define ( "_BLOCKMGR_ACTIVE_BLOCKS", "Blocchi Non Attivi" );
define ( "_BLOCKMGR_INACTIVE_BLOCKS", "Blocchi Attivi" );
define ( "_BLOCKMGR_ADD_BLOCK", "Aggiungi" );
define ( "_BLOCKMGR_REMOVE_BLOCK", "Rimuovi" );
define ( "_BLOCKMGR_TITLE", "Titolo" );
define ( "_BLOCKMGR_POSITION", "Posizione" );
define ( "_BLOCKMGR_WEIGHT", "Weight" );
define ( "_BLOCKMGR_STATUS", "Stato" );
define ( "_BLOCKMGR_VIEW", "Visibile a" );
define ( "_BLOCKMGR_LANGUAGE", "Lingua" );
define ( "_BLOCKMGR_LEFT", "Sinistra" );
define ( "_BLOCKMGR_CENTERUP", "Centra Sopra" );
define ( "_BLOCKMGR_CENTERDOWN", "Centra Sotto" );
define ( "_BLOCKMGR_RIGHT", "Destra" );
define ( "_BLOCKMGR_BLOCKUP", "Sposta in Alto" );
define ( "_BLOCKMGR_BLOCKDOWN", "Sposta in Basso" );
define ( "_BLOCKMGR_DEACTIVATE", "Disattiva" );
define ( "_BLOCKMGR_ACTIVATE", "Attiva" );
define ( "_BLOCKMGR_INACTIVE", "Non Attivo" );
define ( "_BLOCKMGR_ACTIVE", "Attivo" );
if (! defined ( 'ADMIN_FILE' )) {
die ( "Access Denied" );
}
global $prefix, $db, $wb_name;
$aid = substr ( "$aid", 0, 25 );
$row = $db->sql_fetchrow ( $db->sql_query ( "SELECT radminsuper FROM " . $prefix . "_authors WHERE aid='$aid'" ) );
if ($row ['radminsuper'] == 1) {
|
This one must be in Language.
Code:define ( "_BLOCKS_MANAGER", "Manager Blocchi" );
define ( "_BLOCKMGR", "Decidi Posizione Blocchi per Modulo" );
define ( "_BLOCKMGR_MODULEDROP", "Lista Blocchi per il Modulo :" );
define ( "_BLOCKMGR_ADDNEWBLOCK", "Aggiungi/Rimuovi Blocchi Selezionati dal Modulo Scelto" );
define ( "_BLOCKMGR_ACTIVE_BLOCKS", "Blocchi Non Attivi" );
define ( "_BLOCKMGR_INACTIVE_BLOCKS", "Blocchi Attivi" );
define ( "_BLOCKMGR_ADD_BLOCK", "Aggiungi" );
define ( "_BLOCKMGR_REMOVE_BLOCK", "Rimuovi" );
define ( "_BLOCKMGR_TITLE", "Titolo" );
define ( "_BLOCKMGR_POSITION", "Posizione" );
define ( "_BLOCKMGR_WEIGHT", "Weight" );
define ( "_BLOCKMGR_STATUS", "Stato" );
define ( "_BLOCKMGR_VIEW", "Visibile a" );
define ( "_BLOCKMGR_LANGUAGE", "Lingua" );
define ( "_BLOCKMGR_LEFT", "Sinistra" );
define ( "_BLOCKMGR_CENTERUP", "Centra Sopra" );
define ( "_BLOCKMGR_CENTERDOWN", "Centra Sotto" );
define ( "_BLOCKMGR_RIGHT", "Destra" );
define ( "_BLOCKMGR_BLOCKUP", "Sposta in Alto" );
define ( "_BLOCKMGR_BLOCKDOWN", "Sposta in Basso" );
define ( "_BLOCKMGR_DEACTIVATE", "Disattiva" );
define ( "_BLOCKMGR_ACTIVATE", "Attiva" );
define ( "_BLOCKMGR_INACTIVE", "Non Attivo" );
define ( "_BLOCKMGR_ACTIVE", "Attivo" );
|
NOTE: To All programmers, administrators and user. Please let's get straight forward to the same line and if we convert an addon,blocks or modules let try to make it validate it in the way Ravennuke does. In the past we got lots of problems with old stuff. I do know we want to make it work but we need to be more efficient so in the future we don't have problems. |
|
|
|
|
|