XPressME Integration Kit

Trac

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

Last change on this file since 491 was 491, checked in by toemon, 14 years ago

Memory Limitを設定可能に Fixes #272

File size: 24.0 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        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
167
168        if ($is_report) {
169                echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
170                echo "SERVER:  ". $_SERVER['SERVER_SOFTWARE']. "<br />\n";
171                echo "PHP Version:   " . phpversion() . "<br />\n";
172                echo 'libxml Version:  ';
173                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
174                echo "<br />\n";;
175                echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />";
176                echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />";
177                echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
178                echo "WordPress Version:   " . $wp_version . "<br />\n";
179                echo "WP DB Version:   " . $wp_db_version . "<br />\n";
180                echo "<br />\n";
181                echo "safemode:   " ;
182                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
183                echo "<br />\n";
184                echo "register_globals:   " ;
185                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF" ;
186                echo "<br />\n";
187                echo "magic_quotes_gpc:   " ;
188                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
189                echo "<br />\n";
190                echo "XML extension:   " ;
191                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
192                echo "<br />\n";
193                echo "default memory_limit:   " ;
194                echo  ini_get( 'memory_limit' );
195                echo "<br />\n";
196                $xoops_config = new ConfigFromXoops;
197                $xoops_config->xpress_set_memory_limmit();
198                echo "change memory_limit:   " ;
199                echo  ini_get( 'memory_limit' );
200                echo "<br />\n";
201               
202                echo "post_max_size:   " ;
203                echo  ini_get( 'post_max_size' );
204                echo "<br />\n";
205                echo "upload_max_filesize:   " ;
206                echo  ini_get( 'upload_max_filesize' );
207                echo "<br />\n";
208                echo "display_errors:   " ;
209                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
210                echo "<br />\n";
211                echo "MB extension:   " ;
212                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
213                echo "<br />\n";
214                echo "mbstring.language:   " ;
215                echo  ini_get( 'mbstring.language' );
216                echo "<br />\n";
217                echo "mbstring.encoding_translation:   " ;
218                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
219                echo "<br />\n";
220                echo "mbstring.internal_encoding:   " ;
221                echo  ini_get( 'mbstring.internal_encoding' );
222                echo "<br />\n";
223                echo "mbstring.http_input:   " ;
224                echo  ini_get( 'mbstring.http_input' );
225                echo "<br />\n";
226                echo "mbstring.http_output:   " ;
227                echo  ini_get( 'mbstring.http_output' );
228                echo "<br />\n";
229                echo "mbstring.detect_order:   " ;
230                echo  ini_get( 'mbstring.detect_order' );
231                echo "<br />\n";
232                echo "mbstring.substitute_character:   " ;
233                echo  ini_get( 'mbstring.substitute_character' );
234                echo "<br />\n";
235                echo "mbstring.func_overload:   " ;
236                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
237                echo "<br />\n";
238                echo "<br />\n";
239        } else {
240                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_SYSTEM_INFO . "</legend>";
241                echo "<div style='padding: 8px;'>";
242                echo "<label>" . "<strong>SERVER:</strong>" . ":</label><text>" . $_SERVER['SERVER_SOFTWARE'] . "</text><br />";
243                echo "<label>" . "<strong>PHP Version:</strong>" . ":</label><text>" . phpversion() . "</text><br />";
244                echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
245                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
246                echo "</text><br />";
247                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
248                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
249                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
250                echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
251                echo "<label>" . "<strong>WP DB Version:</strong>" . ":</label><text>" . $wp_db_version . "</text><br />";
252
253                echo "</div>";
254                echo "<div style='padding: 8px;'>";
255                echo "<label>safemode:</label><text>";
256                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
257                echo "</text><br />";
258                echo "<label>register_globals:</label><text>";
259                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
260                echo "</text><br />";
261                echo "<label>magic_quotes_gpc:</label><text>";
262                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
263                echo "</text><br />";
264                echo "<label>XML extension:</label><text>";
265                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
266                echo "</text><br />";
267                echo "<label>default memory_limit:</label><text>";
268                echo  ini_get( 'memory_limit' );
269                echo "</text><br />";
270                $xoops_config = new ConfigFromXoops;
271                $xoops_config->xpress_set_memory_limmit();
272                echo "<label>change memory_limit:</label><text>";
273                echo  ini_get( 'memory_limit' );
274                echo "</text><br />";
275
276                echo "<label>post_max_size:</label><text>";
277                echo  ini_get( 'post_max_size' );
278                echo "</text><br />";
279                echo "<label>upload_max_filesize:</label><text>";
280                echo  ini_get( 'upload_max_filesize' );
281                echo "</text><br />";
282                echo "<label>display_errors:</label><text>";
283                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
284                echo "</text><br />";
285                echo "<label>MB extension:</label><text>";
286                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
287                echo "</text><br />";
288                echo "<label>mbstring.language:</label><text>";
289                echo  ini_get( 'mbstring.language' );
290                echo "</text><br />";
291                echo "<label>mbstring.encoding_translation:</label><text>";
292                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
293                echo "</text><br />";
294                echo "<label>mbstring.internal_encoding:</label><text>";
295                echo  ini_get( 'mbstring.internal_encoding' );
296                echo "</text><br />";
297                echo "<label>mbstring.http_input:</label><text>";
298                echo  ini_get( 'mbstring.http_input' );
299                echo "</text><br />";
300                echo "<label>mbstring.http_output:</label><text>";
301                echo  ini_get( 'mbstring.http_output' );
302                echo "</text><br />";
303                echo "<label>mbstring.detect_order:</label><text>";
304                echo  ini_get( 'mbstring.detect_order' );
305                echo "</text><br />";
306                echo "<label>mbstring.substitute_character:</label><text>";
307                echo  ini_get( 'mbstring.substitute_character' );
308                echo "</text><br />";
309                echo "<label>mbstring.func_overload:</label><text>";
310                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
311                echo "</text><br />";
312                echo "</div>";
313                echo "</fieldset><br />";
314        }
315}
316
317function xpress_config_from_xoops_view($is_report = false)
318{
319        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
320        $xoops_config = new ConfigFromXoops;
321        if ($is_report) {
322                echo "******** "  . _AM_XP2_XOOPS_CONFIG_INFO . "********" . "<br />\n";
323                echo 'XOOPS_ROOT_PATH:  ' ;
324                if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
325                        echo 'ERROR ';
326                else
327                        echo 'OK ';     
328                echo "<br />\n";
329
330                echo 'XOOPS_TRUST_PATH:  ' ;
331                if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
332                        echo 'ERROR ';
333                else
334                        echo 'OK ';     
335                echo "<br />\n";
336
337                echo 'XOOPS_URL:  ' ;
338                if(XOOPS_URL !== $xoops_config->xoops_url)
339                        echo 'ERROR ';
340                else
341                        echo 'OK ';     
342                echo "<br />\n";
343
344                if (defined('XOOPS_SALT')){
345                        echo 'XOOPS_SALT:  ' ;
346                        if(XOOPS_SALT !== $xoops_config->xoops_salt)
347                                echo 'ERROR ';
348                        else
349                                echo 'OK ';     
350                        echo "<br />\n";
351                }
352
353                if (defined('XOOPS_DB_SALT')){
354                        echo 'XOOPS_DB_SALT:  ' ;
355                        if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
356                                echo 'ERROR ';
357                        else
358                                echo 'OK ';     
359                        echo "<br />\n";
360                }
361
362                echo 'XOOPS_DB_HOST:  ' ;
363                if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
364                        echo 'ERROR ';
365                else
366                        echo 'OK ';     
367                echo "<br />\n";
368
369                echo 'XOOPS_DB_USER:  ' ;
370                if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
371                        echo 'ERROR ';
372                else
373                        echo 'OK ';     
374                echo "<br />\n";
375
376                echo 'XOOPS_DB_PASS:  ' ;
377                if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
378                        echo 'ERROR ';
379                else
380                        echo 'OK ';     
381                echo "<br />\n";
382
383                echo 'XOOPS_DB_NAME:  ' ;
384                if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
385                        echo 'ERROR ';
386                else
387                        echo 'OK ';     
388                echo "<br />\n";
389
390                echo 'XOOPS_DB_PREFIX:  ' ;
391                if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
392                        echo 'ERROR ';
393                else
394                        echo 'OK ';     
395                echo "<br />\n";
396                echo "<br />\n";
397
398        } else {
399                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_XOOPS_CONFIG_INFO . "</legend>";
400                echo "<div style='padding: 8px;'>";
401                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
402                echo '<tbody>';
403                echo '<tr>';
404                echo '<td>Define item</td>';
405                echo '<td>XOOPS setting value</td>';
406                echo '<td>xoops_config get value</td>';
407                echo '</tr>';
408                echo '<tr>';
409                if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
410                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_ROOT_PATH</span></strong></td>';
411                else
412                        echo '<td>XOOPS_ROOT_PATH</td>';       
413                echo '<td>' . XOOPS_ROOT_PATH . '</td>';
414                echo '<td>' . $xoops_config->xoops_root_path . '</td>';
415                echo '</tr>';
416
417                echo '<tr>';
418                if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
419                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_TRUST_PATH</span></strong></td>';
420                else
421                        echo '<td>XOOPS_TRUST_PATH</td>';       
422                echo '<td>' . XOOPS_TRUST_PATH . '</td>';
423                echo '<td>' . $xoops_config->xoops_trust_path . '</td>';
424                echo '</tr>';
425
426                echo '<tr>';
427                if(XOOPS_URL !== $xoops_config->xoops_url)
428                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_URL</span></strong></td>';
429                else
430                        echo '<td>XOOPS_URL</td>';     
431                echo '<td>' . XOOPS_URL . '</td>';
432                echo '<td>' . $xoops_config->xoops_url . '</td>';
433                echo '</tr>';
434
435                if (defined('XOOPS_SALT')){
436                        echo '<tr>';
437                        if(XOOPS_SALT !== $xoops_config->xoops_salt)
438                                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_SALT</span></strong></td>';
439                        else
440                                echo '<td>XOOPS_SALT</td>';
441                        echo '<td>' . XOOPS_SALT . '</td>';
442                        echo '<td>' . $xoops_config->xoops_salt . '</td>';
443                        echo '</tr>';
444                }
445
446                if (defined('XOOPS_DB_SALT')){
447                        echo '<tr>';
448                        if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
449                                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_SALT</span></strong></td>';
450                        else
451                                echo '<td>XOOPS_DB_SALT</td>';
452                        echo '<td>' . XOOPS_DB_SALT . '</td>';
453                        echo '<td>' . $xoops_config->xoops_db_salt . '</td>';
454                        echo '</tr>';
455                }
456
457                echo '<tr>';
458                if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
459                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_HOST</span></strong></td>';
460                else
461                        echo '<td>XOOPS_DB_HOST</td>';
462                echo '<td>' . XOOPS_DB_HOST . '</td>';
463                echo '<td>' . $xoops_config->xoops_db_host . '</td>';
464                echo '</tr>';
465
466                echo '<tr>';
467                if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
468                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_USER</span></strong></td>';
469                else
470                        echo '<td>XOOPS_DB_USER</td>';
471                echo '<td>' . XOOPS_DB_USER . '</td>';
472                echo '<td>' . $xoops_config->xoops_db_user . '</td>';
473                echo '</tr>';
474
475                echo '<tr>';
476                if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
477                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PASS</span></strong></td>';
478                else
479                        echo '<td>XOOPS_DB_PASS</td>';
480                echo '<td>' . XOOPS_DB_PASS . '</td>';
481                echo '<td>' . $xoops_config->xoops_db_pass . '</td>';
482                echo '</tr>';
483
484                echo '<tr>';
485                if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
486                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_NAME</span></strong></td>';
487                else
488                        echo '<td>XOOPS_DB_NAME</td>';
489                echo '<td>' . XOOPS_DB_NAME . '</td>';
490                echo '<td>' . $xoops_config->xoops_db_name . '</td>';
491                echo '</tr>';
492
493                echo '<tr>';
494                if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
495                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PREFIX</span></strong></td>';
496                else
497                        echo '<td>XOOPS_DB_PREFIX</td>';
498                echo '<td>' . XOOPS_DB_PREFIX . '</td>';
499                echo '<td>' . $xoops_config->xoops_db_prefix . '</td>';
500                echo '</tr>';
501                echo '</tbody>';
502                echo '</table>';
503                echo "</div>";
504                echo "</fieldset><br />";
505        }
506}
507
508function xpress_state($is_report = false)
509{
510        global $xoopsModule;
511        include(dirname(__FILE__) . '/../wp-includes/version.php');
512        include_once(dirname(__FILE__) . '/../include/general_functions.php');
513
514        $xoopsDB =& Database::getInstance();
515       
516        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
517        if ($xp_prefix == 'wordpress'){
518                $xp_prefix = 'wp';
519        }
520
521        $prefix = $xoopsDB->prefix($xp_prefix . '_');
522       
523        $posts_tables = get_table_list($prefix,'posts');
524        $blogname = array();
525        $count_article = array();
526        $count_author = array();
527        $count_category = array();
528        $array_index = 0;
529        foreach( $posts_tables as $posts_table){
530                $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')";
531                $result = $xoopsDB->query($sql);
532                if($myrow = $xoopsDB->fetchArray($result)){
533                        $count_article[$array_index] = $myrow["count_article"];
534                        $count_author[$array_index] = $myrow["count_author"];
535                } else {
536                        $count_article[$array_index] = 0;
537                        $count_author[$array_index] = 0;
538                }
539                $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table);
540               
541                $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'";
542                $result = $xoopsDB->query($sql);
543                if($myrow = $xoopsDB->fetchArray($result)){
544                        $blogname[$array_index] = $myrow["blogname"];
545                } else {
546                        $blogname[$array_index] = 'none name';
547                }
548               
549                if ($wp_db_version < 6124){
550                       
551                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories";
552                } else {
553                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'";
554                }
555                $result = $xoopsDB->query($sql);
556                if($myrow = $xoopsDB->fetchArray($result)){
557                        $count_category[$array_index] = $myrow["count_category"];
558                } else {
559                        $count_category[$array_index] = 0;
560                }
561                $array_index++;
562        }
563        for ($i = 0 ; $i < $array_index ; $i++){
564                if ($is_report){
565                        echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "<br />\n";
566                        echo _AM_XP2_CATEGORIES .":  ".@$count_category[$i]. "<br />\n";
567                        echo _AM_XP2_ARTICLES .":  ". $count_article[$i]. "<br />\n";
568                        echo _AM_XP2_AUTHORS .":  ". $count_author[$i]. "<br />\n";
569                       
570                } else {
571                        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . $blogname[$i] . _AM_XP2_STATS . "</legend>";
572                        echo "<div style='padding: 8px;'>";
573                        echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category[$i];
574                        echo "</text><br />";
575                        echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article[$i];
576                        echo "</text><br />";
577                        echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author[$i];
578                        echo "</text>";
579                        echo "</div>";
580                        echo "</fieldset>";
581                }
582        }
583}
584function xpress_block_state($is_report = false)
585{
586        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
587
588        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
589        $xoops_block_check =& xoops_block_check::getInstance();
590        $xoops_block_check->check_blocks($mydirname);
591        if ($is_report){
592                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
593                echo $xoops_block_check->get_message();
594                echo "<br />\n";
595                echo "<br />\n";
596        } else {
597                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_STATS . "</legend>";
598                echo "<div style='padding: 8px;'>";
599                echo $xoops_block_check->get_message();
600                echo "</div>";
601                echo "</fieldset>";
602        }               
603}
604       
605$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
606$mydirpath = dirname( dirname( __FILE__ ) ) ;
607//require_once($mydirpath.'/wp-config.php');
608       
609require_once '../../../include/cp_header.php' ;
610//require_once '../include/gtickets.php' ;
611//define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ;
612
613// branch for altsys
614if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) {
615
616        // common libs (eg. altsys)
617        $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
618        $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
619       
620        if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
621                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
622        } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
623                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
624        } else {
625                die( 'wrong request' ) ;
626        }
627        exit ;
628}
629
630// beggining of Output
631xoops_cp_header();
632include( './mymenu.php' ) ;
633
634echo "
635        <style type=\"text/css\">
636        label,text {
637                display: block;
638                float: left;
639                margin-bottom: 2px;
640        }
641        label {
642                text-align: right;
643                width: 200px;
644                padding-right: 20px;
645        }
646        br {
647                clear: left;
648        }
649        </style>
650";
651
652if (!empty($_POST['submit_report'])) $report = true; else $report = false;
653xpress_sys_info($report);
654xpress_config_from_xoops_view($report);
655xpress_active_plugin_list($report);
656xpress_block_state($report);
657admin_check_user_meta_prefix($report);
658xpress_state($report);
659echo '<form method="POST">'."\n";
660echo '<input type="submit" name="submit_report" value="' . _AM_XP2_SYS_REPORT .' " />'.'&emsp;';
661echo '<input type="submit" name="submit_normal" value="' . _AM_XP2_SYS_NORMAL .' " />'."<br />\n";
662echo "</form>\n";
663
664xoops_cp_footer();
665
666       
667?>
Note: See TracBrowser for help on using the repository browser.