Пример #1
0
function veriflog()
{
    global $HTTP_COOKIE_VARS, $cookiehash;
    global $wpdb, $wp_id;
    global $xoopsUser, $xoopsDB;
    if ($xoopsUser) {
        $sql = "select ID,user_login from {$wpdb->users[$wp_id]} where ID = " . $xoopsUser->uid();
        $r = $xoopsDB->query($sql);
        if (list($id, $user_login) = $xoopsDB->fetchRow($r)) {
            if ($xoopsUser->getVar('uname') != $user_login) {
                $sql = "UPDATE {$wpdb->users[$wp_id]} SET user_login = "******" WHERE ID = " . $xoopsUser->uid();
                $xoopsDB->queryF($sql);
            }
        } else {
            $level = 0;
            $group = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
            if ($wp_id == "-") {
                $edit_groups = get_xoops_option('wordpress', 'wp_edit_authgrp');
                $admin_groups = get_xoops_option('wordpress', 'wp_admin_authgrp');
            } else {
                $edit_groups = get_xoops_option('wordpress' . $wp_id, 'wp_edit_authgrp');
                $admin_groups = get_xoops_option('wordpress' . $wp_id, 'wp_admin_authgrp');
            }
            if (count(array_intersect($group, $edit_groups)) > 0) {
                $level = 1;
            }
            if (count(array_intersect($group, $admin_groups)) > 0) {
                $level = 10;
            }
            $uname = $xoopsDB->quoteString($xoopsUser->getVar('uname'));
            $email = $xoopsDB->quoteString($xoopsUser->getVar('email'));
            $sql = "INSERT INTO {$wpdb->users[$wp_id]} (ID, user_login,user_nickname,user_email, user_level,user_idmode) values(" . $xoopsUser->uid() . ", {$uname} , {$uname} , {$email} , {$level}, 'nickname' )";
            $xoopsDB->queryF($sql);
        }
        return true;
    }
    return false;
    if (!empty($HTTP_COOKIE_VARS["wordpressuser_" . $cookiehash])) {
        $user_login = $HTTP_COOKIE_VARS["wordpressuser_" . $cookiehash];
        $user_pass_md5 = $HTTP_COOKIE_VARS["wordpresspass_" . $cookiehash];
    } else {
        return false;
    }
    if (!($user_login != '')) {
        return false;
    }
    if (!$user_pass_md5) {
        return false;
    }
    $login = $wpdb->get_row("SELECT user_login, user_pass FROM {$wpdb->users[$wp_id]} WHERE user_login = '******'");
    if (!$login) {
        return false;
    } else {
        if ($login->user_login == $user_login && md5($login->user_pass) == $user_pass_md5) {
            return true;
        } else {
            return false;
        }
    }
}
 function comments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off', $echo = true)
 {
     if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
         if (empty($GLOBALS['comment_count_cache'][wp_id()]["{$GLOBALS['wp_post_id']}"])) {
             $criteria =& new CriteriaCompo(new Criteria('comment_post_ID', $GLOBALS['wp_post_id']));
             $criteria->add(new Criteria('comment_approved', '1 '));
             // Trick for numeric chars only string compare
             $commentHandler =& wp_handler('Comment');
             $number = $commentHandler->getCount($criteria);
         } else {
             $number = $GLOBALS['comment_count_cache'][wp_id()]["{$GLOBALS['wp_post_id']}"];
         }
     } else {
         $criteria =& new CriteriaCompo(new Criteria('comment_post_ID', $GLOBALS['wp_post_id']));
         $criteria->add(new Criteria('comment_approved', '1 '));
         // Trick for numeric chars only string compare
         $criteria_c =& new CriteriaCompo(new Criteria('comment_content', "<trackback />%", 'like'));
         $criteria_c->add(new Criteria('comment_content', "<pingback />%", 'like'), 'OR');
         $criteria_c->add(new Criteria('comment_type', 'trackback'), 'OR');
         $criteria_c->add(new Criteria('comment_type', 'pingback'), 'OR');
         $criteria->add($criteria_c);
         $commentHandler =& wp_handler('Comment');
         $number = $commentHandler->getCount($criteria);
     }
     $comments_popup_link = "";
     if (0 == $number && 'closed' == $GLOBALS['post']->comment_status && 'closed' == $GLOBALS['post']->ping_status) {
         return _echo($none, $echo);
     } else {
         if (!empty($GLOBALS['post']->post_password)) {
             // if there's a password
             if ($_COOKIE['wp-postpass_' . $GLOBALS['cookiehash']] != $GLOBALS['post']->post_password) {
                 // and it doesn't match the cookie
                 return _echo("Enter your password to view comments", $echo);
             }
         }
         $comments_popup_link .= '<a href="';
         if (!empty($GLOBALS['wpcommentsjavascript'])) {
             $comments_popup_link .= wp_siteurl() . '/' . $GLOBALS['wpcommentspopupfile'] . '?p=' . $GLOBALS['wp_post_id'] . '&amp;c=1';
             $comments_popup_link .= '" onclick="wpopen(this.href); return false"';
         } else {
             // if comments_popup_script() is not in the template, display simple comment link
             $comments_popup_link .= comments_link('', false);
             $comments_popup_link .= '"';
         }
         $comments_popup_link .= ' title="Comment for \'\'' . apply_filters('the_title', $GLOBALS['post']->post_title) . '\'\'"';
         if (!empty($CSSclass)) {
             $comments_popup_link .= ' class="' . $CSSclass . '"';
         }
         $comments_popup_link .= '>';
         $comments_popup_link .= comments_number($zero, $one, $more, $number, false);
         $comments_popup_link .= '</a>';
         return _echo($comments_popup_link, $echo);
     }
 }
