Changeset 276
- Timestamp:
- 05/29/07 10:21:15
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
FreakAuth/trunk/www/system/application/config/freakauth_light.php
r274 r276 47 47 */ 48 48 $config['FAL'] = TRUE; 49 50 /* 51 |-------------------------------------------------------------------------- 52 | Enable/Disable FreakAuth light extensions 53 |-------------------------------------------------------------------------- 54 | 55 | If you need to extend the Core class (libraries/FreakAuth_light.php) or 56 | the FAL_validation.php class build your files according to the following 57 | specifications about file-names. You can place them either in 58 | system/libraries or in application/libraries 59 | 60 | - libraries/MyFAL.php 61 | - libraries/MyFALVal.php 62 | 63 | Following this convention, if $config['FAL_use_extensions'] = TRUE; 64 | the above files will be loaded in FAL_front.php, and also the 65 | freakauth_light_helper.php functions will be updated. 66 | ----------------- 67 | MyFAL.php EXAMPLE 68 | ----------------- 69 |<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 70 | 71 | class MyFAL extends Freakauth_light 72 | { 73 | // -------------------------------------------------------------------- 74 | // Class constructor 75 | // not really needed but I wrote it anyway 76 | function MyFAL() 77 | { 78 | parent::Freakauth_light(); 79 | } 80 | 81 | // -------------------------------------------------------------------- 82 | // Overwrites normal FAL logout 83 | function logout() 84 | { 85 | log_message('debug', 'MyFAL logout working'); 86 | 87 | exit('MyFAL logout working'); 88 | } 89 | } 90 | 91 */ 92 $config['FAL_use_extensions'] = FALSE; 49 93 50 94 /* FreakAuth/trunk/www/system/application/helpers/freakauth_light_helper.php
r265 r276 13 13 * @version 1.0.4 14 14 */ 15 15 // ------------------------------------------------------------------------ 16 /** 17 * Cheks if we have extensions to the Freakauth_light class 18 * The class extending it should be called MyFAL and the file 19 * You can place them either in system/libraries or in application/libraries 20 * 21 * - libraries/MyFAL.php 22 */ 23 function loadFalExtension() 24 { 25 $obj =& get_instance(); 26 if ($obj->config->item('FAL_use_extensions')) 27 { 28 if (file_exists(APPPATH.'libraries/MyFAL'.EXT) OR file_exists(BASEPATH.'libraries/MyFAL'.EXT)) 29 { 30 //let's load the core library (i.e. FreakAuth_light.php) extension 31 $obj->load->library('MyFAL'); 32 33 $obj->freakauth_light = & new MyFAL(); 34 log_message('debug', 'MyFAL library loaded'); 35 log_message('debug', 'MyFAL class assigned to $this->CI->freakauth_light'); 36 } 37 else 38 { 39 log_message('debug', 'MyFAL class not found'); 40 } 41 } 42 } 16 43 // ------------------------------------------------------------------------ 17 44 // … … 22 49 { 23 50 $obj =& get_instance(); 51 //loadFalExtension(); 24 52 return $obj->freakauth_light->getUserName(); 25 53 } … … 42 70 { 43 71 $obj =& get_instance(); 72 loadFalExtension(); 44 73 return $obj->freakauth_light->getUserProperty($prop); 45 74 } … … 61 90 { 62 91 $obj =& get_instance(); 92 loadFalExtension(); 63 93 return $obj->freakauth_light->getUserPropertyFromId($id, $prop); 64 94 } … … 73 103 { 74 104 $obj =& get_instance(); 105 loadFalExtension(); 75 106 return $obj->freakauth_light->isAdmin(); 76 107 } … … 85 116 { 86 117 $obj =& get_instance(); 118 loadFalExtension(); 87 119 return $obj->freakauth_light->isValidUser(); 88 120 } … … 109 141 { 110 142 $obj =& get_instance(); 143 loadFalExtension(); 111 144 return $obj->freakauth_light->belongsToGroup($group, $only); 112 145 } FreakAuth/trunk/www/system/application/libraries/FAL_front.php
r266 r276 75 75 } 76 76 77 //let's check if we have core classes extensions, and if we have them 78 //let's load them 79 if ($this->CI->config->item('FAL_use_extensions')) 80 { 81 $this->_loadExtensions(); 82 } 83 else 84 { 85 log_message('debug', 'FAL not using extensions'); 86 } 77 87 78 88 $this->CI->fal_validation->set_error_delimiters($this->CI->config->item('FAL_error_delimiter_open'), $this->CI->config->item('FAL_error_delimiter_close')); 79 89 90 } 91 92 // -------------------------------------------------------------------- 93 /** 94 * FAL extensions handler. 95 * It makes easier to load extensions to the classes in 96 * (libraries/FreakAuth_light.php) or the FAL_validation.php class build 97 * your files according to the following specifications about file-names. 98 * You can place them either in system/libraries or in application/libraries 99 * 100 * - libraries/MyFAL.php 101 * - libraries/MyFALVal.php 102 * 103 * Following this convention, if $config['FAL_use_extensions'] = TRUE; 104 * the above files will be loaded 105 */ 106 function _loadExtensions() 107 { 108 109 if (file_exists(APPPATH.'libraries/MyFAL'.EXT) OR file_exists(BASEPATH.'libraries/MyFAL'.EXT)) 110 { 111 //let's load the core library (i.e. FreakAuth_light.php) extension 112 $this->CI->load->library('MyFAL'); 113 114 $this->CI->freakauth_light = new MyFAL(); 115 log_message('debug', 'MyFAL library loaded'); 116 log_message('debug', 'MyFAL class assigned to $this->CI->freakauth_light'); 117 } 118 else 119 { 120 log_message('debug', 'MyFAL class not found'); 121 } 122 123 if (file_exists(APPPATH.'libraries/MyFALVal'.EXT) OR file_exists(BASEPATH.'libraries/MyFALVal'.EXT)) 124 { 125 //let's load the validation library (i.e. FAL_validation.php) extension 126 //and assign it to $this->CI->fal_validation 127 $this->CI->load->library('MyFALVal'); 128 $this->CI->fal_validation = new MyFALVal(); 129 130 } 131 else 132 { 133 log_message('debug', 'MyFALVal class not found'); 134 } 80 135 } 81 136
