a tiny mvc framework for php using php-activerecord
at master 63 lines 2.1 kB view raw
1<?php 2/* 3 early initialization of site-wide settings, loaded after halfmoon framework 4 but before activerecord is initialized. 5 6 per-environment setup like logging, tweaking php settings, etc. can be done 7 here. any code requiring activerecord or needing to be done after 8 everything is initialized should be done in config/application.php. 9*/ 10 11/* session settings, change according to your application requirements */ 12session_name("_%%APP_NAME%%_session"); 13session_set_cookie_params($lifetime = 0, $path = "/"); 14 15/* activate encrypted cookie storage; requires the mcrypt php extension */ 16HalfMoon\Config::set_session_store( 17 "encrypted_cookie", 18 19 /* you must define a random encryption key here of 32 characters. 20 * "openssl rand 16 -hex" will generate one for you. */ 21 array("encryption_key" => "%%COOKIE_ENCRYPTION_KEY%%") 22); 23 24/* a timezone is required for DateTime functions */ 25date_default_timezone_set("UTC"); 26 27/* environment-specific settings */ 28if (HALFMOON_ENV == "development") { 29 /* be open and verbose during development */ 30 31 /* show errors in the browser */ 32 ini_set("display_errors", 1); 33 34 /* log all activerecord queries and values */ 35 HalfMoon\Config::set_activerecord_log_level("full"); 36 37 /* log all halfmoon activity */ 38 HalfMoon\Config::set_log_level("full"); 39} 40 41elseif (HALFMOON_ENV == "production") { 42 /* be quiet in production */ 43 44 /* don't display actual php error messages to the user, just generic error 45 * pages (see skel/500.html) */ 46 ini_set("display_errors", 0); 47 48 /* do not log any activerecord queries */ 49 HalfMoon\Config::set_activerecord_log_level("none"); 50 51 /* only log halfmoon processing times with urls */ 52 HalfMoon\Config::set_log_level("short"); 53 54 /* perform file caching for controllers that request it, and store files in 55 * this directory (must be writable by web server user running halfmoon */ 56 HalfMoon\Config::set_cache_store_path(HALFMOON_ROOT . "/public/cache"); 57 58 /* uncomment to send emails of error backtraces and debugging info */ 59 # HalfMoon\Config::set_exception_notification_recipient("you@example.com"); 60 # HalfMoon\Config::set_exception_notification_subject("[%%APP_NAME%%]"); 61} 62 63?>