XPressME Integration Kit

Trac

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

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

システム情報にブロックオプションのデータ表示を追加 Fixes #284

File size: 27.1 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 '</legend>';
73                echo "</fieldset><br />";
74        }
75
76}
77
78function get_xpress_plugin_data( $plugin_file, $markup = true, $translate = true ) {
79        // We don't need to write to the file, so just open for reading.
80        $fp = fopen($plugin_file, 'r');
81
82        // Pull only the first 8kiB of the file in.
83        $plugin_data = fread( $fp, 8192 );
84
85        // PHP will close file handle, but we are good citizens.
86        fclose($fp);
87
88        preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
89        preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
90        preg_match( '|Version:(.*)|i', $plugin_data, $version );
91        preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
92        preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
93        preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
94        preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
95        preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );
96
97        foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
98                if ( !empty( ${$field} ) )
99                        ${$field} = trim(${$field}[1]);
100                else
101                        ${$field} = '';
102        }
103
104        $plugin_data = array(
105                                'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description,
106                                'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version,
107                                'TextDomain' => $text_domain, 'DomainPath' => $domain_path
108                                );
109//      if ( $markup || $translate )
110//              $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
111        return $plugin_data;
112}
113
114
115function get_xpress_active_plugin_list($before_str = '')
116{
117        global $xoopsModule;
118        $xoopsDB =& Database::getInstance();
119       
120        $mydirname = basename(dirname(dirname(__FILE__)));
121        $my_dirpath = dirname(dirname(__FILE__));
122        $prefix = $mydirname;
123        if ($prefix == 'wordpress') $prefix ='wp';
124        $wp_prefix = $xoopsDB->prefix($prefix);
125
126        $option_table = $wp_prefix . '_options';
127       
128        $sql = "SELECT option_value FROM $option_table WHERE option_name = 'active_plugins'";
129        $res =  $xoopsDB->query($sql, 0, 0);
130        if ($res === false){
131            return ;
132        } else {
133                $row = $xoopsDB->fetchArray($res);
134                $active_plugins = @unserialize($row['option_value']);
135                $output = '';
136                foreach($active_plugins as $active_plugin_path){
137                        $file_name =  $my_dirpath . '/wp-content/plugins/' . $active_plugin_path;
138                        $active_plugin = get_xpress_plugin_data($file_name);
139                        $output .= $before_str . $active_plugin['Name'] . ':   Version ' . $active_plugin['Version'] . ':  (' .$active_plugin['PluginURI'] . ')<br />';
140                }
141               
142               
143                return $output;
144        }
145
146       
147}
148
149function xpress_active_plugin_list($is_report = false)
150{
151        if ($is_report) {
152                echo "******** "  . _AM_XP2_PLUGIN . "********" . "<br />\n";
153                echo get_xpress_active_plugin_list('') . "<br />\n";
154        } else {
155                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_PLUGIN . "</legend>";
156                echo "<div style='padding: 8px;'>";
157                echo get_xpress_active_plugin_list();
158                echo "</div>";
159                echo '</legend>';
160                echo "</fieldset><br />";
161        }
162}
163
164function xpress_sys_info($is_report = false)
165{
166        global $xoopsModule;
167        include(dirname(__FILE__) . '/../wp-includes/version.php');
168        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
169
170        if ($is_report) {
171                echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
172                echo "SERVER:  ". $_SERVER['SERVER_SOFTWARE']. "<br />\n";
173                echo "PHP Version:   " . phpversion() . "<br />\n";
174                echo 'libxml Version:  ';
175                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
176                echo "<br />\n";;
177                echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />";
178                echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />";
179                echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
180                echo "WordPress Version:   " . $wp_version . "<br />\n";
181                echo "WP DB Version:   " . $wp_db_version . "<br />\n";
182                echo "<br />\n";
183                echo "safemode:   " ;
184                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
185                echo "<br />\n";
186                echo "register_globals:   " ;
187                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF" ;
188                echo "<br />\n";
189                echo "magic_quotes_gpc:   " ;
190                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
191                echo "<br />\n";
192                echo "XML extension:   " ;
193                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
194                echo "<br />\n";
195                echo "default memory_limit:   " ;
196                echo  ini_get( 'memory_limit' );
197                echo "<br />\n";
198                $xoops_config = new ConfigFromXoops;
199                $xoops_config->xpress_set_memory_limmit();
200                echo "change memory_limit:   " ;
201                echo  ini_get( 'memory_limit' );
202                echo "<br />\n";
203               
204                echo "post_max_size:   " ;
205                echo  ini_get( 'post_max_size' );
206                echo "<br />\n";
207                echo "upload_max_filesize:   " ;
208                echo  ini_get( 'upload_max_filesize' );
209                echo "<br />\n";
210                echo "display_errors:   " ;
211                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
212                echo "<br />\n";
213                echo "MB extension:   " ;
214                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
215                echo "<br />\n";
216                echo "mbstring.language:   " ;
217                echo  ini_get( 'mbstring.language' );
218                echo "<br />\n";
219                echo "mbstring.encoding_translation:   " ;
220                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
221                echo "<br />\n";
222                echo "mbstring.internal_encoding:   " ;
223                echo  ini_get( 'mbstring.internal_encoding' );
224                echo "<br />\n";
225                echo "mbstring.http_input:   " ;
226                echo  ini_get( 'mbstring.http_input' );
227                echo "<br />\n";
228                echo "mbstring.http_output:   " ;
229                echo  ini_get( 'mbstring.http_output' );
230                echo "<br />\n";
231                echo "mbstring.detect_order:   " ;
232                echo  ini_get( 'mbstring.detect_order' );
233                echo "<br />\n";
234                echo "mbstring.substitute_character:   " ;
235                echo  ini_get( 'mbstring.substitute_character' );
236                echo "<br />\n";
237                echo "mbstring.func_overload:   " ;
238                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
239                echo "<br />\n";
240                echo "<br />\n";
241        } else {
242                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_SYSTEM_INFO . "</legend>";
243                echo "<div style='padding: 8px;'>";
244                echo "<label>" . "<strong>SERVER:</strong>" . ":</label><text>" . $_SERVER['SERVER_SOFTWARE'] . "</text><br />";
245                echo "<label>" . "<strong>PHP Version:</strong>" . ":</label><text>" . phpversion() . "</text><br />";
246                echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
247                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
248                echo "</text><br />";
249                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
250                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
251                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
252                echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
253                echo "<label>" . "<strong>WP DB Version:</strong>" . ":</label><text>" . $wp_db_version . "</text><br />";
254
255                echo "</div>";
256                echo "<div style='padding: 8px;'>";
257                echo "<label>safemode:</label><text>";
258                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
259                echo "</text><br />";
260                echo "<label>register_globals:</label><text>";
261                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
262                echo "</text><br />";
263                echo "<label>magic_quotes_gpc:</label><text>";
264                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
265                echo "</text><br />";
266                echo "<label>XML extension:</label><text>";
267                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
268                echo "</text><br />";
269                echo "<label>default memory_limit:</label><text>";
270                echo  ini_get( 'memory_limit' );
271                echo "</text><br />";
272                $xoops_config = new ConfigFromXoops;
273                $xoops_config->xpress_set_memory_limmit();
274                echo "<label>change memory_limit:</label><text>";
275                echo  ini_get( 'memory_limit' );
276                echo "</text><br />";
277
278                echo "<label>post_max_size:</label><text>";
279                echo  ini_get( 'post_max_size' );
280                echo "</text><br />";
281                echo "<label>upload_max_filesize:</label><text>";
282                echo  ini_get( 'upload_max_filesize' );
283                echo "</text><br />";
284                echo "<label>display_errors:</label><text>";
285                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
286                echo "</text><br />";
287                echo "<label>MB extension:</label><text>";
288                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
289                echo "</text><br />";
290                echo "<label>mbstring.language:</label><text>";
291                echo  ini_get( 'mbstring.language' );
292                echo "</text><br />";
293                echo "<label>mbstring.encoding_translation:</label><text>";
294                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
295                echo "</text><br />";
296                echo "<label>mbstring.internal_encoding:</label><text>";
297                echo  ini_get( 'mbstring.internal_encoding' );
298                echo "</text><br />";
299                echo "<label>mbstring.http_input:</label><text>";
300                echo  ini_get( 'mbstring.http_input' );
301                echo "</text><br />";
302                echo "<label>mbstring.http_output:</label><text>";
303                echo  ini_get( 'mbstring.http_output' );
304                echo "</text><br />";
305                echo "<label>mbstring.detect_order:</label><text>";
306                echo  ini_get( 'mbstring.detect_order' );
307                echo "</text><br />";
308                echo "<label>mbstring.substitute_character:</label><text>";
309                echo  ini_get( 'mbstring.substitute_character' );
310                echo "</text><br />";
311                echo "<label>mbstring.func_overload:</label><text>";
312                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
313                echo "</text><br />";
314                echo "</div>";
315                echo '</legend>';
316                echo "</fieldset><br />";
317        }
318}
319
320
321function xpress_config_report_view()
322{
323        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
324        $xoops_config = new ConfigFromXoops;
325        echo 'XOOPS_ROOT_PATH:  ' ;
326        if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
327                echo 'ERROR ';
328        else
329                echo 'OK ';     
330        echo "<br />\n";
331
332        echo 'XOOPS_TRUST_PATH:  ' ;
333        if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
334                echo 'ERROR ';
335        else
336                echo 'OK ';     
337        echo "<br />\n";
338
339        echo 'XOOPS_URL:  ' ;
340        if(XOOPS_URL !== $xoops_config->xoops_url)
341                echo 'ERROR ';
342        else
343                echo 'OK ';     
344        echo "<br />\n";
345
346        if (defined('XOOPS_SALT')){
347                echo 'XOOPS_SALT:  ' ;
348                if(XOOPS_SALT !== $xoops_config->xoops_salt)
349                        echo 'ERROR ';
350                else
351                        echo 'OK ';     
352                echo "<br />\n";
353        }
354
355        if (defined('XOOPS_DB_SALT')){
356                echo 'XOOPS_DB_SALT:  ' ;
357                if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
358                        echo 'ERROR ';
359                else
360                        echo 'OK ';     
361                echo "<br />\n";
362        }
363
364        echo 'XOOPS_DB_HOST:  ' ;
365        if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
366                echo 'ERROR ';
367        else
368                echo 'OK ';     
369        echo "<br />\n";
370
371        echo 'XOOPS_DB_USER:  ' ;
372        if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
373                echo 'ERROR ';
374        else
375                echo 'OK ';     
376        echo "<br />\n";
377
378        echo 'XOOPS_DB_PASS:  ' ;
379        if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
380                echo 'ERROR ';
381        else
382                echo 'OK ';     
383        echo "<br />\n";
384
385        echo 'XOOPS_DB_NAME:  ' ;
386        if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
387                echo 'ERROR ';
388        else
389                echo 'OK ';     
390        echo "<br />\n";
391
392        echo 'XOOPS_DB_PREFIX:  ' ;
393        if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
394                echo 'ERROR ';
395        else
396                echo 'OK ';     
397        echo "<br />\n";
398}
399
400function xpress_config_nomal_view()
401{
402        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
403        $xoops_config = new ConfigFromXoops;
404       
405        echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
406        echo '<tbody>';
407        echo '<tr>';
408        echo '<td>Define item</td>';
409        echo '<td>XOOPS setting value</td>';
410        echo '<td>xoops_config get value</td>';
411        echo '</tr>';
412        echo '<tr>';
413        if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
414                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_ROOT_PATH</span></strong></td>';
415        else
416                echo '<td>XOOPS_ROOT_PATH</td>';       
417        echo '<td>' . XOOPS_ROOT_PATH . '</td>';
418        echo '<td>' . $xoops_config->xoops_root_path . '</td>';
419        echo '</tr>';
420
421        echo '<tr>';
422        if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
423                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_TRUST_PATH</span></strong></td>';
424        else
425                echo '<td>XOOPS_TRUST_PATH</td>';       
426        echo '<td>' . XOOPS_TRUST_PATH . '</td>';
427        echo '<td>' . $xoops_config->xoops_trust_path . '</td>';
428        echo '</tr>';
429
430        echo '<tr>';
431        if(XOOPS_URL !== $xoops_config->xoops_url)
432                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_URL</span></strong></td>';
433        else
434                echo '<td>XOOPS_URL</td>';     
435        echo '<td>' . XOOPS_URL . '</td>';
436        echo '<td>' . $xoops_config->xoops_url . '</td>';
437        echo '</tr>';
438
439        if (defined('XOOPS_SALT')){
440                echo '<tr>';
441                if(XOOPS_SALT !== $xoops_config->xoops_salt)
442                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_SALT</span></strong></td>';
443                else
444                        echo '<td>XOOPS_SALT</td>';
445                echo '<td>' . XOOPS_SALT . '</td>';
446                echo '<td>' . $xoops_config->xoops_salt . '</td>';
447                echo '</tr>';
448        }
449
450        if (defined('XOOPS_DB_SALT')){
451                echo '<tr>';
452                if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
453                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_SALT</span></strong></td>';
454                else
455                        echo '<td>XOOPS_DB_SALT</td>';
456                echo '<td>' . XOOPS_DB_SALT . '</td>';
457                echo '<td>' . $xoops_config->xoops_db_salt . '</td>';
458                echo '</tr>';
459        }
460
461        echo '<tr>';
462        if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
463                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_HOST</span></strong></td>';
464        else
465                echo '<td>XOOPS_DB_HOST</td>';
466        echo '<td>' . XOOPS_DB_HOST . '</td>';
467        echo '<td>' . $xoops_config->xoops_db_host . '</td>';
468        echo '</tr>';
469
470        echo '<tr>';
471        if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
472                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_USER</span></strong></td>';
473        else
474                echo '<td>XOOPS_DB_USER</td>';
475        echo '<td>' . XOOPS_DB_USER . '</td>';
476        echo '<td>' . $xoops_config->xoops_db_user . '</td>';
477        echo '</tr>';
478
479        echo '<tr>';
480        if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
481                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PASS</span></strong></td>';
482        else
483                echo '<td>XOOPS_DB_PASS</td>';
484        echo '<td>' . XOOPS_DB_PASS . '</td>';
485        echo '<td>' . $xoops_config->xoops_db_pass . '</td>';
486        echo '</tr>';
487
488        echo '<tr>';
489        if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
490                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_NAME</span></strong></td>';
491        else
492                echo '<td>XOOPS_DB_NAME</td>';
493        echo '<td>' . XOOPS_DB_NAME . '</td>';
494        echo '<td>' . $xoops_config->xoops_db_name . '</td>';
495        echo '</tr>';
496
497        echo '<tr>';
498        if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
499                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PREFIX</span></strong></td>';
500        else
501                echo '<td>XOOPS_DB_PREFIX</td>';
502        echo '<td>' . XOOPS_DB_PREFIX . '</td>';
503        echo '<td>' . $xoops_config->xoops_db_prefix . '</td>';
504        echo '</tr>';
505        echo '</tbody>';
506        echo '</table>';
507}
508function xpress_config_from_xoops_view($is_report = false)
509{
510        global $xoopsUserIsAdmin,$xoopsUser;
511
512        $user_groups = $xoopsUser->_groups;
513        $is_admin_group = in_array('1',$user_groups);
514       
515        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
516        $xoops_config = new ConfigFromXoops;
517        if ($is_report) {
518                echo "******** "  . _AM_XP2_XOOPS_CONFIG_INFO . "********" . "<br />\n";
519                xpress_config_report_view();
520                echo "<br />\n";
521        } else {
522                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_XOOPS_CONFIG_INFO . "</legend>";
523                echo "<div style='padding: 8px;'>";
524                if ($xoopsUserIsAdmin && $is_admin_group){
525                        xpress_config_nomal_view();
526                } else {
527                        xpress_config_report_view();
528                }
529                echo "</div>";
530                echo '</legend>';
531                echo "</fieldset><br />";
532        }
533}
534
535function xpress_state($is_report = false)
536{
537        global $xoopsModule;
538        include(dirname(__FILE__) . '/../wp-includes/version.php');
539        include_once(dirname(__FILE__) . '/../include/general_functions.php');
540
541        $xoopsDB =& Database::getInstance();
542       
543        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
544        if ($xp_prefix == 'wordpress'){
545                $xp_prefix = 'wp';
546        }
547
548        $prefix = $xoopsDB->prefix($xp_prefix . '_');
549       
550        $posts_tables = get_table_list($prefix,'posts');
551        $blogname = array();
552        $count_article = array();
553        $count_author = array();
554        $count_category = array();
555        $array_index = 0;
556        foreach( $posts_tables as $posts_table){
557                $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')";
558                $result = $xoopsDB->query($sql);
559                if($myrow = $xoopsDB->fetchArray($result)){
560                        $count_article[$array_index] = $myrow["count_article"];
561                        $count_author[$array_index] = $myrow["count_author"];
562                } else {
563                        $count_article[$array_index] = 0;
564                        $count_author[$array_index] = 0;
565                }
566                $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table);
567               
568                $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'";
569                $result = $xoopsDB->query($sql);
570                if($myrow = $xoopsDB->fetchArray($result)){
571                        $blogname[$array_index] = $myrow["blogname"];
572                } else {
573                        $blogname[$array_index] = 'none name';
574                }
575               
576                if ($wp_db_version < 6124){
577                       
578                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories";
579                } else {
580                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'";
581                }
582                $result = $xoopsDB->query($sql);
583                if($myrow = $xoopsDB->fetchArray($result)){
584                        $count_category[$array_index] = $myrow["count_category"];
585                } else {
586                        $count_category[$array_index] = 0;
587                }
588                $array_index++;
589        }
590        for ($i = 0 ; $i < $array_index ; $i++){
591                if ($is_report){
592                        echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "<br />\n";
593                        echo _AM_XP2_CATEGORIES .":  ".@$count_category[$i]. "<br />\n";
594                        echo _AM_XP2_ARTICLES .":  ". $count_article[$i]. "<br />\n";
595                        echo _AM_XP2_AUTHORS .":  ". $count_author[$i]. "<br />\n";
596                       
597                } else {
598                        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . $blogname[$i] . _AM_XP2_STATS . "</legend>";
599                        echo "<div style='padding: 8px;'>";
600                        echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category[$i];
601                        echo "</text><br />";
602                        echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article[$i];
603                        echo "</text><br />";
604                        echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author[$i];
605                        echo "</text>";
606                        echo "</div>";
607                        echo '</legend>';
608                        echo "</fieldset>";
609                }
610        }
611}
612function xpress_block_state($is_report = false)
613{
614        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
615
616        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
617        $xoops_block_check =& xoops_block_check::getInstance();
618        $xoops_block_check->check_blocks($mydirname);
619        if ($is_report){
620                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
621                echo $xoops_block_check->get_message();
622                echo "<br />\n";
623                echo "<br />\n";
624        } else {
625                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_STATS . "</legend>";
626                echo "<div style='padding: 8px;'>";
627                echo $xoops_block_check->get_message();
628                echo "</div>";
629                echo '</legend>';
630                echo "</fieldset><br />";
631        }               
632}
633
634function xpress_block_options($is_report = false)
635{
636        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
637
638        $module_objs = & get_module_objects($mydirname);
639        $module_obj = $module_objs[0];
640        $mod_id = $module_obj->getVar('mid', 'n');
641        $blocks = & get_block_object_orber_num_bymodule_id( $mod_id );
642        $infos    =& $module_obj->getInfo('blocks');
643        if ($is_report){
644                echo "******** " . _AM_XP2_BLOCK_OPTIONS . "********" . "<br />\n";
645                foreach ( $blocks as $block )
646                {
647                        echo $block->getVar('title') . ' : ' . $block->getVar('options') . '<br />';
648                }
649                echo "<br />\n";
650        } else {
651                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_OPTIONS . "</legend>";
652                echo "<div style='padding: 8px;'>";
653                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
654                echo '<tbody>';
655                echo '<tr>';
656                echo '<td>Title</td>';
657                echo '<td>Options</td>';
658                echo '</tr>';
659                foreach ( $blocks as $block )
660                {
661                        echo '<tr>';
662                        echo '<td>' . $block->getVar('title') . '</td>';
663                        echo '<td>' . $block->getVar('options') . '</td>';
664                        echo '</tr>';
665                }
666                echo '</tbody>';
667                echo '</table>';
668                echo '</div>';
669                echo '</legend>';
670                echo "</fieldset><br />";
671        }
672
673}
674//--------------------------------------------------------
675// module handler
676//--------------------------------------------------------
677function &get_module_objects($module_dir)
678{
679        $criteria = new CriteriaCompo();
680        $criteria->add( new Criteria('isactive', '1', '=') );
681        $criteria->add( new Criteria('dirname', $module_dir, '=') );
682
683        $module_handler =& xoops_gethandler('module');
684        $objs           =& $module_handler->getObjects( $criteria );
685        return $objs;
686}
687
688//--------------------------------------------------------
689// block handler
690//--------------------------------------------------------
691function &get_block_object_orber_num_bymodule_id( $mid )
692{
693        $arr  = array();
694        $objs =& get_block_object_bymodule_id( $mid );
695        foreach ( $objs as $obj )
696        {
697                $arr[ $obj->getVar('func_num', 'n') ] = $obj;
698        }
699        return $arr;
700}
701
702function &get_block_object_bymodule_id( $mid, $asobject=true )
703{
704        if ( defined('ICMS_VERSION_BUILD') && ICMS_VERSION_BUILD > 27  ) { /* ImpressCMS 1.2+ */
705                $block_handler =& xoops_gethandler ('block');
706                $objs =& $block_handler->getByModule( $mid, $asobject );
707        } else { /* legacy support */
708                $objs =& XoopsBlock::getByModule( $mid, $asobject ) ; /* from class/xoopsblock.php */
709        }
710        return $objs;
711}
712
713
714
715$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
716$mydirpath = dirname( dirname( __FILE__ ) ) ;
717//require_once($mydirpath.'/wp-config.php');
718       
719require_once '../../../include/cp_header.php' ;
720//require_once '../include/gtickets.php' ;
721//define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ;
722
723// branch for altsys
724if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) {
725
726        // common libs (eg. altsys)
727        $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
728        $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
729       
730        if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
731                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
732        } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
733                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
734        } else {
735                die( 'wrong request' ) ;
736        }
737        exit ;
738}
739
740// beggining of Output
741xoops_cp_header();
742include( './mymenu.php' ) ;
743
744echo "
745        <style type=\"text/css\">
746        label,text {
747                display: block;
748                float: left;
749                margin-bottom: 2px;
750        }
751        label {
752                text-align: right;
753                width: 200px;
754                padding-right: 20px;
755        }
756        br {
757                clear: left;
758        }
759        </style>
760";
761
762if (!empty($_POST['submit_report'])) $report = true; else $report = false;
763xpress_sys_info($report);
764xpress_config_from_xoops_view($report);
765xpress_active_plugin_list($report);
766xpress_block_state($report);
767xpress_block_options($report);
768admin_check_user_meta_prefix($report);
769xpress_state($report);
770echo '<form method="POST">'."\n";
771echo '<input type="submit" name="submit_report" value="' . _AM_XP2_SYS_REPORT .' " />'.'&emsp;';
772echo '<input type="submit" name="submit_normal" value="' . _AM_XP2_SYS_NORMAL .' " />'."<br />\n";
773echo "</form>\n";
774
775xoops_cp_footer();
776
777       
778?>
Note: See TracBrowser for help on using the repository browser.