function comments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off')
{
    global $wp_post_id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash, $wp_id;
    global $siteurl, $wp_mod;
    global $comment_count_cache;
    if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) {
        if ('' == $comment_count_cache[$wp_id]["{$wp_post_id}"]) {
            $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments[$wp_id]} WHERE comment_post_ID = {$wp_post_id} AND comment_approved = '1';");
        } else {
            $number = $comment_count_cache[$wp_id]["{$wp_post_id}"];
        }
    } else {
        $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM {$wpdb->comments[$wp_id]} WHERE comment_post_ID = {$wp_post_id} AND comment_approved = '1' AND (comment_content like '<trackback />%' OR comment_content like '<pingkback />%');");
    }
    if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
        echo $none;
        return;
    } else {
        if (!empty($post->post_password)) {
            // if there's a password
            if ($_COOKIE['wp-postpass_' . $cookiehash] != $post->post_password) {
                // and it doesn't match the cookie
                echo "Enter your password to view comments";
                return;
            }
        }
        echo '<a href="';
        if ($wpcommentsjavascript) {
            echo $siteurl . '/' . $wpcommentspopupfile . '?p=' . $wp_post_id . '&amp;c=1';
            //echo get_permalink();
            echo '" onclick="wpopen(this.href); return false"';
        } else {
            // if comments_popup_script() is not in the template, display simple comment link
            comments_link();
            echo '"';
        }
        if (!empty($CSSclass)) {
            echo ' class="' . $CSSclass . '"';
        }
        echo '>';
        comments_number($zero, $one, $more, $number);
        echo '</a>';
    }
}
if (get_settings('hack_file')) {
    include_once $wp_base[$wp_id] . '/my-hacks.php';
}
require 'wp-config-extra.php';
require_once ABSPATH . WPINC . '/template-functions.php';
require_once ABSPATH . WPINC . '/class-xmlrpc.php';
require_once ABSPATH . WPINC . '/class-xmlrpcs.php';
require_once ABSPATH . WPINC . '/links.php';
require_once ABSPATH . WPINC . '/kses.php';
auto_upgrade();
// We should eventually migrate to either calling
// get_settings() wherever these are needed OR
// accessing a single global $all_settings var
if (!strstr($_SERVER['REQUEST_URI'], 'install.php')) {
    $siteurl = $wp_siteurl[$wp_id];
    if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_smilies')) {
        $smilies_directory = XOOPS_URL . "/uploads";
    } else {
        $smilies_directory = get_settings('smilies_directory');
    }
    //WordPressプラグイン互換性確保用
    $querystring_start = '?';
    $querystring_equal = '=';
    $querystring_separator = '&amp;';
}
// Used to guarantee unique cookies
$cookiehash = md5($siteurl);
require ABSPATH . WPINC . '/vars.php';
require ABSPATH . WPINC . '/wp-filter-setup.php';
if ($wp_inblock != 1) {
    if (!defined('XOOPS_PULUGIN' . $wp_id)) {
 /**
  * レコードの保存
  * 
  * @param	object	&$record	{@link WordPressUser} object
  * @param	bool	$force		POSTメソッド以外で強制更新する場合はture
  * 
  * @return	bool    成功の時は TRUE
  */
 function insert(&$record, $force = false, $updateOnlyChanged = false, $mod_name = '')
 {
     $member_handler =& xoops_gethandler('member');
     $member =& $member_handler->getUser($record->getVar('ID'));
     if ($record->isNew()) {
         if (!$mod_name) {
             return false;
         }
         $user_level = 0;
         $group = $member->getGroups();
         $edit_groups = get_xoops_option($mod_name, 'wp_edit_authgrp');
         $admin_groups = get_xoops_option($mod_name, 'wp_admin_authgrp');
         if (count(array_intersect($group, $edit_groups)) > 0) {
             $user_level = 1;
         }
         if (count(array_intersect($group, $admin_groups)) > 0) {
             $user_level = 10;
         }
         $record->setVar('user_login', $member->getVar('uname'));
         $record->setVar('user_email', $member->getVar('email'));
         $record->setVar('user_url', $member->getVar('url'));
         $record->setVar('user_level', $user_level);
         $record->setVar('user_icq', intval($member->getVar('user_icq')));
         $record->setVar('user_aim', $member->getVar('user_aim'));
         $record->setVar('user_yim', $member->getVar('user_yim'));
         $record->setVar('user_msn', $member->getVar('user_msnm'));
     } else {
         if ($member->getVar('uname') != $record->getVar('user_login')) {
             $record->setVar('user_login', $member->getVar('uname'));
         }
     }
     return parent::insert($record, $force, $updateOnlyChanged);
 }
    function block_style_get($echo = true, $with_tpl = true)
    {
        $wp_num = wp_id() == '-' ? '' : wp_id();
        if ($with_tpl) {
            if (get_xoops_option(wp_mod(), 'wp_use_blockcssheader')) {
                $tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
                $csslink = "\n<link rel='stylesheet' type='text/css' media='screen' href='" . wp_siteurl() . "/wp-blockstyle.php' />";
                if (array_key_exists('xoops_block_header', $tplVars)) {
                    if (!strstr($tplVars['xoops_block_header'], $csslink)) {
                        $GLOBALS['xoopsTpl']->assign('xoops_block_header', $tplVars['xoops_block_header'] . $csslink);
                    }
                } else {
                    $GLOBALS['xoopsTpl']->assign('xoops_block_header', $csslink);
                }
                return;
            } else {
                if (!defined('WP_BLOCKSTYLE_READ' . $wp_num)) {
                    define('WP_BLOCKSTYLE_READ' . $wp_num, 1);
                    echo '<style type="text/css" midia="screen">@import url(' . wp_siteurl() . '/wp-blockstyle.php);</style>' . "\n";
                }
                return;
            }
        }
        if (file_exists(wp_base() . '/themes/' . $GLOBALS['xoopsConfig']['theme_set'] . '/wp-blocks.css.php')) {
            $themes = $GLOBALS['xoopsConfig']['theme_set'];
        } else {
            $themes = 'default';
        }
        $wp_block_style = '';
        include_once wp_base() . '/themes/' . $themes . '/wp-blocks.css.php';
        if ($echo) {
            if (trim($wp_block_style) != "") {
                echo <<<EOD
<style type="text/css" media="screen">
    <!--
\t{$wp_block_style}
    -->
</style>
EOD;
            }
        } else {
            return trim($wp_block_style);
        }
    }
Пример #7
0
        }
    } else {
        $wpsmiliestrans[$wp_id] = array(' :)' => 'icon_smile.gif', ' :D' => 'icon_biggrin.gif', ' :-D' => 'icon_biggrin.gif', ':grin:' => 'icon_biggrin.gif', ' :)' => 'icon_smile.gif', ' :-)' => 'icon_smile.gif', ':smile:' => 'icon_smile.gif', ' :(' => 'icon_sad.gif', ' :-(' => 'icon_sad.gif', ':sad:' => 'icon_sad.gif', ' :o' => 'icon_surprised.gif', ' :-o' => 'icon_surprised.gif', ':eek:' => 'icon_surprised.gif', ' 8O' => 'icon_eek.gif', ' 8-O' => 'icon_eek.gif', ':shock:' => 'icon_eek.gif', ' :?' => 'icon_confused.gif', ' :-?' => 'icon_confused.gif', ' :???:' => 'icon_confused.gif', ' 8)' => 'icon_cool.gif', ' 8-)' => 'icon_cool.gif', ':cool:' => 'icon_cool.gif', ':lol:' => 'icon_lol.gif', ' :x' => 'icon_mad.gif', ' :-x' => 'icon_mad.gif', ':mad:' => 'icon_mad.gif', ' :P' => 'icon_razz.gif', ' :-P' => 'icon_razz.gif', ':razz:' => 'icon_razz.gif', ':oops:' => 'icon_redface.gif', ':cry:' => 'icon_cry.gif', ':evil:' => 'icon_evil.gif', ':twisted:' => 'icon_twisted.gif', ':roll:' => 'icon_rolleyes.gif', ':wink:' => 'icon_wink.gif', ' ;)' => 'icon_wink.gif', ' ;-)' => 'icon_wink.gif', ':!:' => 'icon_exclaim.gif', ':?:' => 'icon_question.gif', ':idea:' => 'icon_idea.gif', ':arrow:' => 'icon_arrow.gif', ' :|' => 'icon_neutral.gif', ' :-|' => 'icon_neutral.gif', ':neutral:' => 'icon_neutral.gif', ':mrgreen:' => 'icon_mrgreen.gif');
    }
}
# sorts the smilies' array
if (!function_exists('smiliescmp')) {
    function smiliescmp($a, $b)
    {
        if (strlen($a) == strlen($b)) {
            return strcmp($a, $b);
        }
        return strlen($a) > strlen($b) ? -1 : 1;
    }
}
if (get_xoops_option('wordpress' . ($wp_id == '-' ? '' : $wp_id), 'wp_use_xoops_smilies') == 0) {
    uksort($wpsmiliestrans[$wp_id], 'smiliescmp');
}
# generates smilies' search & replace arrays
$wp_smiliessearch[$wp_id] = array();
$wp_smiliesreplace[$wp_id] = array();
foreach ($wpsmiliestrans[$wp_id] as $smiley => $img) {
    $wp_smiliessearch[$wp_id][] = $smiley;
    $smiley_masked = str_replace(' ', '', $smiley);
    $wp_smiliesreplace[$wp_id][] = " <img src='{$smilies_directory}/{$img}' alt='{$smiley_masked}' />";
}
// Some default filters
add_filter('all', 'wptexturize');
add_filter('the_content', 'wpautop');
add_filter('comment_text', 'wpautop');
// Uncomment the following for Textile support
 function b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     global $wpdb, $siteurl, $post, $use_cache;
     global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace;
     global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni;
     global $wp_id, $wp_inblock, $xoopsConfig, $previousday, $time_difference;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     global $dateformat, $timeformat;
     $dateformat = stripslashes(get_settings('date_format'));
     $timeformat = stripslashes(get_settings('time_format'));
     $now = date('Y-m-d H:i:s', time() + $time_difference * 3600);
     $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} ";
     $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) ";
     $request .= "WHERE post_status = 'publish' ";
     $request .= " AND post_date <= '" . $now . "'";
     $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}";
     $lposts = $wpdb->get_results($request);
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template');
     //		if (file_exists(XOOPS_ROOT_PATH.'/modules/wordpress'. (($wp_id=='-')?'':$wp_id) .'/themes/'.$xoopsConfig['theme_set'].'/wp-blocks.css.php')) {
     //			$themes = $xoopsConfig['theme_set'];
     //		} else {
     //			$themes = "default";
     //		}
     //		include_once(XOOPS_ROOT_PATH."/modules/wordpress". (($wp_id=='-')?'':$wp_id) ."/themes/".$themes."/wp-blocks.css.php");
     //
     if (file_exists(XOOPS_ROOT_PATH . '/modules/wordpress' . ($wp_id == '-' ? '' : $wp_id) . '/themes/' . $xoopsConfig['theme_set'] . '/content_block-template.php')) {
         $themes = $xoopsConfig['theme_set'];
     } else {
         $themes = "default";
     }
     $template_fname = XOOPS_ROOT_PATH . "/modules/wordpress" . ($wp_id == '-' ? '' : $wp_id) . "/themes/" . $themes . "/content_block-template.php";
     $block['style'] = block_style_get($wp_num, false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $previousday = 0;
     foreach ($lposts as $post) {
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($dateformat, '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             //
             ob_start();
             the_author();
             $content['author'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_category();
             $content['category'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_content();
             $content['body'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             link_pages('<br />Pages: ', '<br />', 'number');
             $content['linkpage'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             $content['comments'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             trackback_rdf();
             $content['trackback'] = ob_get_contents();
             ob_end_clean();
             //
             $block['contents'][] = $content;
         } else {
             ob_start();
             include $template_fname;
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $previousday = 0;
     return $block;
 }
    function tkzy_get_recent_comments($limit = 10, $cat_date = 1, $show_type = 1)
    {
        $comment_lenth = 30;
        $request = 'SELECT ID, post_title, post_date, 
		comment_ID, comment_author, comment_author_url, comment_author_email, comment_date, comment_content 
		FROM ' . wp_table('posts') . ', ' . wp_table('comments') . ' WHERE ' . wp_table('posts') . '.ID=' . wp_table('comments') . '.comment_post_ID AND ' . wp_table('comments') . '.comment_approved=\'1\'';
        if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) {
            $request .= ' AND (comment_content like \'<trackback />%\' OR comment_content like \'<pingkback />%\') ';
        }
        $request .= ' ORDER BY ' . wp_table('comments') . '.comment_date DESC LIMIT ' . $limit;
        $lcomments = $GLOBALS['wpdb']->get_results($request);
        $output = '';
        if ($lcomments) {
            usort($lcomments, 'sort_comment_by_date');
        }
        $new_post_ID = -1;
        if ($lcomments) {
            $output .= '<ul class="wpBlockList">';
            foreach ($lcomments as $lcomment) {
                if ($lcomment->ID != $new_post_ID) {
                    // next post
                    if ($new_post_ID != -1) {
                        $output .= '</ul></li>';
                    }
                    $post_title = stripslashes($lcomment->post_title);
                    if (trim($post_title) == "") {
                        $post_title = _WP_POST_NOTITLE;
                    }
                    $comment_content = strip_tags($lcomment->comment_content);
                    $comment_content = stripslashes($comment_content);
                    if (function_exists('mb_substr')) {
                        $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth);
                    } else {
                        $comment_excerpt = substr($comment_content, 0, $comment_lenth);
                    }
                    $permalink = wp_siteurl() . '/index.php?p=' . $lcomment->ID . '&amp;c=1';
                    $output .= '<li>';
                    $output .= '<span class="comment-title"><a href="' . $permalink . '">' . $post_title . '</a></span>';
                    $output .= '<ul class="children" style="list-style-type: none;">';
                    $new_post_ID = $lcomment->ID;
                }
                $output .= "\t\t<li>";
                if ($cat_date) {
                    $comment_date = $lcomment->comment_date;
                    if (time() - mysql2date('U', $comment_date) < 60 * 60 * 24) {
                        # within 24 hours
                        $comment_date = mysql2date('H:i', $comment_date);
                    } else {
                        $comment_date = mysql2date('m/d', $comment_date);
                    }
                    $output .= '<span class="post-date">' . $comment_date . '</span> : ';
                }
                $output .= '<span class="comment_author">' . tkzy_get_comment_author_link($lcomment, 25) . '</span></li>';
                if (preg_match('|<trackback />|', $lcomment->comment_content)) {
                    $type = '[TrackBack]';
                } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
                    $type = '[Ping]';
                } else {
                    $type = '[Comment]';
                }
                if ($show_type) {
                    $output .= '<span style="font-size:90%"> - ' . $type . '</span>';
                }
            }
        }
        $output .= '</ul></li></ul>';
        return $output;
    }
Пример #10
0
 /**
  * レコードの保存
  * 
  * @param	object	&$record	{@link WordPressUser} object
  * @param	bool	$force		POSTメソッド以外で強制更新する場合はture
  * 
  * @return	bool    成功の時は TRUE
  */
 function insert(&$record, $force = false, $updateOnlyChanged = false)
 {
     $member =& $this->member_handler->getUser($record->getVar('ID'));
     if ($record->isNew()) {
         if ($member) {
             $user_level = 0;
             $group = $member->getGroups();
             $edit_groups = get_xoops_option($this->module, 'wp_edit_authgrp');
             $admin_groups = get_xoops_option($this->module, 'wp_admin_authgrp');
             if (count(array_intersect($group, $edit_groups)) > 0) {
                 $user_level = 1;
             }
             if (count(array_intersect($group, $admin_groups)) > 0) {
                 $user_level = 10;
             }
             $record->setVar('user_login', $member->getVar('uname', 'n'), true);
             $record->setVar('user_nickname', $member->getVar('uname', 'n'), true);
             $record->assignVar('user_email', $member->getVar('email', 'n'));
             $record->assignVar('user_url', $member->getVar('url', 'n'));
             $record->setVar('user_level', $user_level, true);
             $record->setVar('user_icq', intval($member->getVar('user_icq', 'n')), true);
             $record->setVar('user_aim', $member->getVar('user_aim', 'n'), true);
             $record->setVar('user_yim', $member->getVar('user_yim', 'n'), true);
             $record->setVar('user_msn', $member->getVar('user_msnm', 'n'), true);
             $record->setVar('user_idmode', 'nickname', true);
         } else {
             return false;
         }
     } else {
         if ($member) {
             if ($member->getVar('uname') != $record->getVar('user_login', 'n')) {
                 $record->setVar('user_login', $member->getVar('uname', 'n'), true);
             }
             if (trim($record->getVar('user_nickname')) == '') {
                 $record->setVar('user_nickname', $member->getVar('uname', 'n'), true);
             }
         }
     }
     return parent::insert($record, $force, $updateOnlyChanged);
 }
function veriflog()
{
    global $wpdb, $wp_id, $wp_mod;
    global $xoopsUser, $xoopsDB;
    if ($xoopsUser) {
        $sql = "select ID,user_login from {$wpdb->users[$wp_id]} where ID = " . $xoopsUser->uid();
        $r = $xoopsDB->query($sql);
        if (list($id, $user_login) = $xoopsDB->fetchRow($r)) {
            if ($xoopsUser->getVar('uname') != $user_login) {
                $sql = "UPDATE {$wpdb->users[$wp_id]} SET user_login = "******" WHERE ID = " . $xoopsUser->uid();
                $xoopsDB->queryF($sql);
            }
        } else {
            $level = 0;
            $group = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
            $edit_groups = get_xoops_option($wp_mod[$wp_id], 'wp_edit_authgrp');
            $admin_groups = get_xoops_option($wp_mod[$wp_id], 'wp_admin_authgrp');
            if (count(array_intersect($group, $edit_groups)) > 0) {
                $level = 1;
            }
            if (count(array_intersect($group, $admin_groups)) > 0) {
                $level = 10;
            }
            $uname = $xoopsDB->quoteString($xoopsUser->getVar('uname'));
            $email = $xoopsDB->quoteString($xoopsUser->getVar('email'));
            $sql = "INSERT INTO {$wpdb->users[$wp_id]} (ID, user_login,user_nickname,user_email, user_level,user_idmode) values(" . $xoopsUser->uid() . ", {$uname} , {$uname} , {$email} , {$level}, 'nickname' )";
            $xoopsDB->queryF($sql);
        }
        return true;
    }
    return false;
}
Пример #12
0
 function _b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     $tpl_file = empty($options[1]) ? 'wp_contents.html' : $options[1];
     $category = empty($options[2]) ? "all" : intval($options[2]);
     $GLOBALS['dateformat'] = get_settings('date_format');
     $GLOBALS['timeformat'] = get_settings('time_format');
     $_criteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
     $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
     if (empty($category) || $category == 'all' || $category == '0') {
         $_joinCriteria = null;
     } else {
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_wCriteria =& new CriteriaCompo();
         $_wCriteria->add(new Criteria('category_id', intCriteriaVal($category)), 'OR');
         $_catc = trim(get_category_children($category, '', ' '));
         if ($_catc !== "") {
             $_catc_array = explode(' ', $_catc);
             for ($_j = 0; $_j < count($_catc_array); $_j++) {
                 $_wCriteria->add(new Criteria('category_id', intCriteriaVal($_catc_array[$_j])), 'OR');
             }
         }
         $_criteria->add($_wCriteria);
     }
     $_criteria->setGroupBy(wp_table('posts') . '.ID');
     $_criteria->setSort('post_date');
     $_criteria->setOrder('DESC');
     $_criteria->setLimit($no_posts);
     $_criteria->setStart(0);
     $postHandler =& wp_handler('Post');
     $postObjects =& $postHandler->getObjects($_criteria, false, '', 'DISTINCT', $_joinCriteria);
     //		echo $postHandler->getLastSQL();
     $lposts = array();
     foreach ($postObjects as $postObject) {
         $lposts[] =& $postObject->exportWpObject();
     }
     if ($lposts) {
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_post_id_criteria =& new Criteria('comment_post_ID', '(' . $_post_id_list . ')', 'IN');
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
         // Get post-meta info
         if ($meta_list = $GLOBALS['wpdb']->get_results('SELECT post_id, meta_key, meta_value FROM ' . wp_table('postmeta') . ' WHERE post_id IN(' . $_post_id_list . ') ORDER BY post_id, meta_key', ARRAY_A)) {
             // Change from flat structure to hierarchical:
             $GLOBALS['post_meta_cache'][wp_id()] = array();
             foreach ($meta_list as $metarow) {
                 $mpid = $metarow['post_id'];
                 $mkey = $metarow['meta_key'];
                 $mval = $metarow['meta_value'];
                 // Force subkeys to be array type:
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid] = array();
                 }
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"] = array();
                 }
                 // Add a value to the current pid/key:
                 $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"][] = $mval;
             }
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS, '', 'Trackback Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     if (!$_wpTpl->tpl_exists($tpl_file)) {
         $tpl_file = 'wp_contents.html';
     }
     $block['content'] = $_wpTpl->fetch($tpl_file);
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
 function _b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     $GLOBALS['dateformat'] = stripslashes(get_settings('date_format'));
     $GLOBALS['timeformat'] = stripslashes(get_settings('time_format'));
     $_criteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
     $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
     $_criteria->setGroupBy(wp_table('posts') . '.ID');
     $_criteria->setSort('post_date');
     $_criteria->setOrder('DESC');
     $_criteria->setLimit($no_posts);
     $_criteria->setStart(0);
     $postHandler =& wp_handler('Post');
     $postObjects =& $postHandler->getObjects($_criteria, false, '', 'DISTINCT');
     $lposts = array();
     foreach ($postObjects as $postObject) {
         $lposts[] =& $postObject->exportWpObject();
     }
     if ($lposts) {
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
    include XOOPS_ROOT_PATH . '/header.php';
    $wp_id = $wp_id_keep;
    global $wp_inblock;
    $wp_inblock = 1;
    require '../wp-config.php';
    $wp_inblock = 0;
}
require_once ABSPATH . 'wp-admin/admin-functions.php';
require_once 'auth.php';
function gethelp_link($this_file, $helptag)
{
    $url = 'http://wordpress.org/docs/reference/links/#' . $helptag;
    $s = ' <a href="' . $url . '" title="Click here for help">?</a>';
    return $s;
}
if (get_xoops_option($wp_mod[$wp_id], 'wp_use_spaw') == 1) {
    $wp_use_spaw = true;
} else {
    $wp_use_spaw = false;
}
if (!isset($use_cache)) {
    $use_cache = 1;
}
if (!isset($blogID)) {
    $blog_ID = 1;
}
if (!isset($debug)) {
    $debug = 0;
}
timer_start();
get_currentuserinfo();
 function b_wp_recent_comments_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $num_of_list = !isset($options[1]) ? 10 : $options[1];
     $show_rss_icon = !isset($options[2]) ? 0 : $options[2];
     $cat_date = !isset($options[3]) ? $block_style ? 1 : 0 : $options[3];
     $show_type = !isset($options[4]) ? 1 : $options[4];
     global $wpdb, $siteurl, $wp_id, $wp_inblock, $use_cache, $wp_mod, $wp_base;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     if ($block_style == 0) {
         $no_comments = $num_of_list;
         $comment_lenth = 30;
         $skip_posts = 0;
         $request = "SELECT ID, comment_ID, comment_content, comment_author,comment_date FROM {$wpdb->posts[$wp_id]}, {$wpdb->comments[$wp_id]} WHERE {$wpdb->posts[$wp_id]}.ID={$wpdb->comments[$wp_id]}.comment_post_ID AND post_status = 'publish' AND comment_approved = '1' ";
         if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 1) {
             $request .= "AND (comment_content like '<trackback />%' OR comment_content like '<pingkback />%') ";
         }
         $request .= "ORDER BY {$wpdb->comments[$wp_id]}.comment_date DESC LIMIT {$no_comments}";
         $lcomments = $wpdb->get_results($request);
         $output = '';
         $pdate = "";
         if ($lcomments) {
             if (!$cat_date) {
                 $output .= "<ul class='wpBlockList'>\n";
             } else {
                 $output .= "<ul class='wpBlockDateList'>\n";
             }
             foreach ($lcomments as $lcomment) {
                 if ($cat_date) {
                     $date = mysql2date("Y-n-j", $lcomment->comment_date);
                     if ($date != $pdate) {
                         if ($pdate != "") {
                             $output .= "</ul>\n";
                         }
                         $output .= "<li><span id=\"postDate\">" . $date . "</span></li>\n<ul class=\"children\">\n";
                         $pdate = $date;
                     }
                 }
                 if (preg_match('|<trackback />|', $lcomment->comment_content)) {
                     $type = '[TrackBack]';
                 } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
                     $type = '[PingBack]';
                 } else {
                     $type = '[Comment]';
                 }
                 $comment_author = stripslashes($lcomment->comment_author);
                 $comment_content = strip_tags($lcomment->comment_content);
                 $comment_content = stripslashes($comment_content);
                 if (function_exists('mb_substr')) {
                     $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth);
                 } else {
                     $comment_excerpt = substr($comment_content, 0, $comment_lenth);
                 }
                 $permalink = get_permalink($lcomment->ID) . "#comment-" . $lcomment->comment_ID;
                 $output .= '<li><span class="comment-author";">' . $comment_author . ':</span> <a href="' . $permalink;
                 $output .= '" title="View the entire comment by ' . $comment_author . '">' . $comment_excerpt . '...</a>';
                 if ($show_type) {
                     $output .= '<span style=\\"font-size:70%\\">- ' . $type . '</span>';
                 }
                 $output .= "</li>\n";
             }
         }
         $output .= "</ul>\n";
         if ($cat_date) {
             $output .= "</ul>\n";
         }
     } else {
         $output = tkzy_get_recent_comments($num_of_list, $cat_date, $show_type);
     }
     if ($show_rss_icon) {
         $output .= '<hr width="100%" />';
         $output .= '<div style="text-align:right">&nbsp;<a href="' . get_bloginfo('comments_rss2_url') . '"><img src="' . XOOPS_URL . '/modules/wordpress' . $wp_num . '/wp-images/rss_comment.gif" /></a></div>';
     }
     ob_start();
     block_style_get($wp_num);
     echo $output;
     $block['content'] = ob_get_contents();
     ob_end_clean();
     return $block;
 }
    $_wp_id_keep = $GLOBALS['wp_id'];
    include_once dirname(__FILE__) . "/../../../mainfile.php";
    include XOOPS_ROOT_PATH . '/header.php';
    $GLOBALS['wp_id'] = $_wp_id_keep;
    $GLOBALS['wp_inblock'] = 1;
    require '../wp-config.php';
    $GLOBALS['wp_inblock'] = 0;
}
require_once ABSPATH . 'wp-admin/admin-functions.php';
require_once 'auth.php';
if (get_xoops_option(wp_mod(), 'wp_use_spaw') == 1) {
    $GLOBALS['wp_use_spaw'] = true;
} else {
    $GLOBALS['wp_use_spaw'] = false;
}
if (get_xoops_option(wp_mod(), 'wp_use_spaw') == 2) {
    $GLOBALS['wp_use_koivi'] = true;
} else {
    $GLOBALS['wp_use_koivi'] = false;
}
if (!isset($use_cache)) {
    $GLOBALS['use_cache'] = 1;
}
if (!isset($blogID)) {
    $GLOBALS['blog_ID'] = 1;
}
if (!isset($debug)) {
    $GLOBALS['debug'] = 0;
}
timer_start();
get_currentuserinfo();
    function _b_wp_recent_comments_show($options, $wp_num = "")
    {
        $block_style = $options[0] ? $options[0] : 0;
        $num_of_list = !isset($options[1]) ? 10 : $options[1];
        $show_rss_icon = !isset($options[2]) ? 0 : $options[2];
        $cat_date = !isset($options[3]) ? $block_style ? 1 : 0 : $options[3];
        $show_type = !isset($options[4]) ? 1 : $options[4];
        $tpl_file = empty($options[5]) ? 'wp_recent_comments.html' : $options[5];
        $block['style'] = block_style_get(false);
        $block['divid'] = 'wpRecentComment' . $wp_num;
        $block['block_style'] = $block_style;
        $block['cat_date'] = $cat_date;
        $block['show_type'] = $show_type;
        $comment_lenth = 30;
        if ($block_style == 0) {
            $skip_posts = 0;
            $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, comment_date, comment_type\n\t\t\t\t\t\tFROM " . wp_table('posts') . ", " . wp_table('comments') . "\n\t\t\t\t\t\tWHERE " . wp_table('posts') . ".ID=" . wp_table('comments') . ".comment_post_ID\n\t\t\t\t\t\tAND post_status = 'publish' AND comment_approved = '1' ";
            if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) {
                $request .= "AND (comment_content like '<trackback />%' \n\t\t\t\t                  OR comment_content like '<pingkback />%'\n\t\t\t\t                  OR comment_type = 'trackback'\n\t\t\t\t                  OR comment_type = 'pingback'\n\t\t\t\t                  ) ";
            }
            $request .= "ORDER BY " . wp_table('comments') . ".comment_date DESC LIMIT {$num_of_list}";
            $lcomments = $GLOBALS['wpdb']->get_results($request);
            $output = '';
            $pdate = "";
            $block['records'] = array();
            if ($lcomments) {
                foreach ($lcomments as $lcomment) {
                    if ($cat_date) {
                        $date = mysql2date("Y-n-j", $lcomment->comment_date);
                        if ($date != $pdate) {
                            $_record['date'] = $date;
                            $_record['pdate'] = $pdate;
                            $pdate = $date;
                        } else {
                            $_record['date'] = '';
                        }
                    }
                    if (empty($lcomment->comment_type)) {
                        if (preg_match('|<trackback />|', $lcomment->comment_content)) {
                            $type = '[TrackBack]';
                        } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
                            $type = '[PingBack]';
                        } else {
                            $type = '[Comment]';
                        }
                    } else {
                        if ($lcomment->comment_type == 'trackback') {
                            $type = '[TrackBack]';
                        } elseif ($lcomment->comment_type == 'pingback') {
                            $type = '[PingBack]';
                        } else {
                            $type = '[Comment]';
                        }
                    }
                    $_record['comment_author'] = apply_filters('comment_author', $lcomment->comment_author);
                    $_record['comment_author_link'] = _get_comment_author_link($lcomment, 25);
                    $_record['comment_content'] = strip_tags($lcomment->comment_content);
                    if (function_exists('mb_substr')) {
                        $_record['comment_excerpt'] = mb_substr($_record['comment_content'], 0, $comment_lenth);
                    } else {
                        $_record['comment_excerpt'] = substr($_record['comment_content'], 0, $comment_lenth);
                    }
                    $_record['comment_excerpt'] = preg_replace('/([a-zA-Z0-9\\.\\/\\:\\%\\?\\-\\+\\&\\;]{15})/ms', '\\1&#8203;', $_record['comment_excerpt']);
                    $_record['permalink'] = get_permalink($lcomment->ID) . '#comment-' . $lcomment->comment_ID;
                    if ($show_type) {
                        $_record['type'] = $type;
                    }
                    $block['records'][] = $_record;
                }
            }
        } else {
            $request = 'SELECT ID, post_title, post_date, comment_ID, comment_author, comment_author_url,
						comment_date, comment_content, comment_type
						FROM ' . wp_table('posts') . ', ' . wp_table('comments') . '
						WHERE ' . wp_table('posts') . '.ID=' . wp_table('comments') . '.comment_post_ID
						AND ' . wp_table('comments') . '.comment_approved=\'1\'';
            if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) {
                $request .= "AND (comment_content like '<trackback />%' \n\t\t\t\t                  OR comment_content like '<pingkback />%'\n\t\t\t\t                  OR comment_type = 'trackback'\n\t\t\t\t                  OR comment_type = 'pingback'\n\t\t\t\t                  ) ";
            }
            $request .= ' ORDER BY ' . wp_table('comments') . '.comment_date DESC LIMIT ' . $num_of_list;
            $lcomments = $GLOBALS['wpdb']->get_results($request);
            $output = '';
            if ($lcomments) {
                usort($lcomments, 'sort_comment_by_date');
            }
            $new_post_ID = -1;
            $block['records'] = array();
            if ($lcomments) {
                foreach ($lcomments as $lcomment) {
                    $_record['new_post_ID'] = $new_post_ID;
                    $_record['ID'] = $lcomment->ID;
                    if ($lcomment->ID != $new_post_ID) {
                        // next post
                        $_record['post_title'] = $lcomment->post_title;
                        if (trim($_record['post_title']) == "") {
                            $_record['post_title'] = _WP_POST_NOTITLE;
                        }
                        $_record['comment_content'] = strip_tags($lcomment->comment_content);
                        if (function_exists('mb_substr')) {
                            $_record['comment_excerpt'] = mb_substr($_record['comment_content'], 0, $comment_lenth);
                        } else {
                            $_record['comment_excerpt'] = substr($_record['comment_content'], 0, $comment_lenth);
                        }
                        $_record['comment_excerpt'] = preg_replace('/([a-zA-Z0-9\\.\\/\\:\\?\\-\\+%&;]{15})/ms', '\\1&#8203;', $_record['comment_excerpt']);
                        $_record['permalink'] = wp_siteurl() . '/index.php?p=' . $lcomment->ID . '&amp;c=1';
                        $new_post_ID = $lcomment->ID;
                    }
                    if ($cat_date) {
                        $comment_date = $lcomment->comment_date;
                        if (time() - mysql2date('U', $comment_date) < 60 * 60 * 24) {
                            # within 24 hours
                            $_record['comment_date'] = mysql2date('H:i', $comment_date);
                        } else {
                            $_record['comment_date'] = mysql2date('m/d', $comment_date);
                        }
                    }
                    $_record['comment_author'] = apply_filters('comment_author', $lcomment->comment_author);
                    $_record['comment_author_link'] = _get_comment_author_link($lcomment, 25);
                    if (empty($lcomment->comment_type)) {
                        if (preg_match('|<trackback />|', $lcomment->comment_content)) {
                            $type = '[TrackBack]';
                        } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
                            $type = '[PingBack]';
                        } else {
                            $type = '[Comment]';
                        }
                    } else {
                        if ($lcomment->comment_type == 'trackback') {
                            $type = '[TrackBack]';
                        } elseif ($lcomment->comment_type == 'pingback') {
                            $type = '[PingBack]';
                        } else {
                            $type = '[Comment]';
                        }
                    }
                    if ($show_type) {
                        $_record['type'] = $type;
                    }
                    $block['records'][] = $_record;
                }
            }
        }
        if ($show_rss_icon) {
            $block['feed_icon'] = array('url' => get_bloginfo('comments_rss2_url'), 'icon' => wp_siteurl() . '/wp-images/rss_comment.gif', 'alt' => 'Comment RSS');
        } else {
            $block['feed_icon'] = array();
        }
        $_wpTpl =& new WordPresTpl('theme');
        $_wpTpl->assign('block', $block);
        if (!$_wpTpl->tpl_exists($tpl_file)) {
            $tpl_file = 'wp_recent_comments.html';
        }
        $block['content'] = $_wpTpl->fetch($tpl_file);
        return $block;
    }
 function tkzy_get_recent_comments($limit = 10, $cat_date = 1, $show_type = 1)
 {
     $comment_lenth = 30;
     $request = "SELECT ID, post_title, post_date, \n\t\tcomment_ID, comment_author, comment_author_url, comment_author_email, comment_date, comment_content \n\t\tFROM " . wp_table('posts') . ", " . wp_table('comments') . " WHERE " . wp_table('posts') . ".ID=" . wp_table('comments') . ".comment_post_ID AND " . wp_table('comments') . ".comment_approved='1'";
     if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 1) {
         $request .= "AND (comment_content like '<trackback />%' OR comment_content like '<pingkback />%') ";
     }
     $request .= " ORDER BY " . wp_table('comments') . ".comment_date DESC LIMIT {$limit}";
     $lcomments = $GLOBALS['wpdb']->get_results($request);
     $output = '';
     if ($lcomments) {
         usort($lcomments, "sort_comment_by_date");
     }
     $new_post_ID = -1;
     if ($lcomments) {
         $output .= "<ul class='wpBlockList'>";
         foreach ($lcomments as $lcomment) {
             if ($lcomment->ID != $new_post_ID) {
                 // next post
                 if ($new_post_ID != -1) {
                     $output .= "\t</ul>\n</li>\n";
                 }
                 $post_title = stripslashes($lcomment->post_title);
                 if (trim($post_title) == "") {
                     $post_title = _WP_POST_NOTITLE;
                 }
                 $comment_content = strip_tags($lcomment->comment_content);
                 $comment_content = stripslashes($comment_content);
                 if (function_exists('mb_substr')) {
                     $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth);
                 } else {
                     $comment_excerpt = substr($comment_content, 0, $comment_lenth);
                 }
                 $permalink = wp_siteurl() . "/index.php?p={$lcomment->ID}&amp;c=1";
                 $output .= "<li>";
                 $output .= "<span class='comment-title'><a href=\"{$permalink}\">{$post_title}</a></span>\n";
                 $output .= "\t<ul class=\"children\" style=\"list-style-type: none;\">\n";
                 $new_post_ID = $lcomment->ID;
             }
             $output .= "\t\t<li>";
             if ($cat_date) {
                 $comment_date = $lcomment->comment_date;
                 if (time() - mysql2date('U', $comment_date) < 60 * 60 * 24) {
                     # within 24 hours
                     $comment_date = mysql2date('H:i', $comment_date);
                 } else {
                     $comment_date = mysql2date('m/d', $comment_date);
                 }
                 $output .= "<span class=\"post-date\">{$comment_date}</span> : ";
             }
             $output .= "<span class=\"comment_author\">" . tkzy_get_comment_author_link($lcomment, 25) . "</span></li>\n";
             if (preg_match('|<trackback />|', $lcomment->comment_content)) {
                 $type = '[TrackBack]';
             } elseif (preg_match('|<pingback />|', $lcomment->comment_content)) {
                 $type = '[Ping]';
             } else {
                 $type = '[Comment]';
             }
             if ($show_type) {
                 $output .= "<span style=\"font-size:90%\"> - {$type}</span>";
             }
         }
     }
     $output .= "\t</ul>\n</li>\n</ul>\n";
     return $output;
 }
