GithubHelp home page GithubHelp logo

frapi / frapi Goto Github PK

View Code? Open in Web Editor NEW
621.0 621.0 177.0 11.3 MB

FRAPI is an API Open Source framework, run it within your hosting environment parallel to your web app, mobile service or legacy system.

Home Page: http://getfrapi.com

License: BSD 2-Clause "Simplified" License

Ruby 0.01% Shell 0.01% PHP 99.67% JavaScript 0.33%

frapi's Introduction

frapi's People

Contributors

bacteries avatar bennocrombeen avatar clayhinson avatar dragonmantank avatar dshafik avatar epixa avatar ergoflo avatar funkatron avatar helgi avatar jasonrhodes avatar jbafford avatar jeremykendall avatar kudos avatar mavimo avatar max13 avatar memfill avatar trevormorse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frapi's Issues

oAuth ?

Really nice start :)
Most of the API's I tapped into these days authenticate with oAuth. Will the frapi plain text key eventually be replaced with this per chance? Or at least a hook where I can add my own oAuth classes would be suffice. Thanks

Zend Session Exception

After setup, I can't get the admin or frontend to load at all. Frontend just returns a 500 server error, but admin gives me a bunch of PHP Notices followed by one Fatal Error, seen below:

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Session must be started before any output has been sent to the browser; output started in /Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php/384' in /Users/jason/frapi/src/frapi/library/Zend/Session.php:454
Stack trace:
#0 /Users/jason/frapi/src/frapi/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /Users/jason/frapi/src/frapi/admin/application/Bootstrap.php(30): Zend_Session_Namespace->__construct('locale')
#2 /Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(662): Bootstrap->_initLanguages()
#3 /Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(615): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('languages')
#4 /Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
#5 /Users/jason/frapi/src/frapi/library/Zend/Application.php(355) in /Users/jason/frapi/src/frapi/library/Zend/Session.php on line 454

Thoughts on this? (Also submitted this to the Google frapi-dev group.)

Added the notices here:

Notice: require_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/admin/application/Bootstrap.php]  h->filename=[/Users/jason/frapi/src/frapi/admin/application/Bootstrap.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Application.php on line 320

Notice: require_once(): apc_cache_find [257072932]
 in /Users/jason/frapi/src/frapi/library/Zend/Application.php on line 320

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/Bootstrap.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/Bootstrap.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073436]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073437]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/Bootstrapper.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/Bootstrapper.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073438]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/ResourceBootstrapper.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Bootstrap/ResourceBootstrapper.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073440]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257074608]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader/Interface.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader/Interface.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257074611]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Modules.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Modules.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php on line 384

Notice: include_once(): apc_cache_find [257073455]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php on line 384

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/ResourceAbstract.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/ResourceAbstract.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073459]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Resource.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Resource.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073458]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Frontcontroller.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Resource/Frontcontroller.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php on line 384

Notice: include_once(): apc_cache_find [257073450]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader/PluginLoader.php on line 384

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Application/Module/Autoloader.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Application/Module/Autoloader.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073443]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Loader/Autoloader/Resource.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Loader/Autoloader/Resource.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257074606]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Loader/Autoloader/Interface.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Loader/Autoloader/Interface.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257074605]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Registry.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Registry.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257075519]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Translate.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Translate.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076314]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Adapter/Gettext.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Adapter/Gettext.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076320]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Adapter.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Adapter.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076316]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Locale.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Locale.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257074612]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Exception.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Translate/Exception.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076327]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Exception.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Exception.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257073851]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Session/Namespace.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Session/Namespace.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076026]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Session/Abstract.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Session/Abstract.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076024]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Session.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Session.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076022]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): 1. h->opened_path=[/Users/jason/frapi/src/frapi/library/Zend/Session/Exception.php]  h->filename=[/Users/jason/frapi/src/frapi/library/Zend/Session/Exception.php]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Notice: include_once(): apc_cache_find [257076025]
 in /Users/jason/frapi/src/frapi/library/Zend/Loader.php on line 146

Duplicate bootstrap causes fatal error when generating code coverage

