1811
trabis
Re: BLOCKS ONE MORE AGAIN
  • 2008/1/20 15:32

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Uau, it is a DOUBLED big problem

https://xoops.org/modules/newbb/viewtopic.php?topic_id=62651&forum=21&post_id=282233#forumpost282233



1812
trabis
Re: BLOCK PREMISSION PROBLEM!
  • 2008/1/20 15:28

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


If it is a bug then turning on the debugger would help.
You should try to install modules one by one to isolate the problem and then report the debugger errors if any.
Also check those modules requirements (Frameworks, smartobject, etc)



1813
trabis
Hacking multimenu for showing selected menus
  • 2008/1/20 14:34

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi,

I love multimenu but I miss one important feature, when I hit a menu link then link should be turned to selected.

Yesterday I hacked multimenu so here's what the hack does:

When you click a mainmenu it highlights the mainmenu
When you click a submenu it highlights the correspondig mainmenu
When you browse your site in pages that aren´t linked directly in the menu it highlights the corresponding module menu.
If theres is no corresponding module menu than it highlights a default menu (Home for example, but you can change it)

To take a quick look just visithttp://www.luso-poemas.net

So here's what to do:
Go to modules/multiMenu/blocks/block.php

At the end find:
$block['contents'][] = $imenu

// Sublinks
// Groups
}

return 
$block;
?>


And replace with this:
//start of hack by trabis for selected menus
$imenu['id'] = $myrow['id'];
$imenu['pid'] = $myrow['pid'];

$block['contents'][] = $imenu

// Sublinks
// Groups
}


//get the currentpage
$query_string $_SERVER['QUERY_STRING']?'?'.$_SERVER['QUERY_STRING']:'';
$self 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].$query_string;
//set a default page in case we don´t get matches
$default XOOPS_URL."/index.php";

//get all the links that could fit into this pageplus the default link
$i 0;
foreach (
$block['contents'] as $menu){
    
$link $menu['linkurl'];
    
$selected eregi($menu['linkurl'], $self)? 10;
    
$selected = ($menu['linkurl'] == $self) ? 1$selected;
    
$selected = ($menu['linkurl'] == $default) ? 1$selected;
    
$block['contents'][$i]['selected'] = $selected;
    
$i++;
}

//From those links get only the longer one
$i 0;
$issub 0;
foreach (
$block['contents'] as $this_menu){
    
$other 0;
    foreach (
$block['contents'] as $other_menu){
        if(
$this_menu['selected']==&& $other_menu['selected']==1){
            if (
strlen($other_menu['linkurl']) < strlen($this_menu['linkurl'])){
                
$block['contents'][$other]['selected'] = 0;
                
$issub $this_menu['submenu'];
                
$subid $this_menu['id'];
                
$subord $i;
            }
        }
        
$other++;
    }
    
$i++;
}

//if the longer link is in a sub menu than change selection to the parent menu
if ($issub == 1){
    
//get the parent menu
    
$sql =     "SELECT id, pid, groups, link, submenu, title, target, imageurl, weight
       FROM "
.$xoopsDB->prefix('multimenu').$options[15]."
    WHERE id="
.$subid;
    
$result $xoopsDB->queryF($sql);
    
$myrow $xoopsDB->fetchArray($result);

    
$i 0;
    foreach (
$block['contents'] as $mainmenu){
        
//changing selections
        
if ($mainmenu['id'] == $myrow['pid']){
            
$block['contents'][$i]['selected'] = 1;
            
$block['contents'][$subord]['selected'] = 0;
        }
        
$i++;
    }
}
//end of hack by trabis for selected menus

return $block;
?>


Ok, now you have an extra variable to use in your templates

<{if $imenu.selected}>add your class here<{/if}>

Here is an example for multimenu_dyn_horiz_css.html:
<!-- Start multiMenu <{$block.mm}> -->
<
div class="menuhcss">
<!-- 
Start multiMenu <{$block.mm}> -->
<{
assign var=ul_main value=0}>
<{
assign var=ul_sec  value=0}>