Пример #19
0
                    comment_text();
                    if ("unapproved" == $comment_status) {
                        ?>
 		</span>
<?php 
                    }
                    ?>
		</li>
	<!-- /comment -->
<?php 
                }
                ?>
	</ol>
<?php 
            }
            if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                ?>
<h3><?php 
                echo _LANG_E_TITLE_LEAVECOM;
                ?>
</h3>
	<!-- form to add a comment -->
	<form action="<?php 
                echo $siteurl . '/wp-comments-post.php';
                ?>
" method="post">
		<input type="hidden" name="comment_post_ID" value="<?php 
                echo $wp_post_id;
                ?>
" />
		<input type="hidden" name="redirect_to" value="<?php 
$weekday[6] = _WP_CAL_SATURDAY;
// the months, translate them if necessary - note: this isn't active everywhere yet
global $month;
$month['01'] = _WP_CAL_JANUARY;
$month['02'] = _WP_CAL_FEBRUARY;
$month['03'] = _WP_CAL_MARCH;
$month['04'] = _WP_CAL_APRIL;
$month['05'] = _WP_CAL_MAY;
$month['06'] = _WP_CAL_JUNE;
$month['07'] = _WP_CAL_JULY;
$month['08'] = _WP_CAL_AUGUST;
$month['09'] = _WP_CAL_SEPTEMBER;
$month['10'] = _WP_CAL_OCTOBER;
$month['11'] = _WP_CAL_NOVEMBER;
$month['12'] = _WP_CAL_DECEMBER;
// here's the conversion table, you can modify it if you know what you're doing
global $wpsmiliestrans;
if (get_xoops_option('wordpress', 'wp_use_xoops_smilies')) {
    // Get smilies infomation from XOOPS DB
    $db =& Database::getInstance();
    $getsmiles = $db->query("SELECT id, code, smile_url FROM " . $db->prefix("smiles") . " ORDER BY id");
    if (($numsmiles = $db->getRowsNum($getsmiles)) == "0") {
        //EMPTY
    } else {
        while ($smiles = $db->fetchArray($getsmiles)) {
            $wpsmiliestrans[$smiles['code']] = $smiles['smile_url'];
        }
    }
} else {
    $wpsmiliestrans = array(' :)' => 'icon_smile.gif', ' :D' => 'icon_biggrin.gif', ' :-D' => 'icon_biggrin.gif', ':grin:' => 'icon_biggrin.gif', ' :)' => 'icon_smile.gif', ' :-)' => 'icon_smile.gif', ':smile:' => 'icon_smile.gif', ' :(' => 'icon_sad.gif', ' :-(' => 'icon_sad.gif', ':sad:' => 'icon_sad.gif', ' :o' => 'icon_surprised.gif', ' :-o' => 'icon_surprised.gif', ':eek:' => 'icon_surprised.gif', ' 8O' => 'icon_eek.gif', ' 8-O' => 'icon_eek.gif', ':shock:' => 'icon_eek.gif', ' :?' => 'icon_confused.gif', ' :-?' => 'icon_confused.gif', ' :???:' => 'icon_confused.gif', ' 8)' => 'icon_cool.gif', ' 8-)' => 'icon_cool.gif', ':cool:' => 'icon_cool.gif', ':lol:' => 'icon_lol.gif', ' :x' => 'icon_mad.gif', ' :-x' => 'icon_mad.gif', ':mad:' => 'icon_mad.gif', ' :P' => 'icon_razz.gif', ' :-P' => 'icon_razz.gif', ':razz:' => 'icon_razz.gif', ':oops:' => 'icon_redface.gif', ':cry:' => 'icon_cry.gif', ':evil:' => 'icon_evil.gif', ':twisted:' => 'icon_twisted.gif', ':roll:' => 'icon_rolleyes.gif', ':wink:' => 'icon_wink.gif', ' ;)' => 'icon_wink.gif', ' ;-)' => 'icon_wink.gif', ':!:' => 'icon_exclaim.gif', ':?:' => 'icon_question.gif', ':idea:' => 'icon_idea.gif', ':arrow:' => 'icon_arrow.gif', ' :|' => 'icon_neutral.gif', ' :-|' => 'icon_neutral.gif', ':neutral:' => 'icon_neutral.gif', ':mrgreen:' => 'icon_mrgreen.gif');
}
require_once wp_base() . '/wp-includes/class-xmlrpc.php';
require_once wp_base() . '/wp-includes/class-xmlrpcs.php';
require_once wp_base() . '/wp-includes/links.php';
if (empty($GLOBALS['cache_categories'][wp_id()]) || count($GLOBALS['cache_categories'][wp_id()]) == 0) {
    $GLOBALS['cache_categories'][wp_id()] = array();
    $categoryHandler =& wp_handler('Category');
    $categoryObjects =& $categoryHandler->getObjects();
    foreach ($categoryObjects as $categoryObject) {
        $catt = $categoryObject->exportWpObject();
        $GLOBALS['cache_categories'][wp_id()][$catt->cat_ID] = $catt;
    }
}
// We should eventually migrate to either calling
// get_settings() wherever these are needed OR
// accessing a single global $all_settings var
if (get_xoops_option(wp_mod(), 'wp_use_xoops_smilies')) {
    $GLOBALS['smilies_directory'] = XOOPS_URL . "/uploads";
} else {
    $GLOBALS['smilies_directory'] = get_settings('smilies_directory');
}
//WordPressプラグイン互換性確保用
$GLOBALS['siteurl'] = wp_siteurl();
update_option('siteurl', $GLOBALS['siteurl'], true);
$GLOBALS['querystring_start'] = '?';
$GLOBALS['querystring_equal'] = '=';
$GLOBALS['querystring_separator'] = '&amp;';
$GLOBALS['dateformat'] = stripslashes(get_settings('date_format'));
$GLOBALS['timeformat'] = stripslashes(get_settings('time_format'));
// Used to guarantee unique cookies
$GLOBALS['cookiehash'] = md5(wp_siteurl());
require wp_base() . '/wp-includes/vars.php';
    function block_style_get($echo = true, $with_tpl = true)
    {
        $wp_num = wp_id() == '-' ? '' : wp_id();
        if ($with_tpl) {
            if (get_xoops_option(wp_mod(), 'wp_use_blockcssheader') == 1) {
                $tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
                $csslink = "\n" . '<link rel="stylesheet" type="text/css" media="screen" href="' . wp_siteurl() . '/wp-blockstyle.php" />';
                if (array_key_exists('xoops_block_header', $tplVars)) {
                    if (!strstr($tplVars['xoops_block_header'], $csslink)) {
                        $GLOBALS['xoopsTpl']->assign('xoops_block_header', $tplVars['xoops_block_header'] . $csslink);
                    }
                } else {
                    $GLOBALS['xoopsTpl']->assign('xoops_block_header', $csslink);
                }
                return;
            } else {
                if (get_xoops_option(wp_mod(), 'wp_use_blockcssheader') == 2) {
                    $tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
                    $csslink = '" />' . "\n" . '<link rel="stylesheet" type="text/css" media="screen" href="' . wp_siteurl() . '/wp-blockstyle.php';
                    if (!strstr($tplVars['xoops_themecss'], $csslink)) {
                        $GLOBALS['xoopsTpl']->assign('xoops_themecss', $tplVars['xoops_themecss'] . $csslink);
                    }
                    return;
                } else {
                    if (!defined('WP_BLOCKSTYLE_READ' . $wp_num)) {
                        define('WP_BLOCKSTYLE_READ' . $wp_num, 1);
                        if ($echo) {
                            echo '<style type="text/css" media="screen">@import url(' . wp_siteurl() . '/wp-blockstyle.php);</style>' . "\n";
                        } else {
                            return '<style type="text/css" media="screen">@import url(' . wp_siteurl() . '/wp-blockstyle.php);</style>';
                        }
                    }
                    return '';
                }
            }
        }
        $wp_block_style = '';
        include_once get_custom_path('wp-blocks.css.php');
        if ($echo) {
            if (trim($wp_block_style) != "") {
                echo <<<EOD
<style type="text/css" media="screen">
    <!--
\t{$wp_block_style}
    -->
</style>
EOD;
            }
        } else {
            return trim($wp_block_style);
        }
    }
