- Timestamp:
- Dec 16, 2009, 1:22:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/class/config_from_xoops.class.php
r360 r491 43 43 var $wp_version; 44 44 var $is_wp_me; 45 var $xoops_language; 46 var $module_id; 47 var $module_config= array(); 45 48 46 49 function __constructor() //for PHP5 … … 102 105 $this->set_wp_version(); 103 106 $this->set_mu_current_site(); 107 $this->xpress_get_module_id(); 108 $this->xoops_language = $this->xpress_get_xoops_config('language'); 109 $this->xpress_get_module_config(); 104 110 } 105 111 … … 314 320 } 315 321 } 316 322 323 function xpress_get_xoops_config($config_name = '',$mid = 0){ 324 $ret = ''; 325 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 326 if (!$cn) return $ret; 327 328 $db_selected = mysql_select_db($this->xoops_db_name, $cn); 329 if ($db_selected){ 330 $table_name = $this->xoops_db_prefix . '_config'; 331 $sql = "SELECT conf_value AS value FROM $table_name WHERE `conf_modid` = $mid AND `conf_name` = '$config_name'"; 332 if($result = mysql_query($sql)){ 333 $row = mysql_fetch_assoc($result); 334 $ret = $row['value']; 335 } else { 336 $ret = $sql; 337 } 338 } 339 mysql_close($cn); 340 return $ret; 341 } 342 343 function xpress_get_module_config(){ 344 $this->module_config= array(); 345 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 346 if (!$cn) return $ret; 347 348 $db_selected = mysql_select_db($this->xoops_db_name, $cn); 349 if ($db_selected){ 350 $table_name = $this->xoops_db_prefix . '_config'; 351 $sql = "SELECT conf_name AS name, conf_value AS value FROM $table_name WHERE `conf_modid` = $this->module_id"; 352 if($result = mysql_query($sql)){ 353 while ($row = mysql_fetch_assoc($result)) { 354 $this->module_config[$row['name']] = $row['value']; 355 } 356 } 357 } 358 mysql_close($cn); 359 return $this->module_config; 360 } 361 362 function xpress_get_module_id(){ 363 $this->module_id = ''; 364 $cn = mysql_connect($this->xoops_db_host, $this->xoops_db_user, $this->xoops_db_pass); 365 if ($cn){ 366 $db_selected = mysql_select_db($this->xoops_db_name, $cn); 367 if ($db_selected){ 368 $table_name = $this->xoops_db_prefix . '_modules'; 369 $sql = "SELECT mid FROM $table_name WHERE `dirname` = '$this->module_name'"; 370 if($result = mysql_query($sql)){ 371 $row = mysql_fetch_assoc($result); 372 $this->module_id = $row['mid']; 373 } 374 } 375 mysql_close($cn); 376 } 377 return $this->module_id; 378 } 379 380 381 // Set XPressME memory limit 382 function xpress_set_memory_limmit(){ 383 $memory = $this->module_config['memory_limit']; 384 if (empty($memory)) return; 385 if ( !defined('WP_MEMORY_LIMIT') ) 386 define('WP_MEMORY_LIMIT', $memory . 'M'); 387 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 388 @ini_set('memory_limit', WP_MEMORY_LIMIT); 389 } 390 391 392 317 393 } 318 394 ?>
Note: See TracChangeset
for help on using the changeset viewer.