@@ -114,7 +114,10 @@ public function add_section($name, $string){
114114 }
115115
116116 protected function parse_request_mode (){
117- //do nothing, at least for now
117+ if (isset ($ _GET ['action ' ]) && $ _GET ["action " ] != "get " )
118+ $ this ->editing = true ;
119+ else
120+ parent ::parse_request_mode ();
118121 }
119122
120123 //parse GET scoope, all operations with incoming request must be done here
@@ -134,10 +137,10 @@ protected function parse_request(){
134137 //data saving
135138 $ this ->editing = true ;
136139 }
140+ parent ::check_csrf ();
137141 } else {
138142 if (isset ($ _GET ['editing ' ]) && isset ($ _POST ['ids ' ]))
139143 $ this ->editing = true ;
140-
141144 parent ::parse_request ();
142145 }
143146
@@ -149,7 +152,10 @@ protected function parse_request(){
149152 /*! renders self as xml, starting part
150153 */
151154 protected function xml_start (){
152- $ start = parent ::xml_start ();
155+ $ start = "<data " ;
156+ foreach ($ this ->attributes as $ k =>$ v )
157+ $ start .= " " .$ k ."=' " .$ v ."' " ;
158+ $ start .= "> " ;
153159
154160 foreach ($ this ->sections as $ k =>$ v )
155161 $ start .= "< " .$ k ."> " .$ v ."</ " .$ k ."> \n" ;
@@ -195,7 +201,7 @@ protected function fill_collections($list=""){
195201 $ name = $ k ;
196202 $ option ="\"{$ name }\":[ " ;
197203 if (!is_string ($ this ->options [$ name ]))
198- $ option .=substr ($ this ->options [$ name ]->render (), 0 ,- 2 );
204+ $ option .=substr (json_encode ( $ this ->options [$ name ]->render ()), 1 ,- 1 );
199205 else
200206 $ option .=$ this ->options [$ name ];
201207 $ option .="] " ;
@@ -274,8 +280,11 @@ function to_xml(){
274280 }
275281
276282 if ($ this ->userdata !== false )
277- foreach ($ this ->userdata as $ key => $ value )
283+ foreach ($ this ->userdata as $ key => $ value ){
284+ if ($ value === null )
285+ $ data [$ key ]="" ;
278286 $ data [$ key ]=$ value ;
287+ }
279288
280289 return $ data ;
281290 }
@@ -340,7 +349,7 @@ function to_xml_start(){
340349 $ str .=" " .$ key ."=' " .$ this ->xmlentities ($ value )."' " ;
341350
342351 if ($ this ->kids === true )
343- $ str .=" dhx_kids ='1' " ;
352+ $ str .=" " .Connector:: $ kids_var . " ='1' " ;
344353
345354 return $ str ."> " ;
346355 }
@@ -394,7 +403,11 @@ protected function parse_request(){
394403 /*! renders self as xml, starting part
395404 */
396405 protected function xml_start (){
397- return "<data parent=' " .$ this ->request ->get_relation ()."'> " ;
406+ $ attributes = " parent=' " .$ this ->request ->get_relation ()."' " ;
407+ foreach ($ this ->attributes as $ k =>$ v )
408+ $ attributes .= " " .$ k ."=' " .$ v ."' " ;
409+
410+ return "<data " .$ attributes ."> " ;
398411 }
399412}
400413
@@ -420,6 +433,10 @@ protected function output_as_xml($res){
420433 if (!empty ($ this ->options ))
421434 $ data ["collections " ] = $ this ->options ;
422435
436+
437+ foreach ($ this ->attributes as $ k =>$ v )
438+ $ data [$ k ] = $ v ;
439+
423440 $ data = json_encode ($ data );
424441
425442 // return as string
@@ -489,7 +506,7 @@ function to_xml_start(){
489506 $ data [$ key ]=$ value ;
490507
491508 if ($ this ->kids === true )
492- $ data [" dhx_kids " ] = 1 ;
509+ $ data [Connector:: $ kids_var ] = 1 ;
493510
494511 return $ data ;
495512 }
0 commit comments