Пример #1
0
 /**
  * For comments that were handled by WordPress normally (not our code), check if the author 
  * registered with OpenID and set comment openid flag if so.
  *
  * @action post_comment
  */
 function check_author_openid($comment_ID)
 {
     $comment = get_comment($comment_ID);
     if ($comment->user_id && !$comment->openid && is_user_openid($comment->user_id)) {
         $this->set_comment_openid($comment_ID);
     }
 }
Пример #2
0
 /**
  * Print jQuery call for slylizing profile link.
  *
  * @action: comment_form
  **/
 function comment_profilelink()
 {
     if (is_user_openid()) {
         echo '<script type="text/javascript">stylize_profilelink()</script>';
     }
 }
Пример #3
0
//admin pretends that he is a user
if (is_logged() && in_array(PERM_ADMIN, $_SESSION['user_groups']) && isset($_GET['pretend']) && ($pretend = $_GET['pretend'])) {
    if ($pretend == 'on') {
        $_SESSION['noadmin'] = 1;
    } elseif ($pretend == 'off') {
        unset($_SESSION['noadmin']);
    }
    header("Location:" . $_SERVER['HTTP_REFERER']);
    exit;
}
//some globals
$smarty->assign('yandex_metrika_counter_id', $config['web']['yandex_metrika_counter_id']);
$smarty->assign('is_admin', is_admin() ? 1 : 0);
$smarty->assign('is_logged', is_logged() ? 1 : 0);
if (is_logged()) {
    $smarty->assign('is_openid', is_user_openid($_SESSION['user_id']) ? 1 : 0);
}
$smarty->assign('user_permission_dict', user_has_permission(PERM_DICT) ? 1 : 0);
$smarty->assign('user_permission_disamb', user_has_permission(PERM_DISAMB) ? 1 : 0);
$smarty->assign('user_permission_adder', user_has_permission(PERM_ADDER) ? 1 : 0);
$smarty->assign('user_permission_check_tokens', user_has_permission(PERM_CHECK_TOKENS) ? 1 : 0);
$smarty->assign('user_permission_check_morph', user_has_permission(PERM_MORPH_MODER) ? 1 : 0);
$smarty->assign('user_permission_merge', user_has_permission(PERM_MORPH_SUPERMODER) ? 1 : 0);
$smarty->assign('user_permission_syntax', user_has_permission(PERM_SYNTAX) ? 1 : 0);
$smarty->assign('user_permission_check_syntax', user_has_permission(PERM_SYNTAX_MODER) ? 1 : 0);
$smarty->assign('readonly', file_exists($config['project']['readonly_flag']) ? 1 : 0);
$smarty->assign('goals', $config['goals']);
$smarty->assign('game_is_on', 0);
//$smarty->configLoad(__DIR__.'/../templates/achievements/titles.conf', NULL);
// smarty->configLoad is a piece of shit which can not handle multiple sections at once.
// reverting to something much simplier.
Пример #4
0
/**
 * Print jQuery call for slylizing profile link.
 *
 * @action: comment_form
 **/
function openid_comment_profilelink()
{
    global $wp_scripts;
    if ((is_single() || is_comments_popup()) && is_user_openid() && $wp_scripts->query('openid')) {
        echo '<script type="text/javascript">stylize_profilelink()</script>';
    }
}
Пример #5
0
function user_change_email($post)
{
    $r = sql_fetch_array(sql_query("SELECT user_name FROM users WHERE user_id = " . $_SESSION['user_id'] . " LIMIT 1"));
    $login = $r['user_name'];
    $email = strtolower(trim($post['email']));
    if (is_user_openid($_SESSION['user_id']) || user_check_password($login, $post['passwd'])) {
        if (is_valid_email($email)) {
            $res = sql_pe("SELECT user_id FROM users WHERE user_email=? LIMIT 1", array($email));
            if (sizeof($res) > 0) {
                return 4;
            }
            sql_pe("UPDATE `users` SET `user_email`=? WHERE `user_id`=? LIMIT 1", array($email, $_SESSION['user_id']));
            return 1;
        } else {
            return 3;
        }
    } else {
        return 2;
    }
}
Пример #6
0
/**
 * Print jQuery call for slylizing profile link.
 *
 * @action: comment_form
 **/
function openid_comment_profilelink()
{
    global $nxt_scripts;
    if (comments_open() && is_user_openid() && $nxt_scripts->query('openid')) {
        echo '<script type="text/javascript">stylize_profilelink()</script>';
    }
}
Пример #7
0
 /**
  * For comments that were handled by WordPress normally (not our code), check if the author
  * registered with OpenID and set comment openid flag if so.
  *
  * @action post_comment
  */
 function check_author_openid($comment_ID)
 {
     global $openid;
     $comment = get_comment($comment_ID);
     if ($comment->user_id && !$comment->openid && is_user_openid($comment->user_id)) {
         WordPressOpenID_Logic::set_comment_openid($comment_ID);
     }
 }