Пример #23
0
     foreach ($comments as $comment) {
         $author = apply_filters('comment_author', $comment->comment_author);
         if (empty($author)) {
             $author = 'Anonymous';
         }
         $echostring .= '<b>by ' . $author;
         $tmp = substr($comment->comment_date, 5, 2) . '/' . substr($comment->comment_date, 8, 2) . substr($comment->comment_date, 10, 6);
         $echostring .= '(' . $tmp . ')</b><br /><br />';
         $comment_text = str_replace('<trackback />', '', $comment->comment_content);
         $comment_text = str_replace('<pingback />', '', $comment_text);
         $echostring .= apply_filters('comment_text', $comment_text);
         $echostring .= '<hr />';
     }
 }
 if (defined('XOOPS_URL')) {
     if (!get_xoops_option(wp_mod(), 'wp_use_xoops_comments')) {
         $echostring .= '<a href="' . $myurl . '?view=comment&num=' . $num . '&p=' . $p . $ses_param . '">コメントする</a><br />';
     }
 } else {
     if (!get_option('comment_registration')) {
         $echostring .= '<a href="' . $myurl . '?view=comment&num=' . $num . '&p=' . $p . $ses_param . '">コメントする</a><br />';
     }
 }
 if ($comment_num > $start + $CommentPerPage) {
     $echostring .= $ackeychar[9] . '<a href="' . $myurl . '?view=comprev&start=' . ($start + $CommentPerPage) . '&num=' . $num . '&p=' . $p . $ses_param . '" accesskey="9">次の' . $CommentPerPage . '件のコメント &gt;</a><br/>';
 }
 if (0 <= $start - $CommentPerPage) {
     $echostring .= $ackeychar[7] . '<a href="' . $myurl . '?view=comprev&start=' . ($start - $CommentPerPage) . '&num=' . $num . '&p=' . $p . $ses_param . '" accesskey="9">前の' . $CommentPerPage . '件のコメント &gt;</a><br/>';
 }
 $echostring .= '<hr />';
 $echostring .= $ackeychar[0] . '<a href="' . $myurl . '?view=content&num=' . $num . '&p=' . $p . '&start=0' . $ses_param . '" accesskey="0">記事へ戻る</a><br/>';
