Changeset 494
- Timestamp:
- 04/26/08 00:18:34 (9 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
module.inc (modified) (1 diff)
-
mw_plugin.php (modified) (2 diffs)
-
public/wp.php (modified) (1 diff)
-
wp_plugin.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/module.inc
r483 r494 30 30 static $owa; 31 31 32 if( isset($owa)):32 if(!empty($owa)): 33 33 return $owa; 34 34 else: -
trunk/mw_plugin.php
r469 r494 87 87 static $owa; 88 88 89 if( isset($owa)):89 if(!empty($owa)): 90 90 return $owa; 91 91 else: … … 347 347 $wgMessageCache->addMessages( $langMessages, $lang ); 348 348 } 349 350 return true; 349 351 } 350 352 -
trunk/public/wp.php
r367 r494 34 34 // Initialize owa admin 35 35 //$owa_wp = &new owa_wp; 36 36 $owa_wp = owa_factory(); 37 37 // run controller or view and echo page content 38 38 echo $owa_wp->handleRequestFromURL(); -
trunk/wp_plugin.php
r473 r494 27 27 28 28 require_once('owa_env.php'); 29 require_once(OWA_BASE_CLASSES_DIR.'owa_wp.php'); 29 30 30 31 31 … … 52 52 // Public folder URI 53 53 define('OWA_PUBLIC_URL', '../wp-content/plugins/owa/public/'); 54 /* 54 55 55 56 // Build the OWA wordpress specific config overrides array … … 77 78 $owa_config['site_id'] = md5(get_settings('siteurl')); 78 79 $owa_config['is_embedded'] = 'true'; 79 80 */ 81 82 /* 80 83 // Needed to avoid a fetch of configuration from db during installation 81 84 if (($_GET['action'] == 'activate') && ($_GET['plugin'] == 'owa/wp_plugin.php')): 82 85 $owa_config['do_not_fetch_config_from_db'] = true; 83 86 endif; 87 */ 84 88 85 89 // Create new instance of OWA passing in the Wordpres specific config overrides 86 $owa_wp = &new owa_wp($owa_config);90 //$owa_wp = &new owa_wp($owa_config); 87 91 88 92 // Filter and Action hook assignments 89 add_action('init', 'owa_set_user_level');93 //add_action('init', 'owa_set_user_level'); 90 94 add_action('template_redirect', 'owa_main'); 91 95 add_action('wp_footer', 'owa_footer'); 92 96 add_filter('the_permalink_rss', 'owa_post_link'); 93 add_action('init', array(&$owa_wp, 'handleSpecialActionRequest'));97 add_action('init', 'owa_handleSpecialActionRequest'); 94 98 add_filter('bloginfo_url', 'add_feed_sid'); 95 99 add_action('admin_menu', 'owa_dashboard_menu'); 96 add_action('comment_post', array(&$owa_wp, 'logComment'));100 add_action('comment_post', 'owa_logComment'); 97 101 add_action('admin_menu', 'owa_options_menu'); 98 102 add_action('activate_owa/wp_plugin.php', 'owa_install'); // Installation hook … … 100 104 ///////////////////////////////////////////////////////////////////////////////// 101 105 106 function owa_factory($params = array()) { 107 108 static $owa; 109 110 if(!empty($owa)): 111 return $owa; 112 else: 113 114 require_once(OWA_BASE_CLASSES_DIR.'owa_wp.php'); 115 116 // Build the OWA wordpress specific config overrides array 117 $owa_config = $params; 118 119 // OWA DATABASE CONFIGURATION 120 // Will use Wordpress config unless there is a config file present. 121 // OWA uses this to setup it's own DB connection seperate from the one 122 // that Wordpress uses. 123 $owa_config['db_type'] = 'mysql'; 124 $owa_config['db_name'] = DB_NAME; 125 $owa_config['db_host'] = DB_HOST; 126 $owa_config['db_user'] = DB_USER; 127 $owa_config['db_password'] = DB_PASSWORD; 128 129 $owa_config['report_wrapper'] = 'wrapper_wordpress.tpl'; 130 $owa_config['images_url'] = OWA_PUBLIC_URL.'i/';//'../wp-content/plugins/owa/public/i/'; 131 $owa_config['images_absolute_url'] = get_bloginfo('url').'/wp-content/plugins/owa/public/i/';//'../wp-content/plugins/owa/public/i/'; 132 $owa_config['main_url'] = '../wp-admin/index.php?page=owa/public/wp.php'; 133 $owa_config['main_absolute_url'] = get_bloginfo('url').'/wp-admin/index.php?page=owa/public/wp.php'; 134 $owa_config['action_url'] = get_bloginfo('url').'/index.php?owa_specialAction'; 135 $owa_config['log_url'] = get_bloginfo('url').'/index.php?owa_logAction=1'; 136 $owa_config['link_template'] = '%s&%s'; 137 $owa_config['authentication'] = 'wordpress'; 138 $owa_config['site_id'] = md5(get_settings('siteurl')); 139 $owa_config['is_embedded'] = 'true'; 140 141 $owa = new owa_wp($owa_config); 142 143 global $user_level, $user_login, $user_ID, $user_email, $user_identity, $user_pass_md5; 144 145 $owa->params['caller']['wordpress']['user_data'] = array( 146 147 'user_level' => $user_level, 148 'user_ID' => $user_ID, 149 'user_login' => $user_login, 150 'user_email' => $user_email, 151 'user_identity' => $user_identity, 152 'user_password' => 'xxxxxxxxx'); 153 154 $owa->params['u'] = $user_login; 155 $owa->params['p'] = 'xxxxxxxxx'; 156 157 return $owa; 158 159 endif; 160 } 161 162 function owa_handleSpecialActionRequest() { 163 164 $owa_wp = owa_factory(); 165 return $owa_wp->handleSpecialActionRequest(); 166 } 167 168 function owa_logComment() { 169 170 $owa_wp = owa_factory(); 171 return $owa_wp->logComment(); 172 } 173 174 175 102 176 /** 103 177 * Prints helper page tags to the footers of templates. … … 106 180 function owa_footer() { 107 181 108 global $owa_wp;182 $owa_wp = owa_factory(); 109 183 110 184 $owa_wp->placeHelperPageTags(); … … 113 187 return; 114 188 115 } 116 117 118 /** 119 * Sets the user level in caller params for use in OWA's auth module. 120 * 121 */ 122 function owa_set_user_level() { 123 124 global $owa_wp, $user_level, $user_login, $user_ID, $user_email, $user_identity, $user_pass_md5; 125 126 $owa_wp->params['caller']['wordpress']['user_data'] = array( 127 128 'user_level' => $user_level, 129 'user_ID' => $user_ID, 130 'user_login' => $user_login, 131 'user_email' => $user_email, 132 'user_identity' => $user_identity, 133 'user_password' => 'xxxxxxxxx'); 134 135 $owa_wp->params['u'] = $user_login; 136 $owa_wp->params['p'] = 'xxxxxxxxx'; 137 138 return; 139 } 140 189 } 141 190 142 191 /** … … 146 195 function owa_main() { 147 196 148 global $user_level, $owa_wp; 197 global $user_level; 198 199 $owa_wp = owa_factory(); 149 200 150 201 // Don't log if the page request is a preview - Wordpress 2.x or greater … … 175 226 function owa_log() { 176 227 177 global $owa_wp;228 $owa_wp = owa_factory(); 178 229 179 230 // WORDPRESS SPECIFIC DATA // … … 282 333 function add_feed_sid($binfo) { 283 334 284 global $owa_wp;335 $owa_wp = owa_factory(); 285 336 286 337 $test = strpos($binfo, "feed="); … … 307 358 function owa_post_link($link) { 308 359 309 global $owa_wp;360 $owa_wp = owa_factory(); 310 361 311 362 return $owa_wp->add_link_tracking($link); … … 320 371 321 372 global $user_level; 322 global $owa_wp; 373 374 $params = array(); 375 $params['do_not_fetch_config_from_db'] = true; 376 377 $owa_wp = owa_factory($params); 323 378 324 379 //check to see if the user has permissions to install or not... … … 364 419 function owa_dashboard_report() { 365 420 366 global $owa_wp;421 $owa_wp = owa_factory(); 367 422 368 423 $params = array(); … … 393 448 function owa_options_page() { 394 449 395 global $owa_wp;450 $owa_wp = owa_factory(); 396 451 397 452 $params = array();