Received when running unit tests:

Generating code coverage report, this may take a moment.PHP Fatal error: Cannot redeclare class Default_Bootstrap in /home/jeremykendall/public_html/frapi/src/frapi/admin/application/modules/default/controllers/Bootstrap.php on line 20

XML output and special characters

Hi all,

I have an issue with FRAPI's XML output and special characters.
Parsing the xml at the output gives errors like:

simplexml_load_string(): Entity: line 266: parser error : PCDATA invalid Char value 26 in....

Could anyone help?

Thanks

Characters escaped when creating action

Hi again !

I've noticed that sometimes (with cache set to "dummy" or "apc") when creating action, then editing it online, the code is escaped when synced...
Actually, every $data['var1'] are escaped as $data['var1'], even in comments.

Is it the normal behaviour, is it because I'm using single quote, or because I don't have any cache set...
Thank you for your help.

Example: http://pastebin.com/aYbNWqjK
Line 20, 39...

Is Partner data available to actions?

Hey everybody, I'm not actually sure if this is a feature request or a documentation request, but anyhow, I'm developing an API where different users need to be presented with their respective info.
What I actually need to do is get the name (email?) for the partner that is accessing the API so I know what data I should answer with.
I know I could have everybody pass in theri username with their requests, but since they are already authenticating, I don't think it makes sense.
Is there any way to know who is calling the API?? from the action code.

Thanks!!

By the way, awesome framework you got here, keep up the good work!

Localizing Lupin

I have a small problem:

Submitting NULL values triggers Lupin response with the default placeholder that we need to localize.
/src/frapi/library/Lupin/Form.php: 'isEmpty' => 'This field requires a value but you submitted nothing.', is the example

Can we set programatically default form values from within the forms or controllers of the admin application?

Basic Auth

The platform I am using doesn't yet support Digest Auth, what would be my best route to implementing Basic Auth?

Reversing these changes?

5486683

Modify "new action" files

Hi,

I'm using frapi, and for all my apis, I'm adding manually my custom functions and variables (like an init, which does the same thing on all actions, all files).

Is There a way to modify custom action default page ? Un order to add my custom function for every new actions?

Thanks

Lupin_Security::escape() throws E_STRICT

Error

Strict standards: call_user_func() expects parameter 1 to be a valid callback, non-static method Lupin_Security::escape() should not be called statically

Stuff breaks when FRAPI is not at DocumentRoot

I have a VirtualHost set up with Alias directives pointing to the public/ and admin/public/ directories.

It looks like a lot of paths are defined in the templates with relative paths starting with a slash, so none of the JS/CSS/images load, and all the links are broken.

Role groups for partners

At the moment the permissions for actions are either public or partner access. It would be very useful if user-created roles groups could be introduced

E.g. -

  • Public (For aggregating tools of public data etc)
  • 3rd Party Developers (Creating User Interfaces / Mashups etc)
  • Industry Partners (Giving select partners more permissions than developers)
  • Root Users (For creating management level applications, bulk changes, delete commands)

And then permissions for each action can be set based on partner groups and partners are then added to groups. I really do think this would add to the flexibility of the solution.

(Code Could not connect) via TCP???

I've created the API and it works fine if i open it in a separate browser window - however if i use the Tester part of FRAPI Admin I get an error saying:

Error: Unable to connect to
tcp://api.WEBSITEURL.co.uk:80. Error
#10060: A connection attempt failed because
the connected party did not properly respond
after a period of time, or established
connection failed because connected host has
failed to respond.

I get a similar message if I add my database credentials to the config. If i manually add mysql_connect('host', 'user', 'pass') to my code file it works fine.

Is this error caused by my setup or FRAPI?

Failing unit tests

At the moment there are 10 failures in the unit test:

FAILURES!
Tests: 140, Assertions: 151, Failures: 10, Incomplete: 11, Skipped: 7.

Adjust Unit Tests

Please update the unittests so they match the current API. Right now the unit-tests are vastly outdated.

returning Frapi_Error from an action errors when output is JSON

