本文整理汇总了PHP中get_xoops_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_xoops_option函数的具体用法?PHP get_xoops_option怎么用?PHP get_xoops_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_xoops_option函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: veriflog
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 = " . $xoopsDB->quoteString($xoopsUser->getVar('uname')) . " 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 = '{$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;
}
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:60,代码来源:auth.php
示例2: comments_popup_link
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'] . '&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);
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:54,代码来源:template-functions-comment.php
示例3: comments_popup_link
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 . '&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>';
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:44,代码来源:template-functions-comment.php
示例4: auto_upgrade
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 = '&';
}
// 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)) {
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-settings.php
示例5: insert
/**
* レコードの保存
*
* @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);
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:41,代码来源:wp_users.php
示例6: block_style_get
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);
}
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:44,代码来源:functions.php
示例7: array
}
} 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
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:vars.php
示例8: b_wp_contents_show
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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:96,代码来源:wp_contents.php
示例9: tkzy_get_recent_comments
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 . '&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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:68,代码来源:wp_recent_comments.php
示例10: insert
/**
* レコードの保存
*
* @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);
}
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:48,代码来源:wp_users.php
示例11: veriflog
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 = " . $xoopsDB->quoteString($xoopsUser->getVar('uname')) . " 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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:32,代码来源:admin-functions.php
示例12: _b_wp_contents_show
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) {
//.........这里部分代码省略.........
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:101,代码来源:wp_contents.php
示例13: _b_wp_contents_show
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;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:93,代码来源:wp_contents.php
示例14: gethelp_link
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();
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:admin-header.php
示例15: b_wp_recent_comments_show
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);
}
|
请发表评论