Author |
Message |
testy1
Involved
![Involved Involved](modules/Forums/images/ranks/4stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Apr 06, 2008
Posts: 484
|
Posted:
Sun Dec 14, 2008 4:46 pm |
|
I've been looking at sommaire and the mess it is in and thought I would play around with it.I am attempting to fix it up but I am having trpouble understanding the following
Code:
$active[$row['title']] = $tempo['active'];
|
No I understand sort of but can someone explain exactly what is going on here, as normally I would define a variable to a particular field e.g.
Code:
$active = $row['active'];
|
I understand they are using arrays somehow but not sure what is really happening
and here is the full code I am looking at
Code:
$sql = "SELECT * FROM ".$prefix."_modules WHERE active='1' AND inmenu='1' ORDER BY custom_title ASC";
$modulesaffiche= $db->sql_query($sql);
$compteur=0;
while ($tempo = $db->sql_fetchrow($modulesaffiche)) {
$module[$compteur] = $tempo['title'];
$customtitle[$compteur] = $tempo['custom_title'];
$view[$compteur] = $tempo['view'];
$active[$row['title']] = $tempo['active'];
$mod_group[$compteur] = ($gestiongroupe==1 && isset($tempo['mod_group'])) ? $tempo['mod_group'] : "";
$nsngroups[$compteur]=(isset($tempo['groups'])) ? $tempo['groups'] : "" ; // NSN Groups
$gt_url[$compteur]=(isset($tempo['url'])) ? $tempo['url'] : "" ; //GoogleTap-NextGen
$compteur++;
if ($tempo['view']==3) { $gestionsubscription="yes";}
}
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Sun Dec 14, 2008 7:30 pm |
|
$active is an array. $row['title'] is going to be the title of each of your modules as it cycles through.
$tempo is an array of the values of the row as queried here
Code:
$sql = "SELECT * FROM ".$prefix."_modules WHERE active='1' AND inmenu='1' ORDER BY custom_title ASC";
$modulesaffiche= $db->sql_query($sql);
$tempo = $db->sql_fetchrow($modulesaffiche)
|
So basically $tempo['active'] tell you if a certain module is active or not. (corresponding to the $row['title'])
So to get down to the root of it, the code is creating an array ($active) that contains an array of all the modules and if they are active or not. $row['title'] is the KEY and $tempo['active'] is the value of that key (1 or 0).
Hope I explained that good enough for you ![Dance-Y](modules/Forums/images/smiles/dance.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 1:25 am |
|
mmmmm ok, so can anyone see why Im getting
Quote: |
undefined index title
|
and its in relation to this line
Code:
$active[$row['title']] = $tempo['active'];
|
I would have thought it should be
Code:
$active[$tempo['title']] = $tempo['active'];
|
But that doesnt fix it |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 2:05 am |
|
sorry
Code:
$active[$tempo['title']] = $tempo['active'];
|
the above fixed it
on to the next one
Code:
$moduleinthisgroup[$som_groupmenu][$keyinthisgroup]
|
arrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrgh |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 6:29 am |
|
Still undefined index? Or do you want to know about multi-dimensional arrays? If you want to know about multi-dimentional arrays just look them up on Google. If it is an error what is it? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 3:57 pm |
|
Yer Ive never been one for regular expressions or arrays but it looks like I have to ![Sad](modules/Forums/images/smiles/icon_sad.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Dawg
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/46907b8543f928e08c8d7.gif)
Joined: Nov 07, 2003
Posts: 928
|
Posted:
Mon Dec 15, 2008 4:44 pm |
|
Arrays are pretty easy....RE's on the other hand....are WAY over my head!
Sommaire....is a mess. I have played with mine a couple times and it is tough to mess with.
Dawg |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 5:07 pm |
|
yer simple arrays are fine but the multi-multi-multi-multi-multi-dimensional i dis-like
Ill keep plodding along, I still have 4892 validation errors to fix lol |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
Site Admin
![](modules/Forums/images/avatars/125904890252d880f79f312.png)
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Mon Dec 15, 2008 7:38 pm |
|
Don't use the second level menu, that will clear up about 4800 of them.
montego and I both cleared up a lot of the 'notice' errors and I think montego also did some further compliance work but to be honest, Sommaire has had it's day and it would be easier to write a new script than patch up Sommaire.
TS Menu is pretty good but it does use the old DB abstraction layer in places and it isn't language file aware. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 7:43 pm |
|
testy1 wrote: | Ill keep plodding along, I still have 4892 validation errors to fix lol |
That is why you need to use regular expressions in your text editor. ![Laughing](modules/Forums/images/smiles/icon_lol.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Tue Dec 16, 2008 5:28 am |
|
Yeah, I have a need and desire to rewrite the blasted thing and now that RN has jQuery, that might be a lot easier than it would have been previously. ![Wink](modules/Forums/images/smiles/icon_wink.gif) |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 4:39 am |
|
Im extremely close except for I cant really follow this but from what I can figure out it seems to me that a lot of this could be optimised by using the is_user($user) or is_group?
can anyone follow this well enough to explain it to me
It first defines managementgroup
Code:$managementgroup = 1; // to 0 will force Summary Paramétrable not manage groups. (gain of 1 SQL)
|
then the function which seems to check if your a user and if so it selects your points for some reason ?
Code:
function sommaire_is_user($user, $managementgroup) {
global $prefix, $db, $user_prefix, $uid, $userpoints;
if(!is_array($user)) {
$user = addslashes($user); //v2.1.2
$user = base64_decode($user);
$user = addslashes($user); //v2.1.2
$user = explode(":", $user);
$uid = "$user[0]";
$pwd = "$user[2]";
} else {
$uid = "$user[0]";
$pwd = "$user[2]";
}
$uid = addslashes($uid); //v2.1.2
$uid=intval($uid); //v2.1.2
if ($uid != "" AND $pwd != "") {
if ($managementgroup == 0) {
$sql = "SELECT user_password FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else if ($managementgroup == 1) {
$sql = "SELECT user_password, points FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else {
die("Problème!!");
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pass = $row['user_password'];
if($pass == $pwd && $pass != "") {
$userpoints = ($managementgroup==1) ? $row['points'] : "";
return 1;
}
}
return 0;
}
|
Code:
$is_user = (sommaire_is_user($user, $managementgroup)) ? 1 : 0; // cf. sommaire_is_user function () down
|
and here is an example of how it is being used
Code:
if ($is_user == 1) {
if ($managementgroup == 1 && $subscriptionmanagement == "yes") {
$sql = "SELECT group.id, group.points, sub.userid, sub.subscription_expire FROM " . $prefix . "_groups as group, " . $prefix . "_subscriptions as sub WHERE sub.userid=" . $uid . "";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sql)) {
$pointsneeded[$row['id']] = $row['points'];
echo "$row[subscription_expire]<br />";
}
} elseif ($managementgroup == 1) {
$sql = "SELECT id, points FROM " . $prefix . "_groups";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sql)) {
$pointsneeded[$row['id']] = $row['points'];
echo "$row[subscription_expire]<br />";
}
} elseif ($subscriptionmanagement == "yes") {
$sql = "SELECT id, points FROM " . $prefix . "_groups";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($sql)) {
$pointsneeded[$row['id']] = $row['points'];
echo "$row[subscription_expire]<br />";
}
}
}
|
The reason I am even looking at this code is because when you log out of the site you get the following notice
Code:
Notice: Undefined offset: 2 in I:\xampp\htdocs\rn23\blocks\block-Sommaire.php on line 1191
|
and here is the line if code (its from the function sommaire_is_user above)
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
Site Admin
![](modules/Forums/images/avatars/41f0b40a419280935f3a0.gif)
Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Mon Dec 22, 2008 7:48 am |
|
Sorry to get off topic, but...
I absolutely agree with Montego - it would be much better to use a jquery plugin, CSS for controlling appearance, and a simple list of LI-tagged menu options.
The modules block (and menu / navigation in general) in Nuke is a serious limitation, IMO. We've seen the modules block's use of checking active modules and making those it cannot find inactive effectively shut down active sites simply when it cannot read files in a modules folder (and this happens on some high volume sites). The simple fix? Deactivate the modules block, and replace it with a simple HTML block.
But there really is no reason why we can't have a better approach to navigation in RavenNuke. Maybe start with TS Menu, replace the DB abstraction layer, then use something like Only registered users can see links on this board! Get registered or login! or Only registered users can see links on this board! Get registered or login! or Only registered users can see links on this board! Get registered or login! with standard heading, subheading and menu item classes. The point is, by defining standard classes, you could use CSS to format the menus and jQuery to add special effects and additional formatting. And, it would degrade nicely if a visitor doesn't allow JS (actually, it would look like the standard Nuke menu without the middots...).
Anyone up for this challenge? |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 8:25 am |
|
Oops! I forgot to include another great example: Only registered users can see links on this board! Get registered or login!. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 8:38 am |
|
I would be up for re-working TS Menu to replace the DB abstraction layer and also make in language aware (which it isn't at the moment).
I really liked those jQuery UI Accordian examples in the first link and they seem to degrade fairly well with js disabled. In fact I'm now thinking that I could re-work my News module to be similiar to their first example; have the readmore in the second box and comments/ratings in the third - that would be cool. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 8:53 am |
|
kguske,
testy1,
testy1 wrote: |
It first defines managementgroup
Code:$managementgroup = 1; // to 0 will force Summary Paramétrable not manage groups. (gain of 1 SQL)
|
then the function which seems to check if your a user and if so it selects your points for some reason ?
Code:
function sommaire_is_user($user, $managementgroup) {
global $prefix, $db, $user_prefix, $uid, $userpoints;
if(!is_array($user)) {
$user = addslashes($user); //v2.1.2
$user = base64_decode($user);
$user = addslashes($user); //v2.1.2
$user = explode(":", $user);
$uid = "$user[0]";
$pwd = "$user[2]";
} else {
$uid = "$user[0]";
$pwd = "$user[2]";
}
$uid = addslashes($uid); //v2.1.2
$uid=intval($uid); //v2.1.2
if ($uid != "" AND $pwd != "") {
if ($managementgroup == 0) {
$sql = "SELECT user_password FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else if ($managementgroup == 1) {
$sql = "SELECT user_password, points FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else {
die("Problème!!");
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pass = $row['user_password'];
if($pass == $pwd && $pass != "") {
$userpoints = ($managementgroup==1) ? $row['points'] : "";
return 1;
}
}
return 0;
}
|
Code:
$is_user = (sommaire_is_user($user, $managementgroup)) ? 1 : 0; // cf. sommaire_is_user function () down
| |
All the above code does is set $is_user to either 1 or 0. I don't really see the purpose for all that code, and I hate shorthand if statements
Try this:
Code:
function sommaire_is_user($user, $managementgroup) {
global $prefix, $db, $user_prefix, $uid, $userpoints;
if(is_user($user)) {
if(!is_array($user)) {
$user = addslashes($user); //v2.1.2
$user = base64_decode($user);
$user = addslashes($user); //v2.1.2
$user = explode(":", $user);
$uid = "$user[0]";
$pwd = "$user[2]";
} else {
$uid = "$user[0]";
$pwd = "$user[2]";
}
$uid = addslashes($uid); //v2.1.2
$uid=intval($uid); //v2.1.2
if ($uid != "" AND $pwd != "") {
if ($managementgroup == 0) {
$sql = "SELECT user_password FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else if ($managementgroup == 1) {
$sql = "SELECT user_password, points FROM ".$user_prefix."_users WHERE user_id='$uid'";
}
else {
die("Problème!!");
}
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pass = $row['user_password'];
if($pass == $pwd && $pass != "") {
$userpoints = ($managementgroup==1) ? $row['points'] : "";
return 1;
}
}
} else {
return 0;
}
}
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
elnegro
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Aug 25, 2006
Posts: 34
Location: Verona (ITALY)
|
Posted:
Mon Dec 22, 2008 6:17 pm |
|
kguske wrote: | Sorry to get off topic, but...
I absolutely agree with Montego - it would be much better to use a jquery plugin, CSS for controlling appearance, and a simple list of LI-tagged menu options. |
I like JQuery too, but... I am not able to find a common way to call JQuery libraries inside RavenNuke, in other words, by taking a look to the RN CMS code, I've seen that every module call its javascript routines in its own way. And actually it's hard to integrate new modules without duplicating jquery libraries IMO.
So, what I'am asking is: wouldn't better to change the code in the next release to have a JQuery API (wrapper) to call when needed for new modules? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
testy1
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 7:08 pm |
|
Guardian2003 wrote: | I would be up for re-working TS Menu to replace the DB abstraction layer and also make in language aware (which it isn't at the moment).
|
check your pm's Gaurdian
palbin I will check this out and let you know thanks |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
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 Dec 22, 2008 7:09 pm |
|
Kguske can address this better than I, but I believe that the basic Jquery code is loaded at line 78 of the header.php in RN 2.3. No, that's not true exactly, the code appears to only be loaded if you are inside the Your_Account module but you could easily enough modify that to load it more generally. See the if statement at line 18 of /includes/jquery/jquery.php.
The topic of how to include jquery more generally is under internal discussion for RN 2.4.
As to the original topic discussed in this thread, one of my clients -- who is not a programmer by any stretch of the imagination -- well she is very concerned with her site's appearance and "friendliness" to users and was thus revulsed by the appearance and inflexibility of the modules block. She did exactly what was suggested earlier in this thread: developed a html version of the block. Unless you are constantly fiddling with what modules to display, a simple block does just fine. You just need to know how to create links inside the block -- which the wysiwyg editor makes into a snap especially if you can copy and paste. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Guardian2003
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 22, 2008 8:29 pm |
|
Testy1 - thanks!
Yeah, I hate the standard *nuke module block too but have just not got around to writing something better. I currently use a CSS driven menu on my site which I 'include' into my theme.php file |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Dec 23, 2008 5:35 pm |
|
Just remember, that whatever replacement is written / re-written, it needs to be "aware" of all the various options for when a module should be shown to whom (i.e., registered user, admin only, NSN Group, etc.) and I find the ability to also add an external link invaluable. What I also love about Sommaire is the flexibility to place the menu items just about anywhere. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|