Changeset 414 for branches/XPressMU/xpressme_integration_kit
- Timestamp:
- Oct 21, 2009, 9:00:31 AM (15 years ago)
- Location:
- branches/XPressMU/xpressme_integration_kit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/XPressMU/xpressme_integration_kit/admin/index.php
r406 r414 497 497 global $xoopsModule; 498 498 include(dirname(__FILE__) . '/../wp-includes/version.php'); 499 include(dirname(__FILE__) . '/../include/general_functions.php'); 499 500 500 501 $xoopsDB =& Database::getInstance(); … … 506 507 507 508 $prefix = $xoopsDB->prefix($xp_prefix . '_'); 508 $sql = "SELECT COUNT(DISTINCT post_author) AS count_author, COUNT(*) AS count_article FROM ".$prefix . "posts WHERE post_type = 'post' AND (post_status = 'publish' OR post_status = 'private')"; 509 $result = $xoopsDB->query($sql); 510 if($myrow = $xoopsDB->fetchArray($result)){ 511 $count_article = $myrow["count_article"]; 512 $count_author = $myrow["count_author"]; 513 } 514 515 if ($wp_db_version < 6124){ 516 $sql = "SELECT COUNT(*) AS count_category FROM ".$xoopsDB->prefix($xp_prefix . "_categories"); 517 } else { 518 $sql = "SELECT COUNT(*) AS count_category FROM ".$xoopsDB->prefix($xp_prefix . "_term_taxonomy") . " WHERE taxonomy = 'category'"; 519 } 520 $result = $xoopsDB->query($sql); 521 if($myrow = $xoopsDB->fetchArray($result)){ 522 $count_category = $myrow["count_category"]; 523 } 524 525 if ($is_report){ 526 echo "******** " . _AM_XP2_STATS . "********" . "<br />\n"; 527 echo _AM_XP2_CATEGORIES .": ".@$count_category. "<br />\n"; 528 echo _AM_XP2_ARTICLES .": ". $count_article. "<br />\n"; 529 echo _AM_XP2_AUTHORS .": ". $count_author. "<br />\n"; 509 510 $posts_tables = get_table_list($prefix,'posts'); 511 $blogname = array(); 512 $count_article = array(); 513 $count_author = array(); 514 $count_category = array(); 515 $array_index = 0; 516 foreach( $posts_tables as $posts_table){ 517 $sql = "SELECT COUNT(DISTINCT post_author) AS count_author, COUNT(*) AS count_article FROM ". $posts_table . " WHERE post_type = 'post' AND (post_status = 'publish' OR post_status = 'private')"; 518 $result = $xoopsDB->query($sql); 519 if($myrow = $xoopsDB->fetchArray($result)){ 520 $count_article[$array_index] = $myrow["count_article"]; 521 $count_author[$array_index] = $myrow["count_author"]; 522 } else { 523 $count_article[$array_index] = 0; 524 $count_author[$array_index] = 0; 525 } 526 $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table); 530 527 531 } else { 532 echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_STATS . "</legend>"; 533 echo "<div style='padding: 8px;'>"; 534 echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category; 535 echo "</text><br />"; 536 echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article; 537 echo "</text><br />"; 538 echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author; 539 echo "</text>"; 540 echo "</div>"; 541 echo "</fieldset>"; 528 $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'"; 529 $result = $xoopsDB->query($sql); 530 if($myrow = $xoopsDB->fetchArray($result)){ 531 $blogname[$array_index] = $myrow["blogname"]; 532 } else { 533 $blogname[$array_index] = 'none name'; 534 } 535 536 if ($wp_db_version < 6124){ 537 538 $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories"; 539 } else { 540 $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'"; 541 } 542 $result = $xoopsDB->query($sql); 543 if($myrow = $xoopsDB->fetchArray($result)){ 544 $count_category[$array_index] = $myrow["count_category"]; 545 } else { 546 $count_category[$array_index] = 0; 547 } 548 $array_index++; 549 } 550 for ($i = 0 ; $i < $array_index ; $i++){ 551 if ($is_report){ 552 echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "<br />\n"; 553 echo _AM_XP2_CATEGORIES .": ".@$count_category[$i]. "<br />\n"; 554 echo _AM_XP2_ARTICLES .": ". $count_article[$i]. "<br />\n"; 555 echo _AM_XP2_AUTHORS .": ". $count_author[$i]. "<br />\n"; 556 557 } else { 558 echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . $blogname[$i] . _AM_XP2_STATS . "</legend>"; 559 echo "<div style='padding: 8px;'>"; 560 echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category[$i]; 561 echo "</text><br />"; 562 echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article[$i]; 563 echo "</text><br />"; 564 echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author[$i]; 565 echo "</text>"; 566 echo "</div>"; 567 echo "</fieldset>"; 568 } 542 569 } 543 570 } -
branches/XPressMU/xpressme_integration_kit/include/general_functions.php
r264 r414 119 119 } 120 120 121 // Get Multi Blog table list for WordPressMU 122 if (!function_exists('get_multi_table_list')){ 123 function get_table_list($wp_prefix = '',$table_name = ''){ 124 global $xoopsDB,$xoops_db; 125 126 $table_list = array(); 127 $ret = array(); 128 if (!empty($wp_prefix) && !empty($table_name)){ 129 $sql = "SHOW TABLES LIKE '" . $wp_prefix . '%' . $table_name . "'"; 130 131 if (empty($xoops_db)) { // not load XPressME 132 if($result = $xoopsDB->queryF($sql)){ 133 while($row = $xoopsDB->fetchRow($result)){ 134 $table_list[] = $row[0]; 135 } 136 } 137 } else { // load XPressME or not Load XOOPS 138 $table_list = $xoops_db->get_results($sql); 139 } 140 } 141 return $table_list; 142 } 143 } 144 145 // Get Middle Prefix from Table name for WordPressMU 146 if (!function_exists('get_multi_mid_prefix')){ 147 function get_multi_mid_prefix($wp_prefix = '',$table_name = '' , $full_table_name){ 148 $pattern = '/' . $wp_prefix . '(.*)' . $table_name . '/'; 149 preg_match($pattern,$full_table_name,$match); 150 return $match[1]; 151 } 152 } 153 121 154 ?>
Note: See TracChangeset
for help on using the changeset viewer.