![]() |
[CI2.0] XML-RPC Server & Drivers - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [CI2.0] XML-RPC Server & Drivers (/showthread.php?tid=31101) |
[CI2.0] XML-RPC Server & Drivers - El Forum - 06-06-2010 [eluser]Schotte[/eluser] Hi all, I have started to work with CI 2.0 and been trying to port an XML-RPC server of mine across to the new version. My thoughts are that it would be easiest to create a driver called Api for example. Then for each additional module that one creates one can simply dump one file into the Api/drivers folder that handles the API requests for that module. Now for the XMLRPCS class. Some adaptations are necessary for it to work: 1) When defining the callback functions in the controller do it in this way (assuming driver is $api->module->function() ): Code: $config['functions']['mymodule.myfunction'] = array('function' => 'api.module.function'); 2) In the _execute() method of xmlrpcs: lines 285 - 292 replaced by this (in MY_Xmlrpcs) Code: if (($num_parts = count($method_parts)) <= 2 || $num_parts > 3) lines 346 - 349 replaced by this Code: if (count($method_parts) <= 2) Now to my problem. I basically circumvent the security check whether the requested method is callable or not (HUGE flaw). As I believe that I need to change this I have looked on the internet whether it would somehow be possible to get PHP's is_callable() working with 3 parts (driver, object, method) as opposed to 2 (object & method), but haven't turned up anything just yet. Anyone of you bright guys got an idea on how this could be tackled? Furthermore I am open to change my approach from drivers to a better architecture if you have one. I want the system to be easily scalable without having to manually edit the code when a new module is installed. Regards, Schotte [CI2.0] XML-RPC Server & Drivers - El Forum - 06-06-2010 [eluser]Jamie Rumbelow[/eluser] Since the XML-RPC library is built into CodeIgniter's Standard Library, couldn't you just create a driver specific to your API, then use that to interface with the XML-RPC library directly? That would make more sense than trying to morph the actual library into a driver. Also, there are some architectural differences with different types of APIs you'll want to take into account. Jamie [CI2.0] XML-RPC Server & Drivers - El Forum - 06-07-2010 [eluser]Schotte[/eluser] [quote author="Jamie Rumbelow" date="1275887408"]Since the XML-RPC library is built into CodeIgniter's Standard Library, couldn't you just create a driver specific to your API, then use that to interface with the XML-RPC library directly?[/quote] That's exactly what I am trying to do. The problem with using a driver is that it has the format $this->driver_name->driver_class->function(). To check whether this is a callable method does not work with is_callable(). Therefore I am looking for a solution how to check whether a driver is callable. [quote author="Jamie Rumbelow" date="1275887408"]That would make more sense than trying to morph the actual library into a driver.[/quote] I am not trying to morph the xml-rpc class into a driver. Just trying to change the function calls away from models. Drivers have the unique possibility of adding more functionality to them by altering the array "valid_drivers" (i.e. adding entries via mysql). [quote author="Jamie Rumbelow" date="1275887408"]Also, there are some architectural differences with different types of APIs you'll want to take into account.[/quote] Can you give brief examples? Cheers for the quick response already, Schotte [CI2.0] XML-RPC Server & Drivers - El Forum - 07-03-2010 [eluser]Schotte[/eluser] *bump* ![]() |