XPressME Integration Kit

Trac

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

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

xoops_mod_wordpress060_alphaの複製モジュールからのアップデート対応 fixes#335

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