Changeset 438
- Timestamp:
- 01/05/08 13:17:06 (12 months ago)
- Location:
- trunk
- Files:
-
- 5 added
- 8 modified
-
Callbacks.inc (added)
-
conf/owa-config-dist.php (modified) (2 diffs)
-
module.inc (added)
-
modules/base/classes/entityManager.php (modified) (1 diff)
-
modules/base/classes/error.php (modified) (3 diffs)
-
modules/base/classes/settings.php (modified) (1 diff)
-
modules/base/reportDashboard.php (modified) (1 diff)
-
modules/base/templates/gallery.tpl (added)
-
modules/base/templates/wrapper_gallery2.tpl (added)
-
mw_plugin.php (modified) (11 diffs)
-
owa_caller.php (modified) (1 diff)
-
plugins/auth/gallery.php (added)
-
wp_plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/conf/owa-config-dist.php
r377 r438 18 18 19 19 /** 20 * DBConfiguration20 * OWA Configuration 21 21 * 22 22 * @author Peter Adams <peter@openwebanalytics.com> … … 29 29 */ 30 30 31 define('OWA_DB_TYPE', ''); // options: mysql 32 define('OWA_DB_NAME', ''); // name of the database 33 define('OWA_DB_HOST', ''); // host name of the server housing the database 34 define('OWA_DB_USER', ''); // database user 35 define('OWA_DB_PASSWORD', ''); // database user's password 31 /** 32 * DATABASE CONFIGURATION 33 * 34 * Connection info for databases that will be used by OWA. 35 * 36 */ 36 37 37 // define the URL of the public directory e.g. http://www.domain.com/root/dir/owa/public/ 38 // Don't forget the slash at the end. 39 define('OWA_PUBLIC_URL', ''); 38 //define('OWA_DB_TYPE', ''); // options: mysql 39 //define('OWA_DB_NAME', ''); // name of the database 40 //define('OWA_DB_HOST', ''); // host name of the server housing the database 41 //define('OWA_DB_USER', ''); // database user 42 //define('OWA_DB_PASSWORD', ''); // database user's password 40 43 41 // Log all php errors to OWA's error log file. Only do this to debug. 42 define('OWA_LOG_PHP_ERRORS', false); 44 45 /** 46 * PUBLIC URL 47 * 48 * Define the URL of the public directory e.g. http://www.domain.com/root/dir/owa/public/ 49 * Don't forget the slash at the end. 50 */ 43 51 52 // define('OWA_PUBLIC_URL', ''); 53 54 /** 55 * LOG PHP ERRORS 56 * 57 * Log all php errors to OWA's error log file. Only do this to debug. 58 */ 59 60 //define('OWA_LOG_PHP_ERRORS', false); 61 62 /** 63 * OBJECT CACHING 64 * 65 * Override setting to cache objects. Caching will increase performance. 66 */ 67 68 //define('OWA_CACHE_OBJECTS', true); 69 70 71 44 72 ?> -
trunk/modules/base/classes/entityManager.php
r425 r438 233 233 234 234 $properties = $this->db->select($this->_getProperties(), $constraint, get_class($this->entity)); 235 236 $this->setProperties($properties); 237 238 if ($this->config['cache_objects'] == true): 239 $this->cache->set(get_class($this->entity), 'id'.$this->entity->id->value, $this->entity); 240 endif; 235 236 if (!empty($properties)): 237 238 $this->setProperties($properties); 239 240 if ($this->config['cache_objects'] == true): 241 $this->cache->set(get_class($this->entity), 'id'.$this->entity->id->value, $this->entity); 242 endif; 243 endif; 241 244 endif; 242 245 -
trunk/modules/base/classes/error.php
r433 r438 209 209 } 210 210 211 function crit( ) {211 function crit($message) { 212 212 213 213 return $this->log($message, PEAR_LOG_CRIT); … … 215 215 } 216 216 217 function alert( ) {217 function alert($message) { 218 218 219 219 return $this->log($message, PEAR_LOG_ALERT); … … 221 221 } 222 222 223 function emerg( ) {223 function emerg($message) { 224 224 225 225 return $this->log($message, PEAR_LOG_EMERG); -
trunk/modules/base/classes/settings.php
r433 r438 343 343 'exits_table' => 'exit', 344 344 'users_table' => 'user', 345 'db_type' => OWA_DB_TYPE, 345 'db_type' => '', 346 'db_name' => '', 347 'db_host' => '', 348 'db_user' => '', 349 'db_password' => '', 346 350 'resolve_hosts' => true, 347 351 'log_feedreaders' => true, -
trunk/modules/base/reportDashboard.php
r398 r438 50 50 // Load the core API 51 51 $api = &owa_coreAPI::singleton($this->params); 52 53 //if (empty($this->params['period'])): 54 // $this->params['period'] = 'today'; 55 //endif; 52 56 53 57 $data = array(); -
trunk/mw_plugin.php
r425 r438 21 21 require_once "$IP/includes/SpecialPage.php"; 22 22 23 /* MEDIAWIKI GLOBALS */ 23 24 global $wgCachePages, $wgDBtype, $wgDBname, $wgDBserver, $wgDBuser, $wgDBpassword, $wgUser, $wgServer, $wgScriptPath, $wgScript; 24 25 25 // OWA Configuration 26 27 28 // OWA DATABASE CONFIGURATION 29 // Will use Wordpress config unless there is a config file present. 30 // OWA uses this to setup it's own DB connection seperate from the one 31 // that Wordpress uses. 32 33 $config_file = OWA_CONF_DIR.'owa-config.php'; 34 if (file_exists($config_file)): 35 // do nothing as the caller class will define the DB config constants later. 36 ; 37 else: 38 // use the Wordpress configuration 39 define('OWA_DB_TYPE', $wgDBtype); 40 define('OWA_DB_NAME', $wgDBname); 41 define('OWA_DB_HOST', $wgDBserver); 42 define('OWA_DB_USER', $wgDBuser); 43 define('OWA_DB_PASSWORD', $wgDBpassword); 44 endif; 26 /* OWA's MEDIAWIKI CONFIGURATION OVERRIDES */ 45 27 46 28 // Public folder URI 47 29 define('OWA_PUBLIC_URL', $wgServer.$wgScriptPath.'/extensions/owa/public/'); 48 30 49 // Build the OWA wordpressspecific config overrides array31 // Build OWA's Mediawiki specific config overrides array 50 32 $owa_config = array(); 33 34 // OWA DATABASE CONFIGURATION 35 // Will use Mediawiki's config valuesunless there are values present in an OWA config file. 36 // OWA uses this to setup it's own DB connection seperate from the one that Mediawiki uses. 37 $owa_config['db_type'] = $wgDBtype; 38 $owa_config['db_name'] = $wgDBname; 39 $owa_config['db_host'] = $wgDBserver; 40 $owa_config['db_user'] = $wgDBuser; 41 $owa_config['db_password'] = $wgDBpassword; 42 51 43 $owa_config['report_wrapper'] = 'wrapper_mediawiki.tpl'; 52 44 $owa_config['images_url'] = OWA_PUBLIC_URL.'i/'; … … 61 53 $owa_config['is_embedded'] = 'true'; 62 54 63 //$owa = new owa_php($owa_config);64 65 55 // Turn MediaWiki Caching Off 66 56 global $wgCachePages, $wgCacheEpoch; … … 80 70 81 71 //Load Special Page 82 83 72 $wgAutoloadClasses['SpecialOwa'] = __FILE__; 84 73 $wgSpecialPages['Owa'] = 'SpecialOwa'; … … 87 76 88 77 89 // OWA Factory 90 78 /** 79 * OWA Singleton Method 80 * 81 * Makes a singleton instance of OWA using the config array 82 */ 91 83 function owa_factory() { 92 84 93 85 global $owa_config; 86 94 87 static $owa; 95 88 … … 104 97 105 98 /** 106 * Main Media Wiki Extension method 107 * 99 * Main Mediawiki Extension method 100 * 101 * sets up OWA to be triggered for various hooks/actions 108 102 */ 109 103 function owa_main() { 104 110 105 global $wgHooks; 111 106 112 113 114 // Create Instance of OWA115 //$owa = new owa_php;116 //$owa = owa_factory();117 107 // Hook for logging Article Page Views 118 108 $wgHooks['ArticlePageDataAfter'][] = 'owa_logArticle'; … … 121 111 122 112 // Hooks for adding page tracking tags 123 124 113 $wgHooks['ArticlePageDataAfter'][] = 'owa_footer'; 125 114 $wgHooks['SpecialPageExecuteAfterPage'][] = 'owa_footer'; … … 133 122 134 123 /** 135 * Logs Special Page Views 136 * 124 * Hook for OWA special actions 125 * 126 * This uses mediawiki's 'unknown action' hook to trigger OWA's special action handler. 127 * This is setup by adding 'action=owa' to the URLs for special actions. There is 128 * probably a better way to do this so that the OWA namespace is preserved. 129 * 130 * @TODO figure out how to register this method to be triggered only when 'action=owa' instead of 131 * for all unknown mediawiki actions. 137 132 * @param object $specialPage 138 133 * @url http://www.mediawiki.org/wiki/Manual:MediaWiki_hooks/UnknownAction … … 154 149 } 155 150 151 /** 152 * OWA Priviledges 153 * 154 * Populates OWA requestion container with info about the current mediawiki user. 155 * This info is needed by OWA authentication system as well as to add dimensions 156 * requests that are logged. 157 */ 156 158 function owa_set_priviledges() { 157 159 … … 190 192 $app_params['page_type'] = 'Special Page'; 191 193 192 //print_r($wgOut);193 194 // Log the request 194 195 $owa = owa_factory(); … … 249 250 250 251 /** 251 * Adds first hit web bug to Article Pages ifneeded252 * Adds helper page tags to Article Pages if they are needed 252 253 * 253 254 * @param object $article … … 266 267 267 268 268 /* Special Page Class 269 * 269 /** 270 * OWA Special Page Class 271 * 272 * Enables OWA to be accessed through a Mediawiki special page. 270 273 */ 271 274 class SpecialOwa extends SpecialPage { -
trunk/owa_caller.php
r434 r438 93 93 */ 94 94 95 /* DATABASE CONNECTIONS */ 96 97 //load DB constants if not set already by caller 95 /* APPLY CALLER CONFIGURATION OVERRIDES */ 96 97 /** 98 * This will apply configuration overirdes that are specified by the calling application. 99 * This is usually used by plugins to setup integration specific configuration values. 100 */ 101 $this->c->applyModuleOverrides('base', $config); 102 $this->e->debug('Caller configuration overrides applied.'); 103 104 105 /* APPLY CONFIGURATION FILE OVERRIDES */ 106 107 $file = OWA_BASE_DIR.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'owa-config.php'; 108 109 if (file_exists($file)): 110 include ($file); 111 112 /* OBJECT CACHING */ 113 114 // Looks for object cache config constant 115 if (defined('OWA_CACHE_OBJECTS')): 116 $this->c->set('base', 'cache_objects', OWA_CACHE_OBJECTS); 117 endif; 118 119 120 /* ERROR LOGGING */ 121 122 // Looks for log level constant 123 if (defined('OWA_ERROR_LOG_LEVEL')): 124 $this->c->set('base', 'error_log_level', OWA_ERROR_LOG_LEVEL); 125 endif; 126 127 /* PHP ERROR LOGGING */ 128 129 if (OWA_LOG_PHP_ERRORS === true): 130 $this->e->logPhpErrors(); 131 endif; 132 133 else: 134 $this->e->debug("I can't find your configuration file...assuming that you didn't create one."); 135 endif; 136 137 138 /* APPLY DATABASE CONFIGURATION */ 139 140 if (!defined('OWA_DB_TYPE')): 141 define('OWA_DB_TYPE', $this->c->get('base', 'db_type')); 142 endif; 143 144 if (!defined('OWA_DB_NAME')): 145 define('OWA_DB_NAME', $this->c->get('base', 'db_name')); 146 endif; 147 98 148 if (!defined('OWA_DB_HOST')): 99 $file = OWA_BASE_DIR.DIRECTORY_SEPARATOR.'conf'.DIRECTORY_SEPARATOR.'owa-config.php'; 100 if (file_exists($file)): 101 include ($file); 102 else: 103 $this->e->emerg("Uh-oh. Your DB config is undefined and I can't find your configuration file..."); 104 exit; 105 endif; 106 endif; 107 108 109 /* OBJECT CACHING */ 110 111 // Looks for object cache config constant 112 if (defined('OWA_OBJECT_CACHING')): 113 $config['cache_objects'] = OWA_OBJECT_CACHING; 114 endif; 115 116 117 /* ERROR LOGGING */ 118 119 // Looks for log level constant 120 if (defined('OWA_ERROR_LOG_LEVEL')): 121 $config['error_log_level'] = OWA_ERROR_LOG_LEVEL; 122 endif; 123 124 // log PHP warnings and errors 125 if (OWA_LOG_PHP_ERRORS === true): 126 $this->e->logPhpErrors(); 127 endif; 128 129 130 /** 131 * User Settings Config Overrides 132 * 133 * These overrides come from user settings stored in the database 134 */ 135 136 // sets config ID is not already set 137 if (empty($config['configuration_id'])): 138 $config['configuration_id'] = 1; 149 define('OWA_DB_HOST', $this->c->get('base', 'db_host')); 150 endif; 151 152 if (!defined('OWA_DB_USER')): 153 define('OWA_DB_USER', $this->c->get('base', 'db_user')); 154 endif; 155 156 if (!defined('OWA_DB_PASSWORD')): 157 define('OWA_DB_PASSWORD', $this->c->get('base', 'db_password')); 139 158 endif; 159 160 /* APPLY USER CONFIGURATION OVERRIDES FROM DATABASE */ 140 161 141 162 // Applies config from db or cache 142 163 // needed for installs when the configuration table does not exist. 143 if ($config['do_not_fetch_config_from_db'] != true): 144 $this->c->load($config['configuration_id']); 145 endif; 146 147 /** 148 * Run-time Config Overrides 149 * 150 */ 151 152 // Applies run time config overrides 153 $this->c->applyModuleOverrides('base', $config); 154 $this->e->debug('caller config overrides applied.'); 164 if ($this->c->get('base', 'do_not_fetch_config_from_db') != true): 165 $this->c->load($this->c->get('base', 'configuration_id')); 166 endif; 167 155 168 156 169 // re-fetch the array now that overrides have been applied. -
trunk/wp_plugin.php
r410 r438 34 34 $current_plugins = get_option('active_plugins'); 35 35 36 // Public folder URI 37 define('OWA_PUBLIC_URL', '../wp-content/plugins/owa/public/'); 38 39 // Build the OWA wordpress specific config overrides array 40 $owa_config = array(); 41 36 42 // OWA DATABASE CONFIGURATION 37 43 // Will use Wordpress config unless there is a config file present. 38 44 // OWA uses this to setup it's own DB connection seperate from the one 39 45 // that Wordpress uses. 40 41 $config_file = OWA_CONF_DIR.'owa-config.php'; 42 if (file_exists($config_file)): 43 // do nothing as the caller class will define the DB config constants later. 44 ; 45 else: 46 // use the Wordpress configuration 47 define('OWA_DB_TYPE', 'mysql'); 48 define('OWA_DB_NAME', DB_NAME); 49 define('OWA_DB_HOST', DB_HOST); 50 define('OWA_DB_USER', DB_USER); 51 define('OWA_DB_PASSWORD', DB_PASSWORD); 52 endif; 53 54 // Public folder URI 55 define('OWA_PUBLIC_URL', '../wp-content/plugins/owa/public/'); 56 57 // Build the OWA wordpress specific config overrides array 58 $owa_config = array(); 46 $owa_config['db_type'] = 'mysql'; 47 $owa_config['db_name'] = DB_NAME; 48 $owa_config['db_host'] = DB_HOST; 49 $owa_config['db_user'] = DB_USER; 50 $owa_config['db_password'] = DB_PASSWORD; 51 59 52 $owa_config['report_wrapper'] = 'wrapper_wordpress.tpl'; 60 53 $owa_config['images_url'] = OWA_PUBLIC_URL.'i/';//'../wp-content/plugins/owa/public/i/';
