XPressME Integration Kit

Trac

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

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

mySQL接続上限警告 対策 Fixes#315

File size: 28.9 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__ )).'/include/memory_limit.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                xpress_set_memory_limmit();
199                echo "change memory_limit:   " ;
200                echo  ini_get( 'memory_limit' );
201                echo "<br />\n";
202               
203                echo "post_max_size:   " ;
204                echo  ini_get( 'post_max_size' );
205                echo "<br />\n";
206                echo "upload_max_filesize:   " ;
207                echo  ini_get( 'upload_max_filesize' );
208                echo "<br />\n";
209                echo "display_errors:   " ;
210                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
211                echo "<br />\n";
212                echo "MB extension:   " ;
213                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
214                echo "<br />\n";
215                echo "mbstring.language:   " ;
216                echo  ini_get( 'mbstring.language' );
217                echo "<br />\n";
218                echo "mbstring.encoding_translation:   " ;
219                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
220                echo "<br />\n";
221                echo "mbstring.internal_encoding:   " ;
222                echo  ini_get( 'mbstring.internal_encoding' );
223                echo "<br />\n";
224                echo "mbstring.http_input:   " ;
225                echo  ini_get( 'mbstring.http_input' );
226                echo "<br />\n";
227                echo "mbstring.http_output:   " ;
228                echo  ini_get( 'mbstring.http_output' );
229                echo "<br />\n";
230                echo "mbstring.detect_order:   " ;
231                echo  ini_get( 'mbstring.detect_order' );
232                echo "<br />\n";
233                echo "mbstring.substitute_character:   " ;
234                echo  ini_get( 'mbstring.substitute_character' );
235                echo "<br />\n";
236                echo "mbstring.func_overload:   " ;
237                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
238                echo "<br />\n";
239                echo "<br />\n";
240        } else {
241                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_SYSTEM_INFO . "</legend>";
242                echo "<div style='padding: 8px;'>";
243                echo "<label>" . "<strong>SERVER:</strong>" . ":</label><text>" . $_SERVER['SERVER_SOFTWARE'] . "</text><br />";
244                echo "<label>" . "<strong>PHP Version:</strong>" . ":</label><text>" . phpversion() . "</text><br />";
245                echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
246                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
247                echo "</text><br />";
248                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
249                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
250                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
251                echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
252                echo "<label>" . "<strong>WP DB Version:</strong>" . ":</label><text>" . $wp_db_version . "</text><br />";
253
254                echo "</div>";
255                echo "<div style='padding: 8px;'>";
256                echo "<label>safemode:</label><text>";
257                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
258                echo "</text><br />";
259                echo "<label>register_globals:</label><text>";
260                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
261                echo "</text><br />";
262                echo "<label>magic_quotes_gpc:</label><text>";
263                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
264                echo "</text><br />";
265                echo "<label>XML extension:</label><text>";
266                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
267                echo "</text><br />";
268                echo "<label>default memory_limit:</label><text>";
269                echo  ini_get( 'memory_limit' );
270                echo "</text><br />";
271                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 '</legend>';
314                echo "</fieldset><br />";
315        }
316}
317
318
319function xpress_config_report_view()
320{
321        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
322        $xoops_config = new ConfigFromXoops;
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}
397
398function xpress_config_nomal_view()
399{
400        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
401        $xoops_config = new ConfigFromXoops;
402       
403        echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
404        echo '<tbody>';
405        echo '<tr>';
406        echo '<td>Define item</td>';
407        echo '<td>XOOPS setting value</td>';
408        echo '<td>xoops_config get value</td>';
409        echo '</tr>';
410        echo '<tr>';
411        if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
412                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_ROOT_PATH</span></strong></td>';
413        else
414                echo '<td>XOOPS_ROOT_PATH</td>';       
415        echo '<td>' . XOOPS_ROOT_PATH . '</td>';
416        echo '<td>' . $xoops_config->xoops_root_path . '</td>';
417        echo '</tr>';
418
419        echo '<tr>';
420        if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
421                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_TRUST_PATH</span></strong></td>';
422        else
423                echo '<td>XOOPS_TRUST_PATH</td>';       
424        echo '<td>' . XOOPS_TRUST_PATH . '</td>';
425        echo '<td>' . $xoops_config->xoops_trust_path . '</td>';
426        echo '</tr>';
427
428        echo '<tr>';
429        if(XOOPS_URL !== $xoops_config->xoops_url)
430                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_URL</span></strong></td>';
431        else
432                echo '<td>XOOPS_URL</td>';     
433        echo '<td>' . XOOPS_URL . '</td>';
434        echo '<td>' . $xoops_config->xoops_url . '</td>';
435        echo '</tr>';
436
437        if (defined('XOOPS_SALT')){
438                echo '<tr>';
439                if(XOOPS_SALT !== $xoops_config->xoops_salt)
440                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_SALT</span></strong></td>';
441                else
442                        echo '<td>XOOPS_SALT</td>';
443                echo '<td>' . XOOPS_SALT . '</td>';
444                echo '<td>' . $xoops_config->xoops_salt . '</td>';
445                echo '</tr>';
446        }
447
448        if (defined('XOOPS_DB_SALT')){
449                echo '<tr>';
450                if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
451                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_SALT</span></strong></td>';
452                else
453                        echo '<td>XOOPS_DB_SALT</td>';
454                echo '<td>' . XOOPS_DB_SALT . '</td>';
455                echo '<td>' . $xoops_config->xoops_db_salt . '</td>';
456                echo '</tr>';
457        }
458
459        echo '<tr>';
460        if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
461                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_HOST</span></strong></td>';
462        else
463                echo '<td>XOOPS_DB_HOST</td>';
464        echo '<td>' . XOOPS_DB_HOST . '</td>';
465        echo '<td>' . $xoops_config->xoops_db_host . '</td>';
466        echo '</tr>';
467
468        echo '<tr>';
469        if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
470                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_USER</span></strong></td>';
471        else
472                echo '<td>XOOPS_DB_USER</td>';
473        echo '<td>' . XOOPS_DB_USER . '</td>';
474        echo '<td>' . $xoops_config->xoops_db_user . '</td>';
475        echo '</tr>';
476
477        echo '<tr>';
478        if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
479                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PASS</span></strong></td>';
480        else
481                echo '<td>XOOPS_DB_PASS</td>';
482        echo '<td>' . XOOPS_DB_PASS . '</td>';
483        echo '<td>' . $xoops_config->xoops_db_pass . '</td>';
484        echo '</tr>';
485
486        echo '<tr>';
487        if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
488                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_NAME</span></strong></td>';
489        else
490                echo '<td>XOOPS_DB_NAME</td>';
491        echo '<td>' . XOOPS_DB_NAME . '</td>';
492        echo '<td>' . $xoops_config->xoops_db_name . '</td>';
493        echo '</tr>';
494
495        echo '<tr>';
496        if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
497                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PREFIX</span></strong></td>';
498        else
499                echo '<td>XOOPS_DB_PREFIX</td>';
500        echo '<td>' . XOOPS_DB_PREFIX . '</td>';
501        echo '<td>' . $xoops_config->xoops_db_prefix . '</td>';
502        echo '</tr>';
503        echo '</tbody>';
504        echo '</table>';
505}
506function xpress_config_from_xoops_view($is_report = false)
507{
508        global $xoopsUserIsAdmin,$xoopsUser;
509
510        $user_groups = $xoopsUser->_groups;
511        $is_admin_group = in_array('1',$user_groups);
512       
513        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
514        $xoops_config = new ConfigFromXoops;
515        if ($is_report) {
516                echo "******** "  . _AM_XP2_XOOPS_CONFIG_INFO . "********" . "<br />\n";
517                xpress_config_report_view();
518                echo "<br />\n";
519        } else {
520                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_XOOPS_CONFIG_INFO . "</legend>";
521                echo "<div style='padding: 8px;'>";
522                if ($xoopsUserIsAdmin && $is_admin_group){
523                        xpress_config_nomal_view();
524                } else {
525                        xpress_config_report_view();
526                }
527                echo "</div>";
528                echo '</legend>';
529                echo "</fieldset><br />";
530        }
531}
532
533function xpress_state($is_report = false)
534{
535        global $xoopsModule;
536        include(dirname(__FILE__) . '/../wp-includes/version.php');
537        include_once(dirname(__FILE__) . '/../include/general_functions.php');
538
539        $xoopsDB =& Database::getInstance();
540       
541        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
542        if ($xp_prefix == 'wordpress'){
543                $xp_prefix = 'wp';
544        }
545
546        $prefix = $xoopsDB->prefix($xp_prefix . '_');
547       
548        $posts_tables = get_table_list($prefix,'posts');
549        $blogname = array();
550        $count_article = array();
551        $count_author = array();
552        $count_category = array();
553        $array_index = 0;
554        foreach( $posts_tables as $posts_table){
555                $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')";
556                $result = $xoopsDB->query($sql);
557                if($myrow = $xoopsDB->fetchArray($result)){
558                        $count_article[$array_index] = $myrow["count_article"];
559                        $count_author[$array_index] = $myrow["count_author"];
560                } else {
561                        $count_article[$array_index] = 0;
562                        $count_author[$array_index] = 0;
563                }
564                $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table);
565               
566                $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'";
567                $result = $xoopsDB->query($sql);
568                if($myrow = $xoopsDB->fetchArray($result)){
569                        $blogname[$array_index] = $myrow["blogname"];
570                } else {
571                        $blogname[$array_index] = 'none name';
572                }
573               
574                if ($wp_db_version < 6124){
575                       
576                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories";
577                } else {
578                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'";
579                }
580                $result = $xoopsDB->query($sql);
581                if($myrow = $xoopsDB->fetchArray($result)){
582                        $count_category[$array_index] = $myrow["count_category"];
583                } else {
584                        $count_category[$array_index] = 0;
585                }
586                $array_index++;
587        }
588        for ($i = 0 ; $i < $array_index ; $i++){
589                if ($is_report){
590                        echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "<br />\n";
591                        echo _AM_XP2_CATEGORIES .":  ".@$count_category[$i]. "<br />\n";
592                        echo _AM_XP2_ARTICLES .":  ". $count_article[$i]. "<br />\n";
593                        echo _AM_XP2_AUTHORS .":  ". $count_author[$i]. "<br />\n";
594                       
595                } else {
596                        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . $blogname[$i] . _AM_XP2_STATS . "</legend>";
597                        echo "<div style='padding: 8px;'>";
598                        echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category[$i];
599                        echo "</text><br />";
600                        echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article[$i];
601                        echo "</text><br />";
602                        echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author[$i];
603                        echo "</text>";
604                        echo "</div>";
605                        echo '</legend>';
606                        echo "</fieldset>";
607                }
608        }
609}
610
611function xpress_group_role_state($is_report = false)
612{
613        global $xoopsModule;
614        $xoopsDB =& Database::getInstance();
615        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
616        if ($xp_prefix == 'wordpress'){
617                $xp_prefix = 'wp';
618        }
619        $prefix = $xoopsDB->prefix($xp_prefix . '_');
620        $group_role_tables = $prefix.'group_role';
621        $sql = "SELECT groupid , name AS xoops_groupe ,group_type, role , login_all FROM ". $group_role_tables;
622        $result = $xoopsDB->query($sql);
623        if ($is_report){
624                echo "******** " . _AM_XP2_GROUP_ROLE . "********" . "<br />\n";
625        } else {
626                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_GROUP_ROLE . "</legend>";
627                echo "<div style='padding: 8px;'>";
628                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
629                echo '<tbody>';
630                echo '<tr>';
631                echo '<td>GROUP</td>';
632                echo '<td>GROUPE TYPE</td>';
633                echo '<td>ROLE</td>';
634                echo '<td>Allways Check</td>';
635                echo '</tr>';
636        }
637        $groupe_list = '';
638        while ($myrow = $xoopsDB->fetchArray($result)){
639                $xoops_groupe = $myrow["xoops_groupe"] ;
640                $group_type = empty($myrow["group_type"]) ? "None" : $myrow["group_type"] ;
641                $role = empty($myrow["role"]) ? "inhibit register" : $myrow["role"] ;
642                $login_all = empty($myrow["login_all"]) ? 'No' : 'Yes' ;
643                if (!empty($groupe_list)) $groupe_list .= ',';
644                $groupe_list .= $myrow["groupid"];
645                if ($is_report){
646                        echo $xoops_groupe . ' : ';
647                        echo '(' . $group_type. ') : ';
648                        echo $role;
649                        echo '(' . $login_all. ') : ';
650                        echo '<br />';
651                } else {
652                        echo '<tr>';
653                        echo '<td>' . $xoops_groupe . '</td>';
654                        echo '<td>' . $group_type . '</td>';
655                        echo '<td>' . $role . '</td>';
656                        echo '<td>' . $login_all . '</td>';
657                        echo '</tr>';
658                }
659        }
660        if ($is_report){
661                echo "<br />";
662        } else {
663                echo '</tbody>';
664                echo '</table>';
665                echo "</div>";
666                echo '</legend>';
667                echo "</fieldset><br />";
668        }
669}
670function xpress_block_state($is_report = false)
671{
672        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
673
674        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
675        $xoops_block_check =& xoops_block_check::getInstance();
676        $xoops_block_check->check_blocks($mydirname);
677        if ($is_report){
678                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
679                echo $xoops_block_check->get_message();
680                echo "<br />\n";
681                echo "<br />\n";
682        } else {
683                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_STATS . "</legend>";
684                echo "<div style='padding: 8px;'>";
685                echo $xoops_block_check->get_message();
686                echo "</div>";
687                echo '</legend>';
688                echo "</fieldset><br />";
689        }               
690}
691
692function xpress_block_options($is_report = false)
693{
694        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
695
696        $module_objs = & get_module_objects($mydirname);
697        $module_obj = $module_objs[0];
698        $mod_id = $module_obj->getVar('mid', 'n');
699        $blocks = & get_block_object_orber_num_bymodule_id( $mod_id );
700        $infos    =& $module_obj->getInfo('blocks');
701        if ($is_report){
702                echo "******** " . _AM_XP2_BLOCK_OPTIONS . "********" . "<br />\n";
703                foreach ( $blocks as $block )
704                {
705                        echo $block->getVar('title') . ' : ' . $block->getVar('options') . '<br />';
706                }
707                echo "<br />\n";
708        } else {
709                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_OPTIONS . "</legend>";
710                echo "<div style='padding: 8px;'>";
711                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
712                echo '<tbody>';
713                echo '<tr>';
714                echo '<td>Title</td>';
715                echo '<td>Options</td>';
716                echo '</tr>';
717                foreach ( $blocks as $block )
718                {
719                        echo '<tr>';
720                        echo '<td>' . $block->getVar('title') . '</td>';
721                        echo '<td>' . $block->getVar('options') . '</td>';
722                        echo '</tr>';
723                }
724                echo '</tbody>';
725                echo '</table>';
726                echo '</div>';
727                echo '</legend>';
728                echo "</fieldset><br />";
729        }
730
731}
732//--------------------------------------------------------
733// module handler
734//--------------------------------------------------------
735function &get_module_objects($module_dir)
736{
737        $criteria = new CriteriaCompo();
738        $criteria->add( new Criteria('isactive', '1', '=') );
739        $criteria->add( new Criteria('dirname', $module_dir, '=') );
740
741        $module_handler =& xoops_gethandler('module');
742        $objs           =& $module_handler->getObjects( $criteria );
743        return $objs;
744}
745
746//--------------------------------------------------------
747// block handler
748//--------------------------------------------------------
749function &get_block_object_orber_num_bymodule_id( $mid )
750{
751        $arr  = array();
752        $objs =& get_block_object_bymodule_id( $mid );
753        foreach ( $objs as $obj )
754        {
755                $arr[ $obj->getVar('func_num', 'n') ] = $obj;
756        }
757        return $arr;
758}
759
760function &get_block_object_bymodule_id( $mid, $asobject=true )
761{
762        if ( defined('ICMS_VERSION_BUILD') && ICMS_VERSION_BUILD > 27  ) { /* ImpressCMS 1.2+ */
763                $block_handler =& xoops_gethandler ('block');
764                $objs =& $block_handler->getByModule( $mid, $asobject );
765        } else { /* legacy support */
766                $objs =& XoopsBlock::getByModule( $mid, $asobject ) ; /* from class/xoopsblock.php */
767        }
768        return $objs;
769}
770
771
772
773$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
774$mydirpath = dirname( dirname( __FILE__ ) ) ;
775//require_once($mydirpath.'/wp-config.php');
776       
777require_once '../../../include/cp_header.php' ;
778//require_once '../include/gtickets.php' ;
779//define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ;
780
781// branch for altsys
782if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) {
783
784        // common libs (eg. altsys)
785        $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
786        $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
787       
788        if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
789                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
790        } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
791                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
792        } else {
793                die( 'wrong request' ) ;
794        }
795        exit ;
796}
797
798// beggining of Output
799xoops_cp_header();
800include( './mymenu.php' ) ;
801
802echo "
803        <style type=\"text/css\">
804        label,text {
805                display: block;
806                float: left;
807                margin-bottom: 2px;
808        }
809        label {
810                text-align: right;
811                width: 200px;
812                padding-right: 20px;
813        }
814        br {
815                clear: left;
816        }
817        </style>
818";
819
820if (!empty($_POST['submit_report'])) $report = true; else $report = false;
821xpress_sys_info($report);
822xpress_config_from_xoops_view($report);
823xpress_active_plugin_list($report);
824xpress_block_state($report);
825xpress_block_options($report);
826xpress_group_role_state($report);
827admin_check_user_meta_prefix($report);
828xpress_state($report);
829echo '<form method="POST">'."\n";
830echo '<input type="submit" name="submit_report" value="' . _AM_XP2_SYS_REPORT .' " />'.'&emsp;';
831echo '<input type="submit" name="submit_normal" value="' . _AM_XP2_SYS_NORMAL .' " />'."<br />\n";
832echo "</form>\n";
833
834xoops_cp_footer();
835
836       
837?>
Note: See TracBrowser for help on using the repository browser.