// Change the prefix if you want to have multiple blogs in a single database.
global $xoopsDB, $xoopsUser, $wpdb;
$table_prefix = $xoopsDB->prefix('wp_');
// example: 'wp_' or 'b2' or 'mylogin_'
$server = WP_DB_HOST;
$loginsql = WP_DB_USER;
$passsql = WP_DB_PASSWORD;
$base = WP_DB_NAME;
$my_pingserver[0]['server'] = "rpc.weblogs.com";
$my_pingserver[0]['path'] = "/RPC2";
$my_pingserver[0]['port'] = 80;
//$my_pingserver[1]['server']="ping.bloggers.jp";
//$my_pingserver[1]['path']="/rpc/";
//$my_pingserver[1]['port']=80;
//$my_pingserver[2]['server']="ping.myblog.jp";
//$my_pingserver[2]['path']="/";
//$my_pingserver[2]['port']=80;
//$my_pingserver[3]['server']="bulkfeeds.net";
//$my_pingserver[3]['path']="/rpc";
//$my_pingserver[3]['port']=80;
$wp_use_spaw = true;
// Get everything else
require_once ABSPATH . 'wp-settings.php';
// Language File - example: 'wp-lang/lang_en.php'
require_once ABSPATH . 'wp-lang/lang_ja.php';
/* Stop editing */
if (get_xoops_option('wordpress', 'wp_use_spaw') == 1) {
    $wp_use_spaw = true;
} else {
    $wp_use_spaw = false;
}
 function b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     global $wpdb, $siteurl, $post, $use_cache, $category_cache, $comment_count_cache;
     global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace, $authordata;
     global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni, $wp_filter;
     global $wp_id, $wp_mod, $wp_base, $wp_inblock, $xoopsConfig, $previousday, $time_difference, $day;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 2;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     global $dateformat, $timeformat;
     $dateformat = stripslashes(get_settings('date_format'));
     $timeformat = stripslashes(get_settings('time_format'));
     $now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600);
     $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} ";
     $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) ";
     $request .= "WHERE post_status = 'publish' ";
     $request .= " AND post_date <= '" . $now . "'";
     $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}";
     $lposts = $wpdb->get_results($request);
     if ($lposts) {
         // Get the categories for all the posts
         foreach ($lposts as $post) {
             $post_id_list[] = $post->ID;
             $category_cache[$wp_id][$post->ID] = array();
         }
         $post_id_list = implode(',', $post_id_list);
         $dogs = $wpdb->get_results("SELECT DISTINCT\n\t\t\t\tID, category_id, cat_name, category_nicename, category_description, category_parent\n\t\t\t\tFROM {$wpdb->categories[$wp_id]}, {$wpdb->post2cat[$wp_id]}, {$wpdb->posts[$wp_id]}\n\t\t\t\tWHERE category_id = cat_ID AND post_id = ID AND post_id IN ({$post_id_list})");
         foreach ($dogs as $catt) {
             $category_cache[$wp_id][$catt->ID][] = $catt;
         }
         // Do the same for comment numbers
         $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount\n\t\t\t\tFROM {$wpdb->posts[$wp_id]}\n\t\t\t\tLEFT JOIN {$wpdb->comments[$wp_id]} ON ( comment_post_ID = ID  AND comment_approved =  '1')\n\t\t\t\tWHERE post_status =  'publish' AND ID IN ({$post_id_list})\n\t\t\t\tGROUP BY ID");
         foreach ($comment_counts as $comment_count) {
             $comment_count_cache[$wp_id]["{$comment_count->ID}"] = $comment_count->ccount;
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template');
     $block['style'] = block_style_get($wp_num, false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $previousday = 0;
     foreach ($lposts as $post) {
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($dateformat, '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             //
             ob_start();
             the_author_posts_link();
             $content['author'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_category();
             $content['category'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_content();
             $content['body'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             link_pages('<br />Pages: ', '<br />', 'number');
             $content['linkpage'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) {
                 comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             } else {
                 xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
                 echo " | ";
                 comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS);
             }
             //				comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             $content['comments'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             trackback_rdf();
             $content['trackback'] = ob_get_contents();
             ob_end_clean();
             //
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $previousday = 0;
     $day = 0;
     $comment_count_cache[$wp_id] = array();
     return $block;
 }
function block_style_get($wp_num, $echo = true, $with_tpl = true)
{
    if ($with_tpl) {
        if (get_xoops_option(wp_mod(), 'wp_use_blockcssheader')) {
            $tplVars =& $GLOBALS['xoopsTpl']->get_template_vars();
            $csslink = "\n<link rel='stylesheet' type='text/css' media='screen' href='" . XOOPS_URL . "/modules/wordpress" . $wp_num . "/wp-blockstyle.php' />";
            if (array_key_exists('xoops_block_header', $tplVars)) {
                if (!strstr($tplVars['xoops_block_header'], $csslink)) {
                    $GLOBALS['xoopsTpl']->assign('xoops_block_header', $tplVars['xoops_block_header'] . $csslink);
                }
            } else {
                $GLOBALS['xoopsTpl']->assign('xoops_block_header', $csslink);
            }
            return;
        }
    }
    if (file_exists(XOOPS_ROOT_PATH . '/modules/wordpress' . $wp_num . '/themes/' . $GLOBALS['xoopsConfig']['theme_set'] . '/wp-blocks.css.php')) {
        $themes = $GLOBALS['xoopsConfig']['theme_set'];
    } else {
        $themes = "default";
    }
    $wp_block_style = "";
    include_once XOOPS_ROOT_PATH . "/modules/wordpress" . $wp_num . "/themes/" . $themes . "/wp-blocks.css.php";
    if ($echo) {
        if (trim($wp_block_style) != "") {
            echo <<<EOD
<style type="text/css" media="screen">
    <!--
{$wp_block_style}
    -->
</style>
EOD;
        }
    } else {
        return trim($wp_block_style);
    }
}
    }
    $wp_id = "{$regs['1']}";
}
if ($wp_id === "") {
    $table_prefix["-"] = $xoopsDB->prefix("wp_");
    $wp_id = "-";
} else {
    $table_prefix[$wp_id] = $xoopsDB->prefix("wp{$wp_id}_");
}
$server = WP_DB_HOST;
$loginsql = WP_DB_USER;
$passsql = WP_DB_PASSWORD;
$base = WP_DB_NAME;
// Get everything else
require 'wp-settings.php';
// Language File
if (!defined('_LANGCODE')) {
    define("_LANGCODE", "en");
}
if (file_exists(ABSPATH . "wp-lang/lang_" . _LANGCODE . ".php")) {
    require_once ABSPATH . "wp-lang/lang_" . _LANGCODE . ".php";
} else {
    require_once ABSPATH . "wp-lang/lang_en.php";
}
if (!$wp_inblock) {
    if (get_xoops_option($wp_dir, 'wp_use_spaw') == 1) {
        $wp_use_spaw = true;
    } else {
        $wp_use_spaw = false;
    }
}
</div>
	
	<div class="storycontent">
		<?php 
        the_content();
        ?>
		<br clear="left" />
	</div>
	
	<div class="feedback">
		<?php 
        link_pages('<br />Pages: ', '<br />', 'number');
        ?>
 
<?php 
        if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) {
            comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
        } else {
            xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
            echo " | ";
            comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS);
        }
        ?>
	</div>
	
	<!--
	<?php 
        trackback_rdf();
        ?>
	-->