Skip to main content

SolarPHP User Roles and ACL Example

As I promised, here's the more "advanced" tutorial regarding roles and acl in SolarPHP using the sql adapter.

I'll continue the previous tutorial, so if you didn't had chance to read it here's a link.

Now let's continue.
Here's the config required for the roles / acl

  1. $config['Solar_Role']['adapter']  = 'Solar_Role_Adapter_Sql';
  2. $config['Solar_Role_Adapter_Sql'] = array(
  3.     'table'      => 'roles',
  4.     'handle_col' => 'username',
  5.     'role_col'   => 'name',
  6. );
  7.  

SolarPHP Basic User Authentication Example

Here's another short tutorial for solar php in which I'm going to try to explain how to achieve a simple authentication system in SolarPHP.

User Roles and ACL's will follow in another tutorial.

Let's get started:
I'm using the SQL adapter for the authentication system. I'm assuming you're already have the config file setup for connecting to the sql server.

The config file is as follows:

  1. // Specify our authentication adapter
  2. $config['Solar_Auth']['adapter']= 'Solar_Auth_Adapter_Sql';
  3.  
  4. // authentication adapter information

Simple SolarPHP Pagination Example

Being new to the SolarPHP scene I was trying to grasp some concepts around it, that for the lack of knowledge seem hard to do (and lack of any written articles found with google).

Pagination is implemented in SolarPHP by using a View Helper class called Pager.
At first I was perplexed about the fact that it took as parameters, among the usual number of items, number of pages etc., also the amount of pages, a minor detail that, usually, other pagination classes calculate automatically.

Favorite PHP Framework

Posted in

Hey Guys, I was wondering what's your favorite PHP Framework.
I currently use CodeIgniter but it does have some limitations (no hmvc by default).

Don't get me wrong, it's very easy to use, fast, and has a great documentation, but something with more features for larger scale projects would be nice.

Weirdest IE 8 BUG EVER !!!

Posted in

If you were ever into the position of styling an input type text in making it bigger with the text centered vertically in the input you'll notice that's a major pain in the butt to do it.

Firefox doesn't respect line-height and IE8 has a very strange bug that i'll explain below.

Got a packet bigger than 'max_allowed_packet' bytes

Posted in

Tried importing today an exported sql from a client and I got this nice error

  1. Got a packet bigger than 'max_allowed_packet' bytes

It's easily fixable by editing the "my.cnf" file and adding the "max_allowed_packet" option
  1. [mysqld]
  2. max_allowed_packet=10M

Restart mysql and you're good to go.

Redirect WWW to NO WWW using .htaccess

Posted in

Inspired by No-www.org here's how to do a simple redirect from the www version to the non www version of the website.

  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{HTTP_HOST} !^example.com$ [NC]
  4. RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Simple PHP Calendar

Posted in

Posted it on my blog, but I decided that I should share it here as well, for those of you that need a simple php calendar.

  1. <?php
  2. // This gets today's date
  3. $date = time ();
  4.  
  5. // This puts the day, month, and year in seperate variables
  6. $day  = date('d', $date);
  7. $month= date('m', $date);
  8. $year = date('Y', $date);
  9.  
  10. // Here we generate the first day of the month
  11. $first_day = mktime(0,0,0,$month, 1, $year);
  12.  
  13. //This gets us the month name
  14. $title = date('F', $first_day);

Drupal Ubercart get add to cart form

Posted in

  1. $output .= drupal_get_form('uc_product_add_to_cart_form_'. $node->nid, $node);

No space left on device: Cannot create SSLMutex

Posted in

I've encountered this issue recently on quite a few occasions when apache wouldn't restart. Haven't figured out why it happens. I could see there are a lot of semaphores left with:

ipcs -s | grep apache

so i've deleted them with

ipcs -s | grep apache | awk ' { print $2 } ' | xargs ipcrm sem

and it let me restart apache

thanks to http://carlosrivero.com/fix-apache---no-space-left-on-device-couldnt-cre... for the idea.

Syndicate content