XPressME Integration Kit

Trac

source: branches/Ver3.0/xpressme_integration_kit/admin/index.php @ 757

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

ConfigFromXoopsクラスを廃止し、modInfoクラスを使用するように変更
WP2.2以下で使用するテンプレートold_templateの廃止

File size: 23.7 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,$xoopsDB;
34       
35        $mydirname = basename(dirname(dirname(__FILE__)));
36        $my_dirpath = dirname(dirname(__FILE__));
37        $wp_prefix_only = preg_replace('/wordpress/','wp',$mydirname);
38        $db_prefix = $xoopsDB->prefix($wp_prefix_only);
39
40        $usermeta_tbl = $db_prefix . '_usermeta';       
41        $meta_key_pattern = '_' . $wp_prefix_only . '_';
42
43        $sql = "SELECT count(umeta_id) as data_count ,meta_key FROM $usermeta_tbl GROUP BY meta_key HAVING meta_key LIKE '%" . $meta_key_pattern ."%'" ;
44        $res =  $xoopsDB->query($sql, 0, 0);
45       
46        if ($res === false){
47                $check_str = _AM_XP2_USER_META_NONE . "<br />\n";
48        } else {
49                $error =false;
50                $check_str = '';
51                while($row = $xoopsDB->fetchArray($res)){
52                        $data_count  = $row['data_count'];
53                        $meta_key = $row['meta_key'];
54                        if ( !preg_match('/^'.$db_prefix. '_.*/',$meta_key , $maches)){
55                                $check_str .= sprintf(_AM_XP2_USER_META_ERR , $meta_key,$data_count) ."<br /> \n";
56                                $error = true;
57                        }
58                }
59                if (!$error)
60                        $check_str = _AM_XP2_USER_META_OK ;
61        }
62        if ($is_report) {
63                echo "******** "  . _AM_XP2_USER_META_KEY . "********" . "<br />\n";
64                echo $check_str . "<br />\n<br />\n";
65        } else {
66                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_USER_META_KEY . "</legend>";
67                echo "<div style='padding: 8px;'>";
68                echo $check_str;
69                echo "</div>";
70                echo '</legend>';
71                echo "</fieldset><br />";
72        }
73
74}
75
76function get_xpress_plugin_data( $plugin_file, $markup = true, $translate = true ) {
77        // We don't need to write to the file, so just open for reading.
78        $fp = fopen($plugin_file, 'r');
79
80        // Pull only the first 8kiB of the file in.
81        $plugin_data = fread( $fp, 8192 );
82
83        // PHP will close file handle, but we are good citizens.
84        fclose($fp);
85
86        preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
87        preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
88        preg_match( '|Version:(.*)|i', $plugin_data, $version );
89        preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
90        preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
91        preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
92        preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
93        preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );
94
95        foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
96                if ( !empty( ${$field} ) )
97                        ${$field} = trim(${$field}[1]);
98                else
99                        ${$field} = '';
100        }
101
102        $plugin_data = array(
103                                'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description,
104                                'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version,
105                                'TextDomain' => $text_domain, 'DomainPath' => $domain_path
106                                );
107//      if ( $markup || $translate )
108//              $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
109        return $plugin_data;
110}
111
112
113function get_xpress_active_plugin_list($before_str = '')
114{
115        global $xoopsModule,$xoopsDB;
116       
117        $mydirname = basename(dirname(dirname(__FILE__)));
118        $my_dirpath = dirname(dirname(__FILE__));
119        $prefix = preg_replace('/wordpress/','wp',$mydirname);
120        $wp_prefix = $xoopsDB->prefix($prefix);
121
122        $option_table = $wp_prefix . '_options';
123       
124        $sql = "SELECT option_value FROM $option_table WHERE option_name = 'active_plugins'";
125        $res =  $xoopsDB->query($sql, 0, 0);
126        if ($res === false){
127            return ;
128        } else {
129                $row = $xoopsDB->fetchArray($res);
130                $active_plugins = @unserialize($row['option_value']);
131                $output = '';
132                foreach($active_plugins as $active_plugin_path){
133                        $file_name =  $my_dirpath . '/wp-content/plugins/' . $active_plugin_path;
134                        $active_plugin = get_xpress_plugin_data($file_name);
135                        $output .= $before_str . $active_plugin['Name'] . ':   Version ' . $active_plugin['Version'] . ':  (' .$active_plugin['PluginURI'] . ')<br />';
136                }
137               
138               
139                return $output;
140        }
141
142       
143}
144
145function xpress_active_plugin_list($is_report = false)
146{
147        if ($is_report) {
148                echo "******** "  . _AM_XP2_PLUGIN . "********" . "<br />\n";
149                echo get_xpress_active_plugin_list('') . "<br />\n";
150        } else {
151                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_PLUGIN . "</legend>";
152                echo "<div style='padding: 8px;'>";
153                echo get_xpress_active_plugin_list();
154                echo "</div>";
155                echo '</legend>';
156                echo "</fieldset><br />";
157        }
158}
159
160function xpress_sys_info($is_report = false)
161{
162        global $xoopsModule;
163        include(dirname(__FILE__) . '/../wp-includes/version.php');
164        require_once dirname(dirname( __FILE__ )).'/include/memory_limit.php' ;
165
166        if ($is_report) {
167                echo "******** "  . _AM_XP2_SYSTEM_INFO . "********" . "<br />\n";
168                echo "SERVER:  ". $_SERVER['SERVER_SOFTWARE']. "<br />\n";
169                echo "PHP Version:   " . phpversion() . "<br />\n";
170                echo 'libxml Version:  ';
171                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
172                echo "<br />\n";;
173                echo "MySQL Version:   " . mysql_get_server_info() . "</text><br />";
174                echo "XOOPS Version:   " . XOOPS_VERSION . "</text><br />";
175                echo "XPressME Version:   " . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "<br />\n";
176                echo "WordPress Version:   " . $wp_version . "<br />\n";
177                echo "WP DB Version:   " . $wp_db_version . "<br />\n";
178                echo "<br />\n";
179                echo "safemode:   " ;
180                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
181                echo "<br />\n";
182                echo "register_globals:   " ;
183                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF" ;
184                echo "<br />\n";
185                echo "allow_url_fopen:   " ;
186                echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF" ;
187                echo "<br />\n";
188                echo "magic_quotes_gpc:   " ;
189                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
190                echo "<br />\n";
191                echo "XML extension:   " ;
192                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
193                echo "<br />\n";
194                echo "default memory_limit:   " ;
195                echo  ini_get( 'memory_limit' );
196                echo "<br />\n";
197                xpress_set_memory_limmit();
198                echo "change memory_limit:   " ;
199                echo  ini_get( 'memory_limit' );
200                echo "<br />\n";
201               
202                echo "post_max_size:   " ;
203                echo  ini_get( 'post_max_size' );
204                echo "<br />\n";
205                echo "upload_max_filesize:   " ;
206                echo  ini_get( 'upload_max_filesize' );
207                echo "<br />\n";
208                echo "display_errors:   " ;
209                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
210                echo "<br />\n";
211                echo "MB extension:   " ;
212                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
213                echo "<br />\n";
214                echo "mbstring.language:   " ;
215                echo  ini_get( 'mbstring.language' );
216                echo "<br />\n";
217                echo "mbstring.encoding_translation:   " ;
218                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
219                echo "<br />\n";
220                echo "mbstring.internal_encoding:   " ;
221                echo  ini_get( 'mbstring.internal_encoding' );
222                echo "<br />\n";
223                echo "mbstring.http_input:   " ;
224                echo  ini_get( 'mbstring.http_input' );
225                echo "<br />\n";
226                echo "mbstring.http_output:   " ;
227                echo  ini_get( 'mbstring.http_output' );
228                echo "<br />\n";
229                echo "mbstring.detect_order:   " ;
230                echo  ini_get( 'mbstring.detect_order' );
231                echo "<br />\n";
232                echo "mbstring.substitute_character:   " ;
233                echo  ini_get( 'mbstring.substitute_character' );
234                echo "<br />\n";
235                echo "mbstring.func_overload:   " ;
236                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
237                echo "<br />\n";
238                echo "<br />\n";
239        } else {
240                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_SYSTEM_INFO . "</legend>";
241                echo "<div style='padding: 8px;'>";
242                echo "<label>" . "<strong>SERVER:</strong>" . ":</label><text>" . $_SERVER['SERVER_SOFTWARE'] . "</text><br />";
243                echo "<label>" . "<strong>PHP Version:</strong>" . ":</label><text>" . phpversion() . "</text><br />";
244                echo "<label>" . "<strong>libxml Version:</strong>" . ":</label><text>";
245                if (defined('LIBXML_DOTTED_VERSION')) echo LIBXML_DOTTED_VERSION ; else echo "Can't detect.";
246                echo "</text><br />";
247                echo "<label>" . "<strong>MySQL Version:</strong>" . ":</label><text>" . mysql_get_server_info() . "</text><br />";
248                echo "<label>" . "<strong>XOOPS Version:</strong>" . ":</label><text>" . XOOPS_VERSION . "</text><br />";
249                echo "<label>" . "<strong>XPressME Version:</strong>" . ":</label><text>" . $xoopsModule->getInfo('version') . ' ' . $xoopsModule->getInfo('codename') . "</text><br />";
250                echo "<label>" . "<strong>WordPress Version:</strong>" . ":</label><text>" . $wp_version . "</text><br />";
251                echo "<label>" . "<strong>WP DB Version:</strong>" . ":</label><text>" . $wp_db_version . "</text><br />";
252
253                echo "</div>";
254                echo "<div style='padding: 8px;'>";
255                echo "<label>safemode:</label><text>";
256                echo ( ini_get( 'safe_mode' ) ) ? "ON" : "OFF";
257                echo "</text><br />";
258                echo "<label>register_globals:</label><text>";
259                echo ( ini_get( 'register_globals' )) ? "ON" : "OFF";
260                echo "</text><br />";
261                echo "<label>allow_url_fopen:</label><text>";
262                echo ( ini_get( 'allow_url_fopen' )) ? "ON" : "OFF";
263                echo "</text><br />";
264                echo "<label>magic_quotes_gpc:</label><text>";
265                echo ( ini_get( 'magic_quotes_gpc' )) ? "ON" : "OFF";
266                echo "</text><br />";
267                echo "<label>XML extension:</label><text>";
268                echo ( extension_loaded( 'xml' )) ? "ON" : "OFF";
269                echo "</text><br />";
270                echo "<label>default memory_limit:</label><text>";
271                echo  ini_get( 'memory_limit' );
272                echo "</text><br />";
273                xpress_set_memory_limmit();
274                echo "<label>change memory_limit:</label><text>";
275                echo  ini_get( 'memory_limit' );
276                echo "</text><br />";
277
278                echo "<label>post_max_size:</label><text>";
279                echo  ini_get( 'post_max_size' );
280                echo "</text><br />";
281                echo "<label>upload_max_filesize:</label><text>";
282                echo  ini_get( 'upload_max_filesize' );
283                echo "</text><br />";
284                echo "<label>display_errors:</label><text>";
285                echo ( ini_get( 'display_errors' )) ? "ON" : "OFF";
286                echo "</text><br />";
287                echo "<label>MB extension:</label><text>";
288                echo ( extension_loaded( 'mbstring' )) ? "ON" : "OFF";
289                echo "</text><br />";
290                echo "<label>mbstring.language:</label><text>";
291                echo  ini_get( 'mbstring.language' );
292                echo "</text><br />";
293                echo "<label>mbstring.encoding_translation:</label><text>";
294                echo  ( ini_get( 'mbstring.encoding_translation' )) ? "ON" : "OFF";
295                echo "</text><br />";
296                echo "<label>mbstring.internal_encoding:</label><text>";
297                echo  ini_get( 'mbstring.internal_encoding' );
298                echo "</text><br />";
299                echo "<label>mbstring.http_input:</label><text>";
300                echo  ini_get( 'mbstring.http_input' );
301                echo "</text><br />";
302                echo "<label>mbstring.http_output:</label><text>";
303                echo  ini_get( 'mbstring.http_output' );
304                echo "</text><br />";
305                echo "<label>mbstring.detect_order:</label><text>";
306                echo  ini_get( 'mbstring.detect_order' );
307                echo "</text><br />";
308                echo "<label>mbstring.substitute_character:</label><text>";
309                echo  ini_get( 'mbstring.substitute_character' );
310                echo "</text><br />";
311                echo "<label>mbstring.func_overload:</label><text>";
312                echo  ( ini_get( 'mbstring.func_overload' )) ? "ON" : "OFF";
313                echo "</text><br />";
314                echo "</div>";
315                echo '</legend>';
316                echo "</fieldset><br />";
317        }
318}
319
320
321
322function xpress_state($is_report = false)
323{
324        global $xoopsModule,$xoopsDB;
325        include(dirname(__FILE__) . '/../wp-includes/version.php');
326        include_once(dirname(__FILE__) . '/../include/general_functions.php');
327
328       
329        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
330        $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
331
332        $prefix = $xoopsDB->prefix($xp_prefix . '_');
333       
334        $posts_tables = get_table_list($prefix,'posts');
335        $blogname = array();
336        $count_article = array();
337        $count_author = array();
338        $count_category = array();
339        $array_index = 0;
340        foreach( $posts_tables as $posts_table){
341                $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')";
342                $result = $xoopsDB->query($sql);
343                if($myrow = $xoopsDB->fetchArray($result)){
344                        $count_article[$array_index] = $myrow["count_article"];
345                        $count_author[$array_index] = $myrow["count_author"];
346                } else {
347                        $count_article[$array_index] = 0;
348                        $count_author[$array_index] = 0;
349                }
350                $mid_prefix = get_multi_mid_prefix($prefix,'posts' , $posts_table);
351               
352                $sql = "SELECT option_value AS blogname FROM ".$prefix. $mid_prefix . "options" . " WHERE option_name = 'blogname'";
353                $result = $xoopsDB->query($sql);
354                if($myrow = $xoopsDB->fetchArray($result)){
355                        $blogname[$array_index] = $myrow["blogname"];
356                } else {
357                        $blogname[$array_index] = 'none name';
358                }
359               
360                if ($wp_db_version < 6124){
361                       
362                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "categories";
363                } else {
364                        $sql = "SELECT COUNT(*) AS count_category FROM ".$prefix. $mid_prefix . "term_taxonomy" . " WHERE taxonomy = 'category'";
365                }
366                $result = $xoopsDB->query($sql);
367                if($myrow = $xoopsDB->fetchArray($result)){
368                        $count_category[$array_index] = $myrow["count_category"];
369                } else {
370                        $count_category[$array_index] = 0;
371                }
372                $array_index++;
373        }
374        for ($i = 0 ; $i < $array_index ; $i++){
375                if ($is_report){
376                        echo "******** " . $blogname[$i] . _AM_XP2_STATS . "********" . "<br />\n";
377                        echo _AM_XP2_CATEGORIES .":  ".@$count_category[$i]. "<br />\n";
378                        echo _AM_XP2_ARTICLES .":  ". $count_article[$i]. "<br />\n";
379                        echo _AM_XP2_AUTHORS .":  ". $count_author[$i]. "<br />\n";
380                       
381                } else {
382                        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . $blogname[$i] . _AM_XP2_STATS . "</legend>";
383                        echo "<div style='padding: 8px;'>";
384                        echo "<label>" . _AM_XP2_CATEGORIES .":</label><text>".@$count_category[$i];
385                        echo "</text><br />";
386                        echo "<label>" . _AM_XP2_ARTICLES .":</label><text>". $count_article[$i];
387                        echo "</text><br />";
388                        echo "<label>" . _AM_XP2_AUTHORS .":</label><text>". $count_author[$i];
389                        echo "</text>";
390                        echo "</div>";
391                        echo '</legend>';
392                        echo "</fieldset>";
393                }
394        }
395}
396
397function xpress_group_role_state($is_report = false)
398{
399        global $xoopsModule,$xoopsDB;
400        $xp_prefix = $GLOBALS['xoopsModule']->getInfo('dirname');
401        $xp_prefix = preg_replace('/wordpress/','wp',$xp_prefix);
402        $prefix = $xoopsDB->prefix($xp_prefix . '_');
403        $group_role_tables = $prefix.'group_role';
404        $sql = "SELECT groupid , name AS xoops_groupe ,group_type, role , login_all FROM ". $group_role_tables;
405        $result = $xoopsDB->query($sql);
406        if ($is_report){
407                echo "******** " . _AM_XP2_GROUP_ROLE . "********" . "<br />\n";
408        } else {
409                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_GROUP_ROLE . "</legend>";
410                echo "<div style='padding: 8px;'>";
411                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
412                echo '<tbody>';
413                echo '<tr>';
414                echo '<td>GROUP</td>';
415                echo '<td>GROUPE TYPE</td>';
416                echo '<td>ROLE</td>';
417                echo '<td>Allways Check</td>';
418                echo '</tr>';
419        }
420        $groupe_list = '';
421        while ($myrow = $xoopsDB->fetchArray($result)){
422                $xoops_groupe = $myrow["xoops_groupe"] ;
423                $group_type = empty($myrow["group_type"]) ? "None" : $myrow["group_type"] ;
424                $role = empty($myrow["role"]) ? "inhibit register" : $myrow["role"] ;
425                $login_all = empty($myrow["login_all"]) ? 'No' : 'Yes' ;
426                if (!empty($groupe_list)) $groupe_list .= ',';
427                $groupe_list .= $myrow["groupid"];
428                if ($is_report){
429                        echo $xoops_groupe . ' : ';
430                        echo '(' . $group_type. ') : ';
431                        echo $role;
432                        echo '(' . $login_all. ') : ';
433                        echo '<br />';
434                } else {
435                        echo '<tr>';
436                        echo '<td>' . $xoops_groupe . '</td>';
437                        echo '<td>' . $group_type . '</td>';
438                        echo '<td>' . $role . '</td>';
439                        echo '<td>' . $login_all . '</td>';
440                        echo '</tr>';
441                }
442        }
443        if ($is_report){
444                echo "<br />";
445        } else {
446                echo '</tbody>';
447                echo '</table>';
448                echo "</div>";
449                echo '</legend>';
450                echo "</fieldset><br />";
451        }
452}
453function xpress_block_state($is_report = false)
454{
455        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
456
457        include_once(dirname(dirname(__FILE__) ). '/class/check_blocks_class.php');
458        $xoops_block_check =& xoops_block_check::getInstance();
459        $xoops_block_check->check_blocks($mydirname);
460        if ($is_report){
461                echo "******** " . _AM_XP2_BLOCK_STATS . "********" . "<br />\n";
462                echo $xoops_block_check->get_message();
463                echo "<br />\n";
464                echo "<br />\n";
465        } else {
466                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_STATS . "</legend>";
467                echo "<div style='padding: 8px;'>";
468                echo $xoops_block_check->get_message();
469                echo "</div>";
470                echo '</legend>';
471                echo "</fieldset><br />";
472        }               
473}
474
475function xpress_block_options($is_report = false)
476{
477        global $xoopsModule;
478        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
479
480        $module_objs = & get_module_objects($mydirname);
481        $module_obj = $module_objs[0];
482        $mod_id = $xoopsModule->getVar('mid', 'n');
483        $blocks = & get_block_object_orber_num_bymodule_id( $mod_id );
484        $infos    = $xoopsModule->getInfo('blocks');
485        if ($is_report){
486                echo "******** " . _AM_XP2_BLOCK_OPTIONS . "********" . "<br />\n";
487                foreach ( $blocks as $block )
488                {
489                        echo $block->getVar('title') . ' : ' . $block->getVar('options') . '<br />';
490                }
491                echo "<br />\n";
492        } else {
493                echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_XP2_BLOCK_OPTIONS . "</legend>";
494                echo "<div style='padding: 8px;'>";
495                echo '<table width="400" cellspacing="1" cellpadding="1" border="1">';
496                echo '<tbody>';
497                echo '<tr>';
498                echo '<td>Title</td>';
499                echo '<td>Options</td>';
500                echo '</tr>';
501                foreach ( $blocks as $block )
502                {
503                        echo '<tr>';
504                        echo '<td>' . $block->getVar('title') . '</td>';
505                        echo '<td>' . $block->getVar('options') . '</td>';
506                        echo '</tr>';
507                }
508                echo '</tbody>';
509                echo '</table>';
510                echo '</div>';
511                echo '</legend>';
512                echo "</fieldset><br />";
513        }
514
515}
516//--------------------------------------------------------
517// module handler
518//--------------------------------------------------------
519function &get_module_objects($module_dir)
520{
521        $criteria = new CriteriaCompo();
522        $criteria->add( new Criteria('isactive', '1', '=') );
523        $criteria->add( new Criteria('dirname', $module_dir, '=') );
524
525        $module_handler =& xoops_gethandler('module');
526        $objs           =& $module_handler->getObjects( $criteria );
527        return $objs;
528}
529
530//--------------------------------------------------------
531// block handler
532//--------------------------------------------------------
533function &get_block_object_orber_num_bymodule_id( $mid )
534{
535        $arr  = array();
536        $objs =& get_block_object_bymodule_id( $mid );
537        foreach ( $objs as $obj )
538        {
539                $arr[ $obj->getVar('func_num', 'n') ] = $obj;
540        }
541        return $arr;
542}
543
544function &get_block_object_bymodule_id( $mid, $asobject=true )
545{
546        if ( defined('ICMS_VERSION_BUILD') && ICMS_VERSION_BUILD > 27  ) { /* ImpressCMS 1.2+ */
547                $block_handler =& xoops_gethandler ('block');
548                $objs =& $block_handler->getByModule( $mid, $asobject );
549        } else { /* legacy support */
550                $objs =& XoopsBlock::getByModule( $mid, $asobject ) ; /* from class/xoopsblock.php */
551        }
552        return $objs;
553}
554
555
556
557$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
558$mydirpath = dirname( dirname( __FILE__ ) ) ;
559//require_once($mydirpath.'/wp-config.php');
560
561require_once '../../../include/cp_header.php' ;
562//require_once '../include/gtickets.php' ;
563//define( '_MYMENU_CONSTANT_IN_MODINFO' , '_MI_XP2_NAME' ) ;
564
565// branch for altsys
566if( defined( 'XOOPS_TRUST_PATH' ) && ! empty( $_GET['lib'] ) ) {
567
568        // common libs (eg. altsys)
569        $lib = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , $_GET['lib'] ) ;
570        $page = preg_replace( '/[^a-zA-Z0-9_-]/' , '' , @$_GET['page'] ) ;
571       
572        if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ) ) {
573                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/'.$page.'.php' ;
574        } else if( file_exists( XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ) ) {
575                include XOOPS_TRUST_PATH.'/libs/'.$lib.'/index.php' ;
576        } else {
577                die( 'wrong request' ) ;
578        }
579        exit ;
580}
581include_once $mydirpath .'/include/wp_check.php' ;
582
583// beggining of Output
584xoops_cp_header();
585if(is_wpdb_installed()){
586        include( './mymenu.php' ) ;
587
588        echo "
589                <style type=\"text/css\">
590                label,text {
591                        display: block;
592                        float: left;
593                        margin-bottom: 2px;
594                }
595                label {
596                        text-align: right;
597                        width: 200px;
598                        padding-right: 20px;
599                }
600                br {
601                        clear: left;
602                }
603                </style>
604        ";
605        if (!empty($_POST['submit_report'])) $report = true; else $report = false;
606        xpress_sys_info($report);
607        xpress_active_plugin_list($report);
608        xpress_block_state($report);
609        xpress_block_options($report);
610        xpress_group_role_state($report);
611        admin_check_user_meta_prefix($report);
612        xpress_state($report);
613        echo '<form method="POST">'."\n";
614        echo '<input type="submit" name="submit_report" value="' . _AM_XP2_SYS_REPORT .' " />'.'&emsp;';
615        echo '<input type="submit" name="submit_normal" value="' . _AM_XP2_SYS_NORMAL .' " />'."<br />\n";
616        echo "</form>\n";
617} else {
618
619        include_once $mydirpath .'/include/wp_installer.php' ;
620        if (!empty($_POST['submit_install'])) {
621                $i_mess = wp_installer($mydirname);
622                foreach( $i_mess as $message ) {
623                        echo $message ;
624                }
625
626        } else {
627                echo '<font size="5" color="#ff0000">'. _AM_XP2_NO_WP. '</font><br /><br />';
628
629                if (xp_permission_check($mydirname , $mydirpath)){
630                        echo '<form method="POST">'."\n";
631                        echo '<input type="submit" name="submit_install" value="' . _AM_XP2_WP_INSTALL .' " />'.'&emsp;';
632                        echo "</form>\n";
633                } else {
634                        include_once $mydirpath .'/admin/help/wp_install_help.php' ;
635                        wp_install_guide();
636                        echo '<form method="POST">'."\n";
637                        echo '<input type="submit" name="submit_recheck" value="' . _AM_XP2_WP_RE_CHK .' " />'.'&emsp;';
638                        echo "</form>\n";
639                }
640        }
641}
642xoops_cp_footer();
643
644       
645?>
Note: See TracBrowser for help on using the repository browser.