function d3forum_option($do_message = '') { global $xoops_db, $xoops_config; $multi_blog_use_d3forum = true; $d3frum_list = array(); $module_dir_path = get_xoops_root_path(); $forum_list = '<select name="ch_d3forum">' . "\n"; if ($this->is_use_d3forum != true) { $selected = ' selected="selected"'; } else { $selected = ''; } if (xpress_is_multiblog() && !$multi_blog_use_d3forum) { $forum_list .= '<option value="none"' . $selected . '>' . __('WordPress MultiBlog cannot integrate the comments.', 'xpressme') . "</option>\n"; } else { $forum_list .= '<option value="none"' . $selected . '>' . __('Do Not Comment Integration.', 'xpressme') . "</option>\n"; // Form making for forum selection of D3forum $modules_table = get_xoops_prefix() . 'modules'; $sql = "SELECT mid,name,isactive,dirname FROM {$modules_table} WHERE isactive = 1"; $modules = $xoops_db->get_results($sql); foreach ($modules as $module) { $file_path = $module_dir_path . '/modules/' . $module->dirname . '/mytrustdirname.php'; if (!file_exists($file_path)) { continue; } $array_files = file($file_path); // It is checked whether there is character string "$mytrustdirname ='d3forum'"in the file. foreach ($array_files as $aeey_file) { if (preg_match("/\\s*(mytrustdirname)\\s*(=)\\s*([\"'])(d3forum)([\"'])/", $aeey_file)) { $forums_tb = get_xoops_prefix() . $module->dirname . '_forums'; $cat_tb = get_xoops_prefix() . $module->dirname . '_categories'; $cat_sql = "SELECT * FROM {$cat_tb}"; $cats = $xoops_db->get_results($cat_sql); foreach ($cats as $cat) { $sql = "SELECT * FROM {$forums_tb} WHERE {$forums_tb}.cat_id = {$cat->cat_id}"; $forums = $xoops_db->get_results($sql); foreach ($forums as $forum) { if ($module->dirname == $this->d3forum_module_dir && $forum->forum_id == $this->d3forum_forum_id) { $selected = ' selected="selected"'; $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id; $forum_select = "{$module->name}({$module->dirname}) {$cat->cat_title}-{$forum->forum_title}(ID={$forum->forum_id})"; $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n"; } else { if (empty($forum->forum_external_link_format)) { $selected = ''; $forum_div = 'forum|' . $module->dirname . '|' . $forum->forum_id; $forum_select = "{$module->name}({$module->dirname}) {$cat->cat_title}-{$forum->forum_title}(ID={$forum->forum_id})"; $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n"; } } } $selected = ''; $forum_div = 'forum|' . $module->dirname . '|Create New In Cat=' . $cat->cat_id; $forum_select = "{$module->name}({$module->dirname}) {$cat->cat_title}-" . __('Create New Forum', 'xpressme'); $forum_list .= '<option value="' . $forum_div . '" ' . $selected . '>' . $forum_select . "</option>\n"; } break; } } $forum_list .= '<br>'; } } $forum_list .= '</select>' . "\n"; $form = '<tr>' . "\n"; $form .= '<th><label for="d3forum">' . __('Comment integration with D3Forum', 'xpressme') . '</label></th>' . "\n"; $form .= "<td>\n"; $form .= __('Select the forum of D3Forum that does the comment integration from the following lists.', 'xpressme') . "<br />\n"; $form .= $forum_list . "\n"; $form .= '<br /><br />'; if ($this->is_use_d3forum) { if ($this->is_use_d3forum) { $disible = ''; } else { $disible = 'disabled'; } $form .= __('Select the Type of display of D3Forum comment.', 'xpressme') . " \n&emsp"; if ($this->is_d3forum_flat) { $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' checked='checked' />" . __('Flat', 'xpressme') . "</label>\n"; $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' />" . __('Threaded', 'xpressme') . "</label>\n"; } else { $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='1' />" . __('Flat', 'xpressme') . "</label>\n"; $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_flat' value='0' checked='checked' />" . __('Threaded', 'xpressme') . "</label>\n"; } $form .= '<br />'; $form .= __('Select the order of display of D3Forum comment.', 'xpressme') . " \n&emsp"; if ($this->is_d3forum_desc) { $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' checked='checked' />" . __('DESC', 'xpressme') . "</label>\n"; $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' />" . __('ASC', 'xpressme') . "</label>\n"; } else { $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='1' />" . __('DESC', 'xpressme') . "</label>\n"; $form .= "&ensp<label><input type='radio' name='ch_is_d3forum_desc' value='0' checked='checked' />" . __('ASC', 'xpressme') . "</label>\n"; } $form .= '<br />'; $form .= __('Number of displays of D3Forum comments.', 'xpressme') . " \n"; $form .= '&emsp<label> <input name="ch_d3forum_views_num" type="text" size="3" maxlength="3" value="' . $this->d3forum_views_num . '" /></label>' . "\n"; $form .= '<div class="submit">' . "\n"; $form .= __('The import and the export between Wordpress Comments and the D3Forum Posts can be done. ', 'xpressme') . "<br />\n"; $form .= '<input type="submit" value= "' . __('Export to D3Forum', 'xpressme') . '" name="export_d3f" ' . $disible . ' >' . "\n"; $form .= '<input type="submit" value= "' . __('Import from D3Forum', 'xpressme') . '" name="inport_d3f" ' . $disible . ' >' . "<br />\n"; $form .= '</div>' . "\n"; if (!empty($do_message)) { $form .= '<div>' . $do_message . '</div>'; } } $form .= "</td>\n"; $form .= "</tr><tr>\n"; return $form; }
<?php global $xoops_db, $xpress_config; $xoops_trust_path = get_xoops_trust_path(); $xoops_root_path = get_xoops_root_path(); $inc_path = $xoops_trust_path . '/modules/d3forum/include/comment_functions.php'; include_once $inc_path; $xpress_dir = get_xpress_dir_path(); $xpress_dirname = get_xpress_dir_name(); include_once $xpress_dir . '/class/xpressD3commentContent.class.php'; $dir_name = $xpress_config->d3forum_module_dir; $forum_id = $xpress_config->d3forum_forum_id; $external_link_format = $xpress_config->d3forum_external_link_format; if ($xpress_config->is_d3forum_desc) { $order = 'desc'; } else { $order = 'asc'; } if ($xpress_config->is_d3forum_desc) { $order = 'desc'; } else { $order = 'asc'; } if ($xpress_config->is_d3forum_flat) { $view = 'listposts_flat'; } else { $view = 'listtopics'; } $posts_num = $xpress_config->d3forum_views_num; // force UPDATE forums.forum_external_link_format "(dirname)::(classname)::(trustdirname)" $xoops_db->query("UPDATE " . get_xoops_prefix() . $dir_name . "_forums SET forum_external_link_format='" . $external_link_format . "' WHERE forum_id= {$forum_id}");
function d3f_module_found($forum_dir = 'd3forum') { //use admin/admin_enhanced.php return file_exists(get_xoops_root_path() . '/modules/' . $forum_dir); }