Пример #8
0
function social_networking_profile($author_name = '')
{
    global $social_netoworking_default_fields, $wpdb, $user_ID, $user_login, $social_networking_normalized_urls;
    $social_networking_normalized_urls = array();
    $curauth = social_networking_get_page_author();
    $social_networking_profile = explode(',', get_option('social_networking_profile_public') ? get_settings('social_networking_profile_public') : 'display_name,nickname,full_name,user_url,description');
    get_currentuserinfo();
    if ($user_level > 9 || function_exists('is_user_openid') && class_exists('WordpressOpenIDRegistration') && is_user_openid()) {
        //only allow authing on OpenID users
        $tmp = array();
        if ($user_level < 10) {
            foreach ($wpdb->get_results("SELECT link_url FROM {$wpdb->links} WHERE link_owner={$curauth->ID} AND (link_rel LIKE '%friend%' OR link_rel LIKE '%me%')") as $link) {
                social_networking_get_normalized_urls($link->link_url);
            }
            //end foreach SQL...
        }
        //end if user_level < 10
        $userlogin = $user_login;
        if (is_int($userlogin[strlen($userlogin) - 1])) {
            unset($userlogin[strlen($userlogin) - 1]);
        }
        if ($user_level > 9 || in_array($user_login, $social_networking_normalized_urls)) {
            $social_networking_profile = explode(',', get_option('social_networking_profile_private') ? get_settings('social_networking_profile_private') : 'display_name,nickname,full_name,user_url,description,user_email,jabber,aim,yim');
        }
    }
    //end if openid
    //echo hCard
    echo '<div class="vcard">' . "\n";
    if (in_array('display_name', $social_networking_profile)) {
        echo '   <div class="style-fn">Display Name: <span class="fn">' . htmlentities($curauth->display_name) . '</span></div>' . "\n";
    }
    if (in_array('nickname', $social_networking_profile)) {
        echo '   <div class="style-nickname">Nickname: <span class="nickname">' . htmlentities($curauth->nickname) . '</span></div>' . "\n";
    }
    if (in_array('full_name', $social_networking_profile)) {
        echo '   <div class="style-n">Full Name: <span class="n"><span class="given-name">' . htmlentities($curauth->first_name) . '</span> <span class="family-name">' . htmlentities($curauth->last_name) . '</span></span></div>' . "\n";
    }
    if ($curauth->user_email && in_array('user_email', $social_networking_profile)) {
        echo '   <div class="style-email">Email: <a class="email" href="mailto:' . htmlentities($curauth->user_email) . '">' . htmlentities($curauth->user_email) . '</a></div>' . "\n";
    }
    if ($curauth->user_url && in_array('user_url', $social_networking_profile)) {
        echo '   <div class="style-url">URL: <a class="url" href="' . htmlentities($curauth->user_url) . '">' . htmlentities($curauth->user_url) . '</a></div>' . "\n";
    }
    if ($curauth->description && in_array('description', $social_networking_profile)) {
        echo '   <div class="style-note">Description: <span class="note">' . htmlentities($curauth->description) . '</span></div>' . "\n";
    }
    if ($curauth->jabber && in_array('jabber', $social_networking_profile)) {
        echo '   <div class="style-jabber">Jabber: <a class="url" href="xmpp:' . htmlentities($curauth->jabber) . '">' . htmlentities($curauth->jabber) . '</a></div>' . "\n";
    }
    if ($curauth->aim && in_array('aim', $social_networking_profile)) {
        echo '   <div class="style-aim">AIM: <a class="url" href="aim:goim?screenname=' . htmlentities($curauth->aim) . '">' . htmlentities($curauth->aim) . '</a></div>' . "\n";
    }
    if ($curauth->yim && in_array('yim', $social_networking_profile)) {
        echo '   <div class="style-yim">Y!IM: <a class="url" href="ymsgr:sendIM?' . htmlentities($curauth->yim) . '">' . htmlentities($curauth->yim) . '</a></div>' . "\n";
    }
    foreach ($social_networking_profile as $field) {
        if (in_array($field, $social_netoworking_default_fields)) {
            continue;
        }
        $field = strtolower($field);
        $label = str_replace('_', ' ', $field);
        $label[0] = strtoupper($label[0]);
        echo '   <div class="style-' . $field . '">' . $label . ': <span class="' . $field . '">' . $curauth->{$field} . '</span></div>' . "\n";
    }
    //end foreach
    echo '</div>' . "\n";
}