Changeset 2229
- Timestamp:
- 03/07/08 14:19:56 (6 months ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
index.php (modified) (1 diff)
-
modules/auth/controllers/auth.php (modified) (1 diff)
-
modules/forge/controllers/forge_demo.php (modified) (1 diff)
-
modules/gmaps/controllers/google_map.php (modified) (2 diffs)
-
modules/kodoc/controllers/kodoc.php (modified) (1 diff)
-
modules/shoutbox/controllers/shoutbox.php (modified) (1 diff)
-
modules/user_guide/controllers/user_guide.php (modified) (1 diff)
-
system/core/Kohana.php (modified) (1 diff)
-
system/libraries/Controller.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r2170 r2229 10 10 * @license http://kohanaphp.com/license.html 11 11 */ 12 13 /** 14 * Define the website environment status. When this flag is set to TRUE, some 15 * module demonstration controllers will result in 404 errors. For more information 16 * about this option, read the documentation about deploying Kohana. 17 * 18 * @see http://doc.kohanaphp.com/installation/deployment 19 */ 20 define('IN_PRODUCTION', FALSE); 12 21 13 22 /** -
trunk/modules/auth/controllers/auth.php
r2159 r2229 2 2 3 3 class Auth_Controller extends Controller { 4 5 // Do not allow to run in production 6 const ALLOW_PRODUCTION = FALSE; 4 7 5 8 public function __construct() -
trunk/modules/forge/controllers/forge_demo.php
r2031 r2229 2 2 3 3 class Forge_demo_Controller extends Controller { 4 5 // Do not allow to run in production 6 const ALLOW_PRODUCTION = FALSE; 4 7 5 8 public function index() -
trunk/modules/gmaps/controllers/google_map.php
r2207 r2229 11 11 */ 12 12 class Google_Map_Controller extends Controller { 13 14 // Do not allow to run in production 15 const ALLOW_PRODUCTION = FALSE; 13 16 14 17 public function index() … … 54 57 } 55 58 59 public function admin() 60 { 61 $valid = ! empty($_POST); 62 63 $_POST = Validation::factory($_POST) 64 ->pre_filter('trim') 65 ->add_rules('title', 'required', 'length[4,32]') 66 ->add_rules('description', 'required', 'length[4,127]') 67 ->add_rules('link', 'length[6,127]', 'valid::url') 68 ->add_rules('address', 'required', 'length[4,127]') 69 ->add_callbacks('address', array($this, '_admin_check_address')); 70 71 if ($_POST->validate()) 72 { 73 // Create a new location 74 $location = ORM::factory('location'); 75 76 // 77 foreach ($_POST->as_array() as $key => $val) 78 { 79 $location->$key = $val; 80 } 81 82 echo Kohana::debug($_POST->as_array()); 83 } 84 85 if ($errors = $_POST->errors()) 86 { 87 foreach ($errors as $input => $rule) 88 { 89 // Add the errors 90 $_POST->message($input, Kohana::lang("gmaps.form.$input")); 91 } 92 } 93 94 View::factory('gmaps/admin')->render(TRUE); 95 } 96 97 public function _admin_check_address(Validation $array, $input) 98 { 99 if ($array[$input] == '') 100 return; 101 102 // Fetch the lat and lon via Gmap 103 list ($lat, $lon) = Gmap::address_to_ll($array[$input]); 104 105 if ($lat === NULL OR $lon === NULL) 106 { 107 // Add an error 108 $array->add_error($input, 'address'); 109 } 110 else 111 { 112 // Set the latitude and longitude 113 $_POST['lat'] = $lat; 114 $_POST['lon'] = $lon; 115 } 116 } 117 56 118 public function jquery() 57 119 { -
trunk/modules/kodoc/controllers/kodoc.php
r2113 r2229 2 2 3 3 class Kodoc_Controller extends Template_Controller { 4 5 // Do not allow to run in production 6 const ALLOW_PRODUCTION = FALSE; 4 7 5 8 public $template = 'kodoc/template'; -
trunk/modules/shoutbox/controllers/shoutbox.php
r2044 r2229 2 2 3 3 class Shoutbox_Controller extends Controller { 4 5 // Do not allow to run in production 6 const ALLOW_PRODUCTION = FALSE; 4 7 5 8 public function __construct() -
trunk/modules/user_guide/controllers/user_guide.php
r1766 r2229 3 3 4 4 class User_Guide_Controller extends Controller { 5 6 // Do not allow to run in production 7 const ALLOW_PRODUCTION = FALSE; 5 8 6 9 public function __construct() -
trunk/system/core/Kohana.php
r2214 r2229 215 215 // Make sure the controller class exists 216 216 class_exists($controller, FALSE) or Event::run('system.404'); 217 218 // Production enviroment protection, based on the IN_PRODUCTION flag 219 (IN_PRODUCTION AND constant($controller.'::ALLOW_PRODUCTION') === FALSE) and Event::run('system.404'); 217 220 218 221 // Run system.pre_controller -
trunk/system/libraries/Controller.php
r2224 r2229 12 12 */ 13 13 abstract class Controller_Core { 14 15 // Allow all controllers to run in production by default 16 const ALLOW_PRODUCTION = TRUE; 14 17 15 18 /**
