XPressME Integration Kit

Trac

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

Last change on this file since 736 was 736, checked in by toemon, 13 years ago

ImpressCMS1.3よりメンバー変数$_groupsがプライベート指定になった為

File size: 29.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 = preg_replace('/wordpress/','wp',$mydirname);
39        $db_prefix = $xoopsDB->prefix($wp_prefix_only);
40
41        $usermeta_tbl = $db_prefix . '_usermeta';       
42        $meta_key_pattern = '_' . $wp_prefix_only . '_';
43
44        $sql = "SELECT count(umeta_id) as data_count ,meta_key FROM $usermeta_tbl GROUP BY meta_key HAVING meta_key LIKE '%" . $meta_key_pattern ."%'" ;
45        $res =  $xoopsDB->query($sql, 0, 0);
46       
47        if ($res === false){
48                $check_str = _AM_XP2_USER_META_NONE . "<br />\n";
49        } else {
50                $error =false;
51                $check_str = '';
52                while($row = $xoopsDB->fetchArray($res)){
53                        $data_count  = $row['data_count'];
54                        $meta_key = $row['meta_key'];
55                        if ( !preg_match('/^'.$db_prefix. '_.*/',$meta_key , $maches)){
56                                $check_str .= sprintf(_AM_XP2_USER_META_ERR , $meta_key,$data_count) ."<br /> \n";
57                                $error = true;
58                        }
59                }
60                if (!$error)
61                        $check_str = _AM_XP2_USER_META_OK ;
62        }
63        if ($is_report) {
64                echo "******** "  . _AM_XP2_USER_META_KEY . "********" . "<br />\n";
65                echo $check_str . "<br />\n<br />\n";
66        } else {
67                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_USER_META_KEY . "</legend>";
68                echo "<div style='padding: 8px;'>";
69                echo $check_str;
70                echo "</div>";
71                echo '</legend>';
72                echo "</fieldset><br />";
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 = preg_replace('/wordpress/','wp',$mydirname);
122        $wp_prefix = $xoopsDB->prefix($prefix);
123
124        $option_table = $wp_prefix . '_options';
125       
126        $sql = "SELECT option_value FROM $option_table WHERE option_name = 'active_plugins'";
127        $res =  $xoopsDB->query($sql, 0, 0);
128        if ($res === false){
129            return ;
130        } else {
131                $row = $xoopsDB->fetchArray($res);
132                $active_plugins = @unserialize($row['option_value']);
133                $output = '';
134                foreach($active_plugins as $active_plugin_path){
135                        $file_name =  $my_dirpath . '/wp-content/plugins/' . $active_plugin_path;
136                        $active_plugin = get_xpress_plugin_data($file_name);
137                        $output .= $before_str . $active_plugin['Name'] . ':   Version ' . $active_plugin['Version'] . ':  (' .$active_plugin['PluginURI'] . ')<br />';
138                }
139               
140               
141                return $output;
142        }
143
144       
145}
146
147function xpress_active_plugin_list($is_report = false)
148{
149        if ($is_report) {
150                echo "******** "  . _AM_XP2_PLUGIN . "********" . "<br />\n";
151                echo get_xpress_active_plugin_list('') . "<br />\n";
152        } else {
153                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_PLUGIN . "</legend>";
154                echo "<div style='padding: 8px;'>";
155                echo get_xpress_active_plugin_list();
156                echo "</div>";
157                echo '</legend>';
158                echo "</fieldset><br />";
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__ )).'/include/memory_limit.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 "allow_url_fopen:   " ;
188                echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF" ;
189                echo "<br />\n";
190                echo "magic_quotes_gpc:   " ;
191                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
192                echo "<br />\n";
193                echo "XML extension:   " ;
194                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
195                echo "<br />\n";
196                echo "default memory_limit:   " ;
197                echo  ini_get( 'memory_limit' );
198                echo "<br />\n";
199                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>allow_url_fopen:</label><text>";
264                echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF";
265                echo "</text><br />";
266                echo "<label>magic_quotes_gpc:</label><text>";
267                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
268                echo "</text><br />";
269                echo "<label>XML extension:</label><text>";
270                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
271                echo "</text><br />";
272                echo "<label>default memory_limit:</label><text>";
273                echo  ini_get( 'memory_limit' );
274                echo "</text><br />";
275                xpress_set_memory_limmit();
276                echo "<label>change memory_limit:</label><text>";
277                echo  ini_get( 'memory_limit' );
278                echo "</text><br />";
279
280                echo "<label>post_max_size:</label><text>";
281                echo  ini_get( 'post_max_size' );
282                echo "</text><br />";
283                echo "<label>upload_max_filesize:</label><text>";
284                echo  ini_get( 'upload_max_filesize' );
285                echo "</text><br />";
286                echo "<label>display_errors:</label><text>";
287                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
288                echo "</text><br />";
289                echo "<label>MB extension:</label><text>";
290                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
291                echo "</text><br />";
292                echo "<label>mbstring.language:</label><text>";
293                echo  ini_get( 'mbstring.language' );
294                echo "</text><br />";
295                echo "<label>mbstring.encoding_translation:</label><text>";
296                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
297                echo "</text><br />";
298                echo "<label>mbstring.internal_encoding:</label><text>";
299                echo  ini_get( 'mbstring.internal_encoding' );
300                echo "</text><br />";
301                echo "<label>mbstring.http_input:</label><text>";
302                echo  ini_get( 'mbstring.http_input' );
303                echo "</text><br />";
304                echo "<label>mbstring.http_output:</label><text>";
305                echo  ini_get( 'mbstring.http_output' );
306                echo "</text><br />";
307                echo "<label>mbstring.detect_order:</label><text>";
308                echo  ini_get( 'mbstring.detect_order' );
309                echo "</text><br />";
310                echo "<label>mbstring.substitute_character:</label><text>";
311                echo  ini_get( 'mbstring.substitute_character' );
312                echo "</text><br />";
313                echo "<label>mbstring.func_overload:</label><text>";
314                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
315                echo "</text><br />";
316                echo "</div>";
317                echo '</legend>';
318                echo "</fieldset><br />";
319        }
320}
321
322
323function xpress_config_report_view()
324{
325        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
326        $xoops_config = new ConfigFromXoops;
327        echo 'XOOPS_ROOT_PATH:  ' ;
328        if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
329                echo 'ERROR ';
330        else
331                echo 'OK ';     
332        echo "<br />\n";
333
334        echo 'XOOPS_TRUST_PATH:  ' ;
335        if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
336                echo 'ERROR ';
337        else
338                echo 'OK ';     
339        echo "<br />\n";
340
341        echo 'XOOPS_URL:  ' ;
342        if(XOOPS_URL !== $xoops_config->xoops_url)
343                echo 'ERROR ';
344        else
345                echo 'OK ';     
346        echo "<br />\n";
347
348        if (defined('XOOPS_SALT')){
349                echo 'XOOPS_SALT:  ' ;
350                if(XOOPS_SALT !== $xoops_config->xoops_salt)
351                        echo 'ERROR ';
352                else
353                        echo 'OK ';     
354                echo "<br />\n";
355        }
356
357        if (defined('XOOPS_DB_SALT')){
358                echo 'XOOPS_DB_SALT:  ' ;
359                if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
360                        echo 'ERROR ';
361                else
362                        echo 'OK ';     
363                echo "<br />\n";
364        }
365
366        echo 'XOOPS_DB_HOST:  ' ;
367        if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
368                echo 'ERROR ';
369        else
370                echo 'OK ';     
371        echo "<br />\n";
372
373        echo 'XOOPS_DB_USER:  ' ;
374        if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
375                echo 'ERROR ';
376        else
377                echo 'OK ';     
378        echo "<br />\n";
379
380        echo 'XOOPS_DB_PASS:  ' ;
381        if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
382                echo 'ERROR ';
383        else
384                echo 'OK ';     
385        echo "<br />\n";
386
387        echo 'XOOPS_DB_NAME:  ' ;
388        if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
389                echo 'ERROR ';
390        else
391                echo 'OK ';     
392        echo "<br />\n";
393
394        echo 'XOOPS_DB_PREFIX:  ' ;
395        if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
396                echo 'ERROR ';
397        else
398                echo 'OK ';     
399        echo "<br />\n";
400}
401
402function xpress_config_nomal_view()
403{
404        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
405        $xoops_config = new ConfigFromXoops;
406       
407        echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
408        echo '<tbody>';
409        echo '<tr>';
410        echo '<td>Define item</td>';
411        echo '<td>XOOPS setting value</td>';
412        echo '<td>xoops_config get value</td>';
413        echo '</tr>';
414        echo '<tr>';
415        if(XOOPS_ROOT_PATH !== $xoops_config->xoops_root_path)
416                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_ROOT_PATH</span></strong></td>';
417        else
418                echo '<td>XOOPS_ROOT_PATH</td>';       
419        echo '<td>' . XOOPS_ROOT_PATH . '</td>';
420        echo '<td>' . $xoops_config->xoops_root_path . '</td>';
421        echo '</tr>';
422
423        echo '<tr>';
424        if(XOOPS_TRUST_PATH !== $xoops_config->xoops_trust_path)
425                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_TRUST_PATH</span></strong></td>';
426        else
427                echo '<td>XOOPS_TRUST_PATH</td>';       
428        echo '<td>' . XOOPS_TRUST_PATH . '</td>';
429        echo '<td>' . $xoops_config->xoops_trust_path . '</td>';
430        echo '</tr>';
431
432        echo '<tr>';
433        if(XOOPS_URL !== $xoops_config->xoops_url)
434                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_URL</span></strong></td>';
435        else
436                echo '<td>XOOPS_URL</td>';     
437        echo '<td>' . XOOPS_URL . '</td>';
438        echo '<td>' . $xoops_config->xoops_url . '</td>';
439        echo '</tr>';
440
441        if (defined('XOOPS_SALT')){
442                echo '<tr>';
443                if(XOOPS_SALT !== $xoops_config->xoops_salt)
444                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_SALT</span></strong></td>';
445                else
446                        echo '<td>XOOPS_SALT</td>';
447                echo '<td>' . XOOPS_SALT . '</td>';
448                echo '<td>' . $xoops_config->xoops_salt . '</td>';
449                echo '</tr>';
450        }
451
452        if (defined('XOOPS_DB_SALT')){
453                echo '<tr>';
454                if(XOOPS_DB_SALT !== $xoops_config->xoops_db_salt)
455                        echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_SALT</span></strong></td>';
456                else
457                        echo '<td>XOOPS_DB_SALT</td>';
458                echo '<td>' . XOOPS_DB_SALT . '</td>';
459                echo '<td>' . $xoops_config->xoops_db_salt . '</td>';
460                echo '</tr>';
461        }
462
463        echo '<tr>';
464        if(XOOPS_DB_HOST !== $xoops_config->xoops_db_host)
465                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_HOST</span></strong></td>';
466        else
467                echo '<td>XOOPS_DB_HOST</td>';
468        echo '<td>' . XOOPS_DB_HOST . '</td>';
469        echo '<td>' . $xoops_config->xoops_db_host . '</td>';
470        echo '</tr>';
471
472        echo '<tr>';
473        if(XOOPS_DB_USER !== $xoops_config->xoops_db_user)
474                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_USER</span></strong></td>';
475        else
476                echo '<td>XOOPS_DB_USER</td>';
477        echo '<td>' . XOOPS_DB_USER . '</td>';
478        echo '<td>' . $xoops_config->xoops_db_user . '</td>';
479        echo '</tr>';
480
481        echo '<tr>';
482        if(XOOPS_DB_PASS !== $xoops_config->xoops_db_pass)
483                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PASS</span></strong></td>';
484        else
485                echo '<td>XOOPS_DB_PASS</td>';
486        echo '<td>' . XOOPS_DB_PASS . '</td>';
487        echo '<td>' . $xoops_config->xoops_db_pass . '</td>';
488        echo '</tr>';
489
490        echo '<tr>';
491        if(XOOPS_DB_NAME !== $xoops_config->xoops_db_name)
492                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_NAME</span></strong></td>';
493        else
494                echo '<td>XOOPS_DB_NAME</td>';
495        echo '<td>' . XOOPS_DB_NAME . '</td>';
496        echo '<td>' . $xoops_config->xoops_db_name . '</td>';
497        echo '</tr>';
498
499        echo '<tr>';
500        if(XOOPS_DB_PREFIX !== $xoops_config->xoops_db_prefix)
501                echo '<td><strong><span style="color: rgb(255, 0, 0);">XOOPS_DB_PREFIX</span></strong></td>';
502        else
503                echo '<td>XOOPS_DB_PREFIX</td>';
504        echo '<td>' . XOOPS_DB_PREFIX . '</td>';
505        echo '<td>' . $xoops_config->xoops_db_prefix . '</td>';
506        echo '</tr>';
507        echo '</tbody>';
508        echo '</table>';
509}
510function xpress_config_from_xoops_view($is_report = false)
511{
512        global $xoopsUserIsAdmin,$xoopsUser;
513
514        $user_groups = $xoopsUser->getGroups();
515        $is_admin_group = in_array('1',$user_groups);
516       
517        require_once dirname(dirname( __FILE__ )).'/class/config_from_xoops.class.php' ;
518        $xoops_config = new ConfigFromXoops;
519        if ($is_report) {
520                echo "******** "  . _AM_XP2_XOOPS_CONFIG_INFO . "********" . "<br />\n";
521                xpress_config_report_view();
522                echo "<br />\n";
523        } else {
524                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_XOOPS_CONFIG_INFO . "</legend>";
525                echo "<div style='padding: 8px;'>";
526                if ($xoopsUserIsAdmin && $is_admin_group){
527                        xpress_config_nomal_view();
528                } else {
529                        xpress_config_report_view();
530                }
531                echo "</div>";
532                echo '</legend>';
533                echo "</fieldset><br />";
534        }
535}
536
537function xpress_state($is_report = false)
538{
539        global $xoopsModule;
540        include(dirname(__FILE__) . '/../wp-includes/version.php');
541        include_once(dirname(__FILE__) . '/../include/general_functions.php');
542
543        $xoopsDB =& Database::getInstance();
544       
545        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
546        $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
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}
612
613function xpress_group_role_state($is_report = false)
614{
615        global $xoopsModule;
616        $xoopsDB =& Database::getInstance();
617        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
618        $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
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.