<{foreach 
item=imenu from=$block.contents}>
<{if 
$imenu.submenu == 0}>
<{if 
$ul_sec == 1}></ul><{assign var=ul_sec value=0}><{/if}>
    <{if 
$ul_sec == 1}><{assign var=ul_sec value=0}><{/if}>
        <{if 
$ul_main == 1}>
            <!--[if 
lte IE 6]>
            </
td></tr></table>
            </
a>
            <![endif]-->
            </
li>
            </
ul>
            <{
assign var=ul_main value=0}>
        <{/if}>
        <{if 
$ul_main == 0}>
            <{
assign var=ul_main value=1}>
        <{/if}>

        <
ul>
        <
li>
        <
<{if $imenu.selected}>class="hide_selected"<{else}>class="hide"<{/if}><{if $imenu.linkurl}>href="<{$imenu.linkurl}>"<{/if}> title="<{$imenu.alt_title}>"><{$imenu.image}>&nbsp;<{$imenu.title}></a>
        <!--[if 
lte IE 6]>
        <
<{if $imenu.selected}>class="selected"<{/if}>href="<{$imenu.linkurl}>" title="<{$imenu.alt_title}>"><{$imenu.image}>&nbsp;<{$imenu.title}>
        <
table><tr><td>
        <![endif]-->

<{elseif 
$imenu.submenu == OR $imenu.submenu == 2}>
        <{if 
$ul_sec == 0}><ul><{assign var=ul_sec value=1}><{/if}>
        <
li><<{if $imenu.linkurl}>href="<{$imenu.linkurl}>"<{/if}> title="<{$imenu.alt_title}>"><{$imenu.image}>&nbsp;<{$imenu.title}></a></li>

<{elseif 
$imenu.submenu == 3}>
        <{if 
$ul_sec == 0}><ul><{assign var=ul_sec value=1}><{/if}>
        <
div><li><class="note" <{if $imenu.linkurl}>href="<{$imenu.linkurl}>"<{/if}> title="<{$imenu.alt_title}>"><{$imenu.image}>&nbsp;<{$imenu.title}></a></li></div>

<{elseif 
$imenu.submenu == 4}>
        <{if 
$ul_sec == 0}><ul><{assign var=ul_sec value=1}><{/if}>
        <
div><li><class="cat" <{if $imenu.linkurl}>href="<{$imenu.linkurl}>"<{/if}> title="<{$imenu.alt_title}>"><{$imenu.image}>&nbsp;<{$imenu.title}></a></li></div>

<{/if}>
<{/foreach}>
  <{if 
$ul_sec == 1}></ul><{/if}>
    <{if 
$ul_main == OR $ul_sec == 1}>
    <!--[if 
lte IE 6]>
    </
td></tr></table>
    </
a>
    <![endif]-->
    </
li>
    </
ul>
    <{/if}>
<!-- 
End multiMenu <{$block.mm}> -->
</
div>


You have to add the correspondig classes to the corresponding css, in my case I added class "selected" and "hide_selected".
In script/08/basic_dd.css:
.menuhcss ul li a.hide_selected, .menuhcss ul li a:visited.hide_selectedmenuhcss ul li a.selected, .menuhcss ul li a:visited.selected{
background-imageurl('http://www.luso-poemas.net/modules/multiMenu/templates/images/links_over.jpg');
background-repeatrepeat-x;
color#027AD2;
height20px
padding
0px;
}


In script/08/basic_dd_ie.css:
/* ignore the link used by 'other browsers' */
.menuhcss ul li a.hide, .menuhcss ul li a:visited.hide .menuhcss ul li a.hide_selected, .menuhcss ul li a:visited.hide_selected{
display:none;
}


That´s it!



1814
trabis
Re: Hack the "recent comment block"
  • 2008/1/20 13:55

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi,
Yes that it!
Now one more step:

Go to system/blocks/system_blocks.php and

find this function:
function b_system_comments_show($options)

find this line:
$com['time'] = formatTimestamp($comments[$i]->getVar('com_created'),'m');

add just bellow:
$com['text']= $comments[$i]->getVar('com_text');

Ok, it should work now!

Oh, one thing, if you want to show smilies etc I think you must do it this way:

$myts =& MyTextSanitizer::getInstance();
$com['text'] = $myts->displayTarea($comments[$i]->getVar('com_text'),1,1,1);



1815
trabis
Re: php usage question
  • 2008/1/18 20:45

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


