XPressME Integration Kit

Trac

source: trunk/xpressme_integration_kit/admin/index.php @ 414

Last change on this file since 414 was 414, checked in by toemon, 15 years ago

WordPressMUを使用したときシステム情報の統計情報で存在しないテーブルを参照してしまうバグを修正 Fixes #230

File size: 23.6 KB
Line 
1<?php
2// $Id: xoops_version.php,v 1.8 2005/06/03 01:35:02 phppp Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27// Author: phppp (D.J.)                                                      //
28// URL: http://xoopsforge.com, http://xoops.org.cn                           //
29// ------------------------------------------------------------------------- //
30//include_once 'cp_functions.php';
31
32function admin_check_user_meta_prefix($is_report = false){
33        global $xoopsModule;
34        $xoopsDB =& Database::getInstance();
35       
36        $mydirname = basename(dirname(dirname(__FILE__)));
37        $my_dirpath = dirname(dirname(__FILE__));
38        $wp_prefix_only = $mydirname;
39        if ($wp_prefix_only == 'wordpress') $wp_prefix_only ='wp';
40        $db_prefix = $xoopsDB->prefix($wp_prefix_only);
41
42        $usermeta_tbl = $db_prefix . '_usermeta';       
43        $meta_key_pattern = '_' . $wp_prefix_only . '_';
44
45        $sql = "SELECT count(umeta_id) as data_count ,meta_key FROM $usermeta_tbl GROUP BY meta_key HAVING meta_key LIKE '%" . $meta_key_pattern ."%'" ;
46        $res =  $xoopsDB->query($sql, 0, 0);
47       
48        if ($res === false){
49                $check_str = _AM_XP2_USER_META_NONE . "<br />\n";
50        } else {
51                $error =false;
52                $check_str = '';
53                while($row = $xoopsDB->fetchArray($res)){
54                        $data_count  = $row['data_count'];
55                        $meta_key = $row['meta_key'];
56                        if ( !preg_match('/^'.$db_prefix. '_.*/',$meta_key , $maches)){
57                                $check_str .= sprintf(_AM_XP2_USER_META_ERR , $meta_key,$data_count) ."<br /> \n";
58                                $error = true;
59                        }
60                }
61                if (!$error)
62                        $check_str = _AM_XP2_USER_META_OK ;
63        }
64        if ($is_report) {
65                echo "******** "  . _AM_XP2_USER_META_KEY . "********" . "<br />\n";
66                echo $check_str . "<br />\n<br />\n";
67        } else {
68                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_USER_META_KEY . "</legend>";
69                echo "<div style='padding: 8px;'>";
70                echo $check_str;
71                echo "</div>";
72                echo "</fieldset>";
73        }
74
75}
76
77function get_xpress_plugin_data( $plugin_file, $markup = true, $translate = true ) {
78        // We don't need to write to the file, so just open for reading.
79        $fp = fopen($plugin_file, 'r');
80
81        // Pull only the first 8kiB of the file in.
82        $plugin_data = fread( $fp, 8192 );
83
84        // PHP will close file handle, but we are good citizens.
85        fclose($fp);
86
87        preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
88        preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
89        preg_match( '|Version:(.*)|i', $plugin_data, $version );
90        preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
91        preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
92        preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
93        preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
94        preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );
95
96        foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
97                if ( !empty( ${$field} ) )
98                        ${$field} = trim(${$field}[1]);
99                else
100                        ${$field} = '';
101        }
102
103        $plugin_data = array(
104                                'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description,
105                                'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version,
106                                'TextDomain' => $text_domain, 'DomainPath' => $domain_path
107                                );
108//      if ( $markup || $translate )
109//              $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
110        return $plugin_data;
111}
112
113
114function get_xpress_active_plugin_list($before_str = '')
115{
116        global $xoopsModule;
117        $xoopsDB =& Database::getInstance();
118       
119        $mydirname = basename(dirname(dirname(__FILE__)));
120        $my_dirpath = dirname(dirname(__FILE__));
121        $prefix = $mydirname;
122        if ($prefix == 'wordpress') $prefix ='wp';
123        $wp_prefix = $xoopsDB->prefix($prefix);
124
125        $option_table = $wp_prefix . '_options';
126       
127        $sql = "SELECT option_value FROM $option_table WHERE option_name = 'active_plugins'";
128        $res =  $xoopsDB->query($sql, 0, 0);
129        if ($res === false){
130            return ;
131        } else {
132                $row = $xoopsDB->fetchArray($res);
133                $active_plugins = @unserialize($row['option_value']);
134                $output = '';
135                foreach($active_plugins as $active_plugin_path){
136                        $file_name =  $my_dirpath . '/wp-content/plugins/' . $active_plugin_path;
137                        $active_plugin = get_xpress_plugin_data($file_name);
138                        $output .= $before_str . $active_plugin['Name'] . ':   Version ' . $active_plugin['Version'] . ':  (' .$active_plugin['PluginURI'] . ')<br />';
139                }
140               
141               
142                return $output;
143        }
144
145       
146}
147
148function xpress_active_plugin_list($is_report = false)
149{
150        if ($is_report) {
151                echo "******** "  . _AM_XP2_PLUGIN . "********" . "<br />\n";
152                echo get_xpress_active_plugin_list('') . "<br />\n";
153        } else {
154                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_PLUGIN . "</legend>";
155                echo "<div style='padding: 8px;'>";
156                echo get_xpress_active_plugin_list();
157                echo "</div>";
158                echo "</fieldset>";
159        }
160}
161
162function xpress_sys_info($is_report = false)
163{
164        global $xoopsModule;
165        include(dirname(__FILE__) . '/../wp-includes/version.php');
166       
167        if ($is_report) {
168                echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
169                echo "SERVER:  ". $_SERVER['SERVER_SOFTWARE']. "<br />\n";
170                echo "PHP Version:   " . phpversion() . "<br />\n";
171                echo 'libxml Version:  ';
172                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
173                echo "<br />\n";;
174                echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />";
175                echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />";
176                echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
177                echo "WordPress Version:   " . $wp_version . "<br />\n";
178                echo "WP DB Version:   " . $wp_db_version . "<br />\n";
179                echo "<br />\n";
180                echo "safemode:   " ;
181                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
182                echo "<br />\n";
183                echo "register_globals:   " ;
184                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF" ;
185                echo "<br />\n";
186                echo "magic_quotes_gpc:   " ;
187                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
188                echo "<br />\n";
189                echo "XML extension:   " ;
190                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
191                echo "<br />\n";
192                echo "memory_limit:   " ;
193                echo  ini_get( 'memory_limit' );
194                echo "<br />\n";
195                echo "post_max_size:   " ;
196                echo  ini_get( 'post_max_size' );
197                echo "<br />\n";
198                echo "upload_max_filesize:   " ;
199                echo  ini_get( 'upload_max_filesize' );
200                echo "<br />\n";
201                echo "display_errors:   " ;
202                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
203                echo "<br />\n";
204                echo "MB extension:   " ;
205                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
206                echo "<br />\n";
207                echo "mbstring.language:   " ;
208                echo  ini_get( 'mbstring.language' );
209                echo "<br />\n";
210                echo "mbstring.encoding_translation:   " ;
211                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
212                echo "<br />\n";
213                echo "mbstring.internal_encoding:   " ;
214                echo  ini_get( 'mbstring.internal_encoding' );
215                echo "<br />\n";
216                echo "mbstring.http_input:   " ;
217                echo  ini_get( 'mbstring.http_input' );
218                echo "<br />\n";
219                echo "mbstring.http_output:   " ;
220                echo  ini_get( 'mbstring.http_output' );
221                echo "<br />\n";
222                echo "mbstring.detect_order:   " ;
223                echo  ini_get( 'mbstring.detect_order' );
224                echo "<br />\n";
225                echo "mbstring.substitute_character:   " ;
226                echo  ini_get( 'mbstring.substitute_character' );
227                echo "<br />\n";
228                echo "mbstring.func_overload:   " ;
229                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
230                echo "<br />\n";
231                echo "<br />\n";
232        } else {
233                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_SYSTEM_INFO . "</legend>";
234                echo "<div style='padding: 8px;'>";
235                echo "<label>" . "<strong>SERVER:</strong>" . ":</label><text>" . $_SERVER['SERVER_SOFTWARE'] . "</text><br />";
236                echo "<label>" . "<strong>PHP Version:</strong>" . ":</label><text>" . phpversion() . "</text><br />";
237                echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
238                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
239                echo "</text><br />";
240                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
241                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
242                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
243                echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
244                echo "<label>" . "<strong>WP DB Version:</strong>" . ":</label><text>" . $wp_db_version . "</text><br />";
245
246                echo "</div>";
247                echo "<div style='padding: 8px;'>";
248                echo "<label>safemode:</label><text>";
249                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
250                echo "</text><br />";
251                echo "<label>register_globals:</label><text>";
252                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
253                echo "</text><br />";
254                echo "<label>magic_quotes_gpc:</label><text>";
255                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
256                echo "</text><br />";
257                echo "<label>XML extension:</label><text>";
258                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
259                echo "</text><br />";
260                echo "<label>memory_limit:</label><text>";
261                echo  ini_get( 'memory_limit' );
262                echo "</text><br />";
263                echo "<label>post_max_size:</label><text>";
264                echo  ini_get( 'post_max_size' );
265                echo "</text><br />";
266                echo "<label>upload_max_filesize:</label><text>";
267                echo  ini_get( 'upload_max_filesize' );
268                echo "</text><br />";
269                echo "<label>display_errors:</label><text>";
270                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
271                echo "</text><br />";
272                echo "<label>MB extension:</label><text>";
273                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
274                echo "</text><br />";
275                echo "<label>mbstring.language:</label><text>";
276                echo  ini_get( 'mbstring.language' );
277                echo "</text><br />";
278                echo "<label>mbstring.encoding_translation:</label><text>";
279                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
280                echo "</text><br />";
281                echo "<label>mbstring.internal_encoding:</label><text>";
282                echo  ini_get( 'mbstring.internal_encoding' );
283                echo "</text><br />";
284                echo "<label>mbstring.http_input:</label><text>";
285                echo  ini_get( 'mbstring.http_input' );
286                echo "</text><br />";
287                echo "<label>mbstring.http_output:</label><text>";
288                echo  ini_get( 'mbstring.http_output' );
289                echo "</text><br />";
290                echo "<label>mbstring.detect_order:</label><text>";
291                echo  ini_get( 'mbstring.detect_order' );
292                echo "</text><br />";
293                echo "<label>mbstring.substitute_character:</label><text>";
294                echo  ini_get( 'mbstring.substitute_character' );
295                echo "</text><br />";
296                echo "<label>mbstring.func_overload:</label><text>";
297                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
298                echo "</text><br />";
299                echo "</div>";
300                echo "</fieldset><br />";
301        }
302}
303
304function xpress_config_from_xoops_view($is_report = false)
305{
306        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
307        $xoops_config = new ConfigFromXoops;
308        if ($is_report) {
309                echo "******** "  . _AM_XP2_XOOPS_CONFIG_INFO . "********" . "<br />\n";
310                echo 'XOOPS_ROOT_PATH:  ' ;
311                if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
312                        echo 'ERROR ';
313                else
314                        echo 'OK ';     
315                echo "<br />\n";
316
317                echo 'XOOPS_TRUST_PATH:  ' ;
318                if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
319                        echo 'ERROR ';
320                else
321                        echo 'OK ';     
322                echo "<br />\n";
323
324                echo 'XOOPS_URL:  ' ;
325                if(XOOPS_URL !== $xoops_config->xoops_url)
326                        echo 'ERROR ';
327                else
328                        echo 'OK ';     
329                echo "<br />\n";
330
331                if (defined('XOOPS_SALT')){
332                        echo 'XOOPS_SALT:  ' ;
333                        if(XOOPS_SALT !== $xoops_config->xoops_salt)
334                                echo 'ERROR ';
335                        else
336                                echo 'OK ';     
337                        echo "<br />\n";
338                }
339
340                if (defined('XOOPS_DB_SALT')){
341                        echo 'XOOPS_DB_SALT:  ' ;
342                        if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
343                                echo 'ERROR ';
344                        else
345                                echo 'OK ';     
346                        echo "<br />\n";
347                }
348
349                echo 'XOOPS_DB_HOST:  ' ;
350                if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
351                        echo 'ERROR ';
352                else
353                        echo 'OK ';     
354                echo "<br />\n";
355
356                echo 'XOOPS_DB_USER:  ' ;
357                if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
358                        echo 'ERROR ';
359                else
360                        echo 'OK ';     
361                echo "<br />\n";
362
363                echo 'XOOPS_DB_PASS:  ' ;
364                if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
365                        echo 'ERROR ';
366                else
367                        echo 'OK ';     
368                echo "<br />\n";
369
370                echo 'XOOPS_DB_NAME:  ' ;
371                if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
372                        echo 'ERROR ';
373                else
374                        echo 'OK ';     
375                echo "<br />\n";
376
377                echo 'XOOPS_DB_PREFIX:  ' ;
378                if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
379                        echo 'ERROR ';
380                else
381                        echo 'OK ';     
382                echo "<br />\n";
383                echo "<br />\n";
384
385        } else {
386                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_XOOPS_CONFIG_INFO . "</legend>";
387                echo "<div style='padding: 8px;'>";
388                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
389                echo '<tbody>';
390                echo '<tr>';
391                echo '<td>Define item</td>';
392                echo '<td>XOOPS setting value</td>';
393                echo '<td>xoops_config get value</td>';
394                echo '</tr>';
395                echo '<tr>';
396                if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
397                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_ROOT_PATH</span></strong></td>';
398                else
399                        echo '<td>XOOPS_ROOT_PATH</td>';       
400                echo '<td>' . XOOPS_ROOT_PATH . '</td>';
401                echo '<td>' . $xoops_config->xoops_root_path . '</td>';
402                echo '</tr>';
403
404                echo '<tr>';
405                if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
406                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_TRUST_PATH</span></strong></td>';
407                else
408                        echo '<td>XOOPS_TRUST_PATH</td>';       
409                echo '<td>' . XOOPS_TRUST_PATH . '</td>';
410                echo '<td>' . $xoops_config->xoops_trust_path . '</td>';
411                echo '</tr>';
412
413                echo '<tr>';
414                if(XOOPS_URL !== $xoops_config->xoops_url)
415                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_URL</span></strong></td>';
416                else
417                        echo '<td>XOOPS_URL</td>';     
418                echo '<td>' . XOOPS_URL . '</td>';
419                echo '<td>' . $xoops_config->xoops_url . '</td>';
420                echo '</tr>';
421
422                if (defined('XOOPS_SALT')){
423                        echo '<tr>';
424                        if(XOOPS_SALT !== $xoops_config->xoops_salt)
425                                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_SALT</span></strong></td>';
426                        else
427                                echo '<td>XOOPS_SALT</td>';
428                        echo '<td>' . XOOPS_SALT . '</td>';
429                        echo '<td>' . $xoops_config->xoops_salt . '</td>';
430                        echo '</tr>';
431                }
432
433                if (defined('XOOPS_DB_SALT')){
434                        echo '<tr>';
435                        if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
436                                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_SALT</span></strong></td>';
437                        else
438                                echo '<td>XOOPS_DB_SALT</td>';
439                        echo '<td>' . XOOPS_DB_SALT . '</td>';
440                        echo '<td>' . $xoops_config->xoops_db_salt . '</td>';
441                        echo '</tr>';
442                }
443
444                echo '<tr>';
445                if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
446                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_HOST</span></strong></td>';
447                else
448                        echo '<td>XOOPS_DB_HOST</td>';
449                echo '<td>' . XOOPS_DB_HOST . '</td>';
450                echo '<td>' . $xoops_config->xoops_db_host . '</td>';
451                echo '</tr>';
452
453                echo '<tr>';
454                if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
455                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_USER</span></strong></td>';
456                else
457                        echo '<td>XOOPS_DB_USER</td>';
458                echo '<td>' . XOOPS_DB_USER . '</td>';
459                echo '<td>' . $xoops_config->xoops_db_user . '</td>';
460                echo '</tr>';
461
462                echo '<tr>';
463                if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
464                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PASS</span></strong></td>';
465                else
466                        echo '<td>XOOPS_DB_PASS</td>';
467                echo '<td>' . XOOPS_DB_PASS . '</td>';
468                echo '<td>' . $xoops_config->xoops_db_pass . '</td>';
469                echo '</tr>';
470
471                echo '<tr>';
472                if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
473                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_NAME</span></strong></td>';
474                else
475                        echo '<td>XOOPS_DB_NAME</td>';
476                echo '<td>' . XOOPS_DB_NAME . '</td>';
477                echo '<td>' . $xoops_config->xoops_db_name . '</td>';
478                echo '</tr>';
479
480                echo '<tr>';
481                if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
482                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PREFIX</span></strong></td>';
483                else
484                        echo '<td>XOOPS_DB_PREFIX</td>';
485                echo '<td>' . XOOPS_DB_PREFIX . '</td>';
486                echo '<td>' . $xoops_config->xoops_db_prefix . '</td>';
487                echo '</tr>';
488                echo '</tbody>';
489                echo '</table>';
490                echo "</div>";
491                echo "</fieldset><br />";
492        }
493}
494
495function xpress_state($is_report = false)
496{
497        global $xoopsModule;
498        include(dirname(__FILE__) . '/../wp-includes/version.php');
499        include(dirname(__FILE__) . '/../include/general_functions.php');
500
501        $xoopsDB =& Database::getInstance();
502       
503        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
504        if ($xp_prefix == 'wordpress'){
505                $xp_prefix = 'wp';
506        }
507
508        $prefix = $xoopsDB->prefix($xp_prefix . '_');
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);
527               
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                }
569        }
570}
571function xpress_block_state($is_report = false)
572{
573        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
574        $xoops_config = new ConfigFromXoops;
575       
576        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
577        $xoops_block_check =& xoops_block_check::getInstance();
578        $xoops_block_check->check_blocks($xoops_config->module_name);
579        if ($is_report){
580                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
581                echo $xoops_block_check->get_message();
582                echo "<br />\n";
583                echo "<br />\n";
584        } else {
585                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_STATS . "</legend>";
586                echo "<div style='padding: 8px;'>";
587                echo $xoops_block_check->get_message();
588                echo "</div>";
589                echo "</fieldset>";
590        }               
591}
592       
593$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
594$mydirpath = dirname( dirname( __FILE__ ) ) ;
595//require_once($mydirpath.'/wp-config.php');
596       
597require_once '../../../include/cp_header.php' ;
598//require_once '../include/gtickets.php' ;
599//define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ;
600
601// branch for altsys
602if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) {
603
604        // common libs (eg. altsys)
605        $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
606        $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
607       
608        if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
609                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
610        } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
611                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
612        } else {
613                die( 'wrong request' ) ;
614        }
615        exit ;
616}
617
618// beggining of Output
619xoops_cp_header();
620include( './mymenu.php' ) ;
621
622echo "
623        <style type=\"text/css\">
624        label,text {
625                display: block;
626                float: left;
627                margin-bottom: 2px;
628        }
629        label {
630                text-align: right;
631                width: 200px;
632                padding-right: 20px;
633        }
634        br {
635                clear: left;
636        }
637        </style>
638";
639
640if (!empty($_POST['submit_report'])) $report = true; else $report = false;
641xpress_sys_info($report);
642xpress_config_from_xoops_view($report);
643xpress_active_plugin_list($report);
644xpress_block_state($report);
645admin_check_user_meta_prefix($report);
646xpress_state($report);
647echo '<form method="POST">'."\n";
648echo '<input type="submit" name="submit_report" value="' . _AM_XP2_SYS_REPORT .' " />'.'&emsp;';
649echo '<input type="submit" name="submit_normal" value="' . _AM_XP2_SYS_NORMAL .' " />'."<br />\n";
650echo "</form>\n";
651
652xoops_cp_footer();
653
654       
655?>
Note: See TracBrowser for help on using the repository browser.