The JSON output class expects its data to be an array, and cannot handle a Frapi_Error object.

throwing the Frapi_Error causes it to be handled properly, but the default code template uses return if validation errors occur.

The generated action should throw Frapi_Error by default and the documentation may need to be updated to reflect this.

Class 'XMLWriter' not found

For whoever maintains the documentation:
could you add XMLWriter as a dependency in your installation page?

I spent hours trying to figure this out. I was getting a "Class 'XMLWriter' not found" fatal error. I thought it was part of the Zend library or something. It ended up being that FRAPI has a dependency on the XMLWriter extension. Normally this is compiled into the PHP core, but on CentOS servers, like myself, it's sometimes NOT compiled into the core. I'm not too sure if it affects other distributions since XMLWriter is "usually" compiled into PHP from the get go.

If you're seeing this error make sure you are working with the correct PHP CLI. On my server there were two, one for PHP 5.2 and another for PHP 5.3. Drop in a phpinfo(); in a discrete file on your server and navigate to it. SSH into your server and type in php -i. The output should match, including the same PHP version. Check if If it's different issue a locate bin/php to see if there are multiple versions of PHP installed on your server. If that's so, use the path of the newly founded PHP and issue the same -i flag. For instance, if your "other" version of PHP was located at /usr/bin/php issue a /usr/bin/php -i. At that point you can install xmlwriter by using phpize and compiling it manually from the PHP sources of your specific PHP version. If you running into issues compiling after you issue make you might need to install the developer sources of certain packages. For instance, for me I was getting a pcre*.h error. I just installed the PCRE developer sources through yum with yum install pcre-devel then ran make again and XMLWriter compiled just fine.

Output type determination priority

Since commit 231a420 , requesting a ressource via URI does not override accept header.
imho, http://$HOST/$RESSOURCE.xml should return xml no matter what the accept header is.

Add HTTP methods to frapi

Hi !
Is there a way to add some other HTTP methods to frapi ?
Like for example, PATCH, OPTIONS, TRACE...?

If there is, can you please tell me how to do that ?

Thanks.

New items not saving, but editing works

This could be a setup problem, although I'm unsure how to debug it (yet). Note: I only followed the guide. Hopefully it's something simple.

I set up frapi, and it seemingly works except added new items aren't being saved. For example, I'm unable to add new actions/errors/partners. However, editing the current ones works. This also applies to configurations where editing works, but adding new items does not.

I now see that adding a partner simply emits a near blank page with "bool(false)" so that should be easier to debug, whereas the other items act as the though the item was saved (e.g., "Error code E_FOO added.")

File permissions seem fine, and editing the XML files manually works too. And "Sync Now" was used. Also, the docs don't mention CouchDB setup, or where/if it's used yet.

Submenu optimization (UI/UX)

Into admin section, if a user chose Configuration into main menu and after Users into submenu, submenu desappair. This can be a usability issue.

Updating custom route causes variables do disappear

After updating my custom route to add or remove a variable $this->getParams returns parameters added via the admin interface but not via the custom url definition.

Clearing the cache via the admin interface did not fix the problem for me, an apache restart was required.

json_encode needs utf8 data

frapi / src / frapi / library / Frapi / Output / JSON.php

Line: 79

$returnedData = json_encode($this->response);

For some reason this doesn't always happen.

Got it to work by using a snipped I ripped of php.net to JSON-encode arrays (probably should handle objects as well?)

function utf8_encode_all($dat) // -- It returns $dat encoded to UTF8 
{ 
  if (is_string($dat)) return utf8_encode($dat); 
  if (!is_array($dat)) return $dat; 
  $ret = array(); 
  foreach($dat as $i=>$d) $ret[$i] = utf8_encode_all($d); 
  return $ret; 
} 

Then it worked. Probably is another way of doing this. Unclear why i got this error though since my database is in utf8 already. Perhaps server configs are at play here too...

Deleting error, action, probably anything that touches xml file breaks xml

With the sample errors.xml code like this:

<?xml version="1.0" encoding="UTF-8"?>
<frapi-config>
 <errors>
  <error>
   <name>ERROR_EXAMPLE</name>
   <message>This is an example error.</message>
   <http_code>405</http_code>
   <description>This error is used as an example for both the API and the automatically generated documentation which can be found at admin.frapi/docs/generate/format/md</description>
   <hash>e06f885297d44a9faf5703252c638b3dcdec6986</hash>
  </error>
  <error>
   <name>TEST</name>
   <message>The error</message>
   <http_code>404</http_code>
   <description>Used in documentation</description>
   <hash>137595984a31492d0637fe873922537b13094e53</hash>
  </error>
 </errors>
</frapi-config>

If I remove the ERROR_EXAMPLE entry via the interface the xml then looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<frapi-config>
 <errors>
  <error>
   <error>
    <name>TEST</name>
    <message>The error</message>
    <http_code>404</http_code>
    <description>Used in documentation</description>
    <hash>137595984a31492d0637fe873922537b13094e53</hash>
   </error>
  </error>
</errors>
</frapi-config>

Note the double opening and closing error tags. Which causes the following php error:

Notice: Undefined index: name in FRAPI_PATH/src/frapi/admin/application/modules/default/views/scripts/errors/index.phtml on line 15

Declaration of Frapi_Response_Custom::setData() should be compatible with that of Frapi_Response::setData()

Hi I have found this issue on my local environment(osx, apache 2.2, php 5.3.2) right after I've completed the setup:

Strict Standards: Declaration of Frapi_Response_Custom::setData() should be compatible with that of Frapi_Response::setData() in FRAPI_PATH/frapi/src/frapi/library/Frapi/Response/Custom.php on line 34

Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'Session must be started before any output has been sent to the browser; output started in FRAPI_PATH/frapi/src/frapi/library/Frapi/Response/Custom.php/34' in FRAPI_PATH/frapi/src/frapi/library/Zend/Session.php:454

Stack trace:
#0 FRAPI_PATH/frapi/src/frapi/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 FRAPI_PATH/frapi/src/frapi/admin/application/Bootstrap.php(31): Zend_Session_Namespace->__construct('locale')
#2 FRAPI_PATH/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(662): Bootstrap->_initLanguages()
#3 FRAPI_PATH/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(615): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('languages')
#4 FRAPI_PATH/frapi/src/frapi/library/Zend/Application/Bootstrap/BootstrapAbstract.ph in FRAPI_PATH/frapi/src/frapi/library/Zend/Session.php on line 454

This is due to a little error(type hinting's missing) in overriding setData() method. Here's the patch to fix the problem:

diff --git a/src/frapi/library/Frapi/Response/Custom.php b/src/frapi/library/Frapi/Response/Custom.php
index b34a194..10255dd 100644
--- a/src/frapi/library/Frapi/Response/Custom.php
+++ b/src/frapi/library/Frapi/Response/Custom.php
@@ -27,7 +27,7 @@ class Frapi_Response_Custom extends Frapi_Response
      * @param  string $data The data to set in the response.
      * @return void
      */
-    public function setData($data)
+    public function setData(array $data)
     {
         $this->data = $data;
     }

Terminal Client

Someone has to create a terminal CLI client to use alternatively instead the administration interface (In case someone doesn't feel like using the admin interface).

Problem with /custom/config/errors.xml file

I can't tell exactly what the problem is but whenever I've used a pull of Frapi (as of this writing), there is an error after deleting an error but only on the first error I delete inside the admin interface. It doesn't matter if I've added additional errors first or not.

The end result is that in the admin, the errors page is blank. You can add new errors and those will show up but the already existing errors do not show up.
What is happening is that the delete is successful but the remaining errors are wrapped with an additional tag. So you end up with something like this (image its XML) :
errors
error

error
Error Data

/error

error
Error Data

/error

/error

/errors

The solution I found was to recreate the errors.xml file and save it back in. This solves the problem. I'm guessing there is a weird character in the file that is breaking things but the fix is simple enough.

FYI: I haven't tried to recreate the problem on a Unix platform. I wrote the article on running Frapi in IIS 7 you recently tweeted about so naturally, I am running Frapi on IIS 7.5 with Wincache.

Please let me know if you have any questions.

Let's localize more

ActionController.php has about half the output still in English only (embedded), and I am not talking error output only, there are still bits that addMessage like $this->addMessage('Development environment has been sychronized'); (line 234)

getParam() method ignores "default" parameter

The getParam() method of the Frapi_Action class accepts a "default" parameter (The default value, if param is empty). Apparently, this parameter is never used.

I wanna do something similar like:

$limit = $this->getParam('limit', self::TYPE_INTEGER, 20);

When no or an invalid limit is passed, the function will return 0, this seems incorrect behavior.

It should return the default (20) when the param is:

  • Not passed
  • Empty (empty string, but does the number zero count as empty also?)
  • Invalid ('abc' casted to integer returns 0, but can it be interpreted as empty?)

The $error_name parameter (The error name to raise, as last resort) also seems unused. Additionally, it would be useful to have a simple hasParam() which returns a boolean.

If you need any help implementing, let me know!

Defaults

Updating: it seems this is related to the setting of JSON being default output not being respected.

Use case:

I don't want HTML output, and I want it to default to JSON.

Going into a custom controller, like /potatoes gives me this error:

MISSING_HTML_TEMPLATE, with message: If you want HTML, you need to create Potatoes.html.tpl in the frapi/src/frapi/custom/Output/html directory

/potatoes.json works just fine though.

Any ideas?

Notice error in documentation generator for no parameter actions

When viewing /docs under the admin api or trying to generate pdf documentation
Notice: Undefined index: parameters in /home/baoh/www/frapi/src/frapi/admin/application/modules/default/views/scripts/docs/generate.phtml on line 22

This is because the "sibling" example action has no parameters set up.

This issue also causes PDF generation to fail since the server will shoot out the error before the PDF header.

Frapi on Shared Webhost

Hi,

I know: "Frapi is not made for shared hosting".

I'm using it on shared webhosting, not because I don't know how to configure correctely apache (which can be possible) but because I'm the founder of a french non-profit organization, which aims at providing free and low cost web hosting.
Instead of spending money, I wanted to use our servers.

So, here are some problems, and I know (hope) you have a solution:

  • Frapi needs some cache mechanism, like apc. Our php is executed as DSO, so APC wasn't available. We switched our conf to php_cgi, and then we've installed apc. This part is ok.
  • Then the HTTP_Digest_auth became broken, and I've read that it's because some headers in cgi are not sent correctely to apache...

So, what can I do, CGI, no HTTP_Auth, or DSO and no APC? (I know that there are other cache)
Any idea would be great :)
Thanks for this amazing tool !

Frapi_Output_XML_Exception

After accessing http://api.frapi/foo.xml?param1=bar, I get:

<response>
  <errors>
    <error code="Frapi_Output_XML_Exception">
      <message>Invalid XML element name, cannot create element.</message>
      <name>Frapi_Output_XML_Exception</name>
      <at/>
    </error>
  </errors>
</response>

It'd be nice if this error gave some sort of indication as to what portion of the output is causing a problem for rendering :)

default parameters in url

It would be great if we could easily create actions with parameters in the URL, while allowing the parameters to be optional, similar to the way the standard Zend router allows.

For example urls such as

/orders/
/orders/1234/
/orders/1234/lines/

Each param could have a default value e.g 'null', 'all' or 'view' defined in the router config for when it is missing from the URL

Missing armchair submodule from frapi.git

The Armchair submodule isn't linking properly. In other words, this:

git clone git://github.com/frapi/frapi.git

Ends up with an empty frapi/custom/Model/Armchair directory.

A workaround is to git clone git://github.com/till/armchair.git separately.

Frapi_Action::TYPE_BOOL doesn't exist

Please,

Can you add the following code at Frapi_Action::getParam{switch[0]}
«
case self::TYPE_BOOL:
$param = $param===true || in_array(strtolower($param), array('yes','true','y'));
break;
»

This type already exists but not used.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.