"probably" you have the same definition in
/modules/backup/language/english/main.php

It is nothing you should worry about.
To get rid of those messages turn debugger off, eheh, or try to comment that duplicated line in main.php
/* DEFINE (_BLABLABLA...);*/



1816
trabis
Re: OK, now I'm officially scared.
  • 2008/1/18 13:51

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Recently I had problems with one user claming she recieved passwords request that she did not done. I followed the IP to USA (my users are mostly form Portugal and Brazil). Then I googled that Ip and found some threads refering that IP to google. Latter she told me that her password was allways changing to the old password. Every day she changed passords and the next day she add to use the old one because the new would not work anymore. She even showned her last login date, it was about 3AM, and that means that someone logged in her account.
My conclusion:
It was not google but some hacker using a proxy that has access to her registered email and then request a password. Then the hacker deletes the request form her email account, logs into the site and change her password again (yes this is strange).
Wath I did:
Hacked XOOPS so it don´t send new passwords to that user and provide that user a new password. No problems since that.

I took a month to do this cause I though that she was crazy or kidding me.

:)



1817
trabis
Re: Xoops Modules (All Xoops Users Please Read)
  • 2008/1/17 13:49

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Yesterday I found a module in XoopsAddons called cforge. It is based in xoopsforge but has been improved. It is 95% compatible with XOOPS 2.0 series, already using smarty, etc. The hard job is already done so I put 2001 xoopsforge apart.
This cforge also works with register globals on wich is a vulnerability. Some times it picks GETS and POSTS and trow them directly to queries. Cforge is a great step, saved me a lot of work but, but it is not finished yet, many bugs.

I've already made it work with register globals off and fixed some forms here and there, later I will install it in xuups.com so we can debug it better.



1818
trabis
Re: Xoops Modules (All Xoops Users Please Read)
  • 2008/1/16 0:00

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Placing xf in modules folder, adding a xoopsversion.php, changing relative paths and installing it made it work!

Now, for solving the globals issue I added some lines in pre.php (this is included everywere)

//POSTS and GETS
$strings = array(
'update','feedback','_summary','_details',
'search','substr','status','action','list_of_groups','response_text','response_title',
'add_to_can','submit','resend','form_public','form_status','form_license',
'group_type','form_domain','action2','sure','string''submit',
);

$ints = array(
'is_public','_is_public','_diary_id','response_id','group_id','user_id','diary_id'
);

foreach (
$strings as $k){
    $
$k '';
}

foreach (
$ints as $k){
    $
$k '';
}

if ( isset(
$_POST) ) {
    foreach ( 
$_POST as $k => $v ) {
        if (
in_array($k,$strings)){
            $
$k addslashes($v);
        }
    }
}

if ( isset(
$_GET) ) {
    foreach ( 
$_GET as $k => $v ) {
        if (
in_array($k,$strings)){
            $
$k addslashes($v);
        }
    }
}

if ( isset(
$_POST) ) {
    foreach ( 
$_POST as $k => $v ) {
        if (
in_array($k,$ints)){
            $
$k intval($v);
        }
    }
}

if ( isset(
$_GET) ) {
    foreach ( 
$_GET as $k => $v ) {
        if (
in_array($k,$ints)){
            $
$k intval($v);
        }
    }
}


Now everytime I get an undefined variable I just add it to the corresponding array(strings or ints)!!

Can anybody check if this code is safe to use?
How should I sanitize it better?



1819
trabis
Re: Xoops Modules (All Xoops Users Please Read)
  • 2008/1/15 22:20

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I took a look in xoopsforge and I was able to get it installed, not bad!
Then I made the administration to work.
But now I´m pretty stuck.
I got errors in header and footer and I think it is because the XF folder is outside de modules folder and XOOPS does not reconize it.
It will be a great problem to make it work as a module I think.

:(



1820
trabis
Re: Xoops Modules (All Xoops Users Please Read)
  • 2008/1/14 18:38

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I can take number 4. :)




TopTop
« 1 ... 179 180 181 (182) 183 184 185 ... 190 »



Login

Who's Online

220 user(s) are online (136 user(s) are browsing Support Forums)


Members: 0


Guests: 220


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits