[prev in list] [next in list] [prev in thread] [next in thread] 

List:       midgard-dev
Subject:    [midgard-dev] Fix for broken mgd_get_*_by_name() functions
From:       Peter Suschlik <peter () zilium ! de>
Date:       2002-03-29 17:43:03
[Download RAW message or body]

Hi,

today I installed a fresh "cvs update"d version of midgard.
Then I realized that mgd_get_element_by_name() did not work.
(e.g. http://oldadmin/style/1.html)

I turned mysql query logging on and saw:

..
SELECT id FROM element WHERE (style=1 AND name=ROOT) AND (sitegroup IN (0,0) OR 1<>0)
..

This was the query of:
/* Oldadmin
   URL: host/page/element/<[code-init]>
   Function: DisplayStyleElement()
   Line: 12
 */
mgd_get_element_by_name(1, "ROOT"); 

ROOT was not quoted.

This happens in php4/element.c -- function get_element():
<snip>
..
objid = mgd_exists_id(mgd_handle(), "element", "style=$d AND name=$s",
                                                                  ^^
..
</snip>

``$s'' this should be ``$q''.

Fix:
cd php4/ && perl -i.old -pe 's/name=\$s/name=\$q/' *.c

This changed the following files:
article.c
element.c
host.c
page.c
pageelement.c
pagelink.c
person.c
snippet.c
style.c


Maybe, I totally wrong or the fix should happen elsewhere.
If so, sorry :)

Regards
  Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@midgard-project.org
For additional commands, e-mail: dev-help@midgard-project.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic