I am using Drupal and CakePHP and had issues with file caching because of SELinux.
Here is a simple module which adds a new type to handle that:
Store it in a file named let's say apachewrite.te
Now we declare the file context:
You can store this in apachewrite.fc
Now on to compile,package and install the module:
The final step is to relabel the directories:
You can edit the context file and add or alter the expressions. Just do not forget to increment the version of the module in order to update it using -u with semodule.
Friday, December 25, 2009
Wednesday, December 23, 2009
Creating bmp images for snom 370 phones using php and GD
Here is a function for converting jpeg images to appropriate bmp images for Snom 370.
You can supply a URL and therefore use the function to stream web camera images to a snom.
You can actually use imagecreatefromXXX to convert from other formats as well.
You can supply a URL and therefore use the function to stream web camera images to a snom.
You can actually use imagecreatefromXXX to convert from other formats as well.
Monday, December 21, 2009
How to create a custom layout type in CakePHP
I have start using cakePHP to create an interface for snom phones supporting the XML minibrowser.
Anyway I wanted to create a separate type for that and keep the xml type for future use. So I decided to create a snom type, with layouts and automatic detection.
1. Create a helper in app/views/helpers/snom.php which extends the core XmlHelper:
2. Create the default layout in app/views/layouts/snom/default.ctp. Mine looks like:
The $snom variable is an instance of the SnomHelper from step 1.
3. Create app/controllers/components/custom_request_handler.php:
4. That's it really. You can start using the new type right away. As said the type will be set automatically according to the user agent but you can force it using extensions; in app/config/routes.php add:
In order to use it in your controller simply load the CustomRequestHandler as:
Then make sure that you have the view set in app/views/viewname/snom/action.ctp
For instance for the previous example you would have to have app/views/example/snom/index.ctp
Anyway I wanted to create a separate type for that and keep the xml type for future use. So I decided to create a snom type, with layouts and automatic detection.
1. Create a helper in app/views/helpers/snom.php which extends the core XmlHelper:
2. Create the default layout in app/views/layouts/snom/default.ctp. Mine looks like:
The $snom variable is an instance of the SnomHelper from step 1.
3. Create app/controllers/components/custom_request_handler.php:
4. That's it really. You can start using the new type right away. As said the type will be set automatically according to the user agent but you can force it using extensions; in app/config/routes.php add:
In order to use it in your controller simply load the CustomRequestHandler as:
Then make sure that you have the view set in app/views/viewname/snom/action.ctp
For instance for the previous example you would have to have app/views/example/snom/index.ctp
Subscribe to:
Posts (Atom)