Esempio n. 1
0
 function _getposteddata()
 {
     $arr['version'] = system_ver();
     $arr['subject'] = $_POST['subject'];
     $arr['content'] = $_POST['content'];
     $author = user_get();
     $arr['author'] = $author['userid'];
     $arr['date'] = !empty($_POST['timestamp']) ? $_POST['timestamp'] : date_time();
     $cats = !empty($_POST['cats']) ? $_POST['cats'] : array();
     $flags = !empty($_POST['flags']) ? $_POST['flags'] : array();
     //$arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
     return $arr;
 }
Esempio n. 2
0
function save()
{
    $username = $_POST['email'];
    $password = MD5(trim($_POST['password']));
    include 'model/user.php';
    $results = user_get(array('email' => $username, 'password' => $password));
    if ($results) {
        $_SESSION["username"] = $username;
        header("Location: home.php");
        exit;
    }
    echo "Login failed. Please try again";
}
Esempio n. 3
0
function save()
{
    $params = array();
    $params['comment'] = $_POST['comment'];
    $params['create_date'] = date('Y-m-d H:i:s');
    $params['discussion_id'] = $_GET['id'];
    include 'model/user.php';
    $arrUser = user_get(array('email' => $_SESSION['username']));
    $params['user_id'] = $arrUser[0]['user_id'];
    comment_post($params);
    $url = $_SERVER['REQUEST_URI'];
    header("Location: " . $url);
    exit;
}
Esempio n. 4
0
function save()
{
    $params = array();
    $params['message'] = $_POST['message'];
    $params['title'] = $_POST['title'];
    $params['create_date'] = date('Y-m-d H:i:s');
    include 'model/user.php';
    $arrUser = user_get(array('email' => $_SESSION['username']));
    $params['user_id'] = $arrUser[0]['user_id'];
    include 'model/discussion.php';
    $id = discussion_post($params);
    header("Location: discussion.php?id=" . $id);
    exit;
}
Esempio n. 5
0
function shared_entry_form_onsubmit()
{
    $arr['version'] = system_ver();
    $arr['subject'] = stripslashes($_POST['subject']);
    $arr['content'] = stripslashes($_POST['content']);
    $author = user_get();
    $arr['author'] = $author['NAME'];
    $arr['date'] = !empty($_POST['timestamp']) ? $_POST['timestamp'] : time();
    $cats = !empty($_POST['cats']) ? $_POST['cats'] : array();
    $flags = !empty($_POST['flags']) ? $_POST['flags'] : array();
    $arr['categories'] = array_merge(array_keys($flags), array_keys($cats));
    //sess_add('entry', $arr);
    return $arr;
}
Esempio n. 6
0
function reg_save()
{
    global $smarty;
    $email = @$_POST['email'];
    $pass = @$_POST['loginpass'];
    $pass2 = @$_POST['loginpass2'];
    if ($pass == '' || $email == '') {
        reg_main(_('Please enter email and password'));
        return false;
    }
    if (strpos($email, '@') == false || strpos($email, '.') == false) {
        reg_main(_('Invalid email address'));
        return false;
    }
    if ($pass != $pass2) {
        reg_main(_('Password does not match'));
        return false;
    }
    if (recaptcha_verify() !== true) {
        reg_main(_('The CAPTCHA you enter is not correct'));
        return false;
    }
    if (INVITECODE_ENABLED == 1 && reg_checkinvite(@$_POST['invitecode']) == false) {
        reg_main(_('The invite code is invalid or have been used'));
        return false;
    }
    $ret = user_add($email, $pass);
    if ($ret !== true) {
        reg_main("<p>{$ret}</p>" . _('<p>Register fail, please contact us for help if you need.</p>'));
        return false;
    }
    $user = user_get($email);
    if (INVITECODE_ENABLED == 1) {
        invite_use($_POST['invitecode'], $user['id']);
    }
    user_online($email);
    $smarty->assign('tip_title', _('Register successed'));
    $smarty->assign('tip_msg', _('You have registerd successfully'));
    $smarty->assign('redirect_url', 'account.php');
    $smarty->display('tip.html');
}
Esempio n. 7
0
function user_loggedin()
{
    global $loggedin, $fp_user;
    if ($loggedin) {
        return $fp_user;
    }
    if (empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE])) {
        $fp_user = null;
        return $loggedin = false;
    }
    $fp_user = user_get($_COOKIE[USER_COOKIE]);
    if (!$fp_user) {
        return false;
    }
    if ($_COOKIE[PASS_COOKIE] == $fp_user['password']) {
        $loggedin = true;
        return $fp_user;
    }
    $fp_user = null;
    $loggedin = false;
    return false;
}
Esempio n. 8
0
            }
            if ($valid) {
                if ($admin_edit === true) {
                    header_redirect("admin_user.php?webtag={$webtag}&uid={$profile_uid}&profile_updated=true");
                    exit;
                } else {
                    header_redirect("edit_profile.php?webtag={$webtag}&uid={$profile_uid}&profile_updated=true");
                    exit;
                }
            }
        }
    }
}
if (is_array($profile_items_array) && sizeof($profile_items_array) > 0) {
    if ($admin_edit === true) {
        $user = user_get($profile_uid);
        html_draw_top(array('title' => sprintf(gettext('Admin - Edit Profile - %s'), format_user_name($user['LOGON'], $user['NICKNAME'])), 'class' => 'window_title', 'js' => array('js/prefs.js')));
        echo "<h1>", gettext("Admin"), html_style_image('separator'), gettext("Manage User"), html_style_image('separator'), format_user_name($user['LOGON'], $user['NICKNAME']), "</h1>\n";
    } else {
        html_draw_top(array('title' => gettext("My Controls - Edit Profile"), 'class' => 'window_title'));
        echo "<h1>", gettext("Edit Profile"), "</h1>\n";
    }
    if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
        html_display_error_array($error_msg_array, '700', $admin_edit ? 'center' : 'left');
    } else {
        if (isset($_GET['profile_updated'])) {
            html_display_success_msg(gettext("Profile updated."), '700', $admin_edit ? 'center' : 'left');
        }
    }
    if ($admin_edit === true) {
        echo "<div align=\"center\">\n";
Esempio n. 9
0
function remindme($lang)
{
    $with_name = true;
    $with_captcha = true;
    $action = 'init';
    if (isset($_POST['remindme_send'])) {
        $action = 'remindme';
    }
    $login = $confirmed = $code = $token = false;
    if (!empty($_SESSION['login'])) {
        $login = $_SESSION['login'];
    } else {
        if (!empty($_SESSION['user']['name'])) {
            $login = $_SESSION['user']['name'];
        } else {
            if (!empty($_SESSION['user']['mail'])) {
                $login = $_SESSION['user']['mail'];
            }
        }
    }
    switch ($action) {
        case 'remindme':
            if (isset($_POST['remindme_login'])) {
                $login = strtolower(strflat(readarg($_POST['remindme_login'])));
            }
            if (isset($_POST['remindme_confirmed'])) {
                $confirmed = readarg($_POST['remindme_confirmed']) == 'on' ? true : false;
            }
            if (isset($_POST['remindme_code'])) {
                $code = readarg($_POST['remindme_code']);
            }
            if (isset($_POST['remindme_token'])) {
                $token = readarg($_POST['remindme_token']);
            }
            break;
        default:
            break;
    }
    $missing_code = false;
    $bad_code = false;
    $bad_token = false;
    $missing_login = false;
    $bad_login = false;
    $missing_confirmation = false;
    $email_sent = false;
    $user_page = false;
    $internal_error = false;
    $contact_page = false;
    switch ($action) {
        case 'remindme':
            if (!isset($_SESSION['remindme_token']) or $token != $_SESSION['remindme_token']) {
                $bad_token = true;
            }
            if ($with_captcha) {
                if (!$code) {
                    $missing_code = true;
                    break;
                }
                $captcha = isset($_SESSION['captcha']['remindme']) ? $_SESSION['captcha']['remindme'] : false;
                if (!$captcha or $captcha != strtoupper($code)) {
                    $bad_code = true;
                    break;
                }
            }
            if (!$login) {
                $missing_login = true;
            } else {
                if ((!validate_user_name($login) or !is_user_name_allowed($login)) and (!validate_mail($login) or !is_mail_allowed($login))) {
                    $bad_login = true;
                }
            }
            if (!$confirmed) {
                $missing_confirmation = true;
            }
            break;
        default:
            break;
    }
    switch ($action) {
        case 'remindme':
            if ($bad_token or $missing_code or $bad_code or $missing_login or $bad_login or $missing_confirmation) {
                break;
            }
            require_once 'models/user.inc';
            $user_id = user_find($login);
            if (!$user_id) {
                $bad_login = true;
                require_once 'log.php';
                write_log('password.err', substr($login, 0, 40));
                break;
            }
            $user = user_get($user_id);
            if (!$user) {
                $internal_error = true;
                break;
            }
            if (!$user['user_active'] or $user['user_banned']) {
                $bad_login = true;
                break;
            }
            require_once 'newpassword.php';
            $newpassword = newpassword();
            if (!user_set_newpassword($user_id, $newpassword)) {
                $internal_error = true;
                break;
            }
            require_once 'emailcrypto.php';
            global $sitename, $webmaster;
            $to = $user['user_mail'];
            $subject = translate('email:new_password_subject', $lang);
            $msg = translate('email:new_password_text', $lang) . "\n\n" . translate('email:salutations', $lang);
            if (!emailcrypto($msg, $newpassword, $to, $subject, $webmaster)) {
                $internal_error = true;
            } else {
                $email_sent = $to;
            }
            $confirmed = false;
            break;
        default:
            break;
    }
    if ($internal_error) {
        $contact_page = url('contact', $lang);
    } else {
        if ($email_sent) {
            $user_page = url('user', $lang);
        }
    }
    $_SESSION['remindme_token'] = $token = token_id();
    $errors = compact('missing_login', 'bad_login', 'missing_confirmation', 'missing_code', 'bad_code', 'internal_error', 'contact_page');
    $infos = compact('email_sent', 'user_page');
    $output = view('remindme', $lang, compact('token', 'with_captcha', 'with_name', 'login', 'confirmed', 'errors', 'infos'));
    return $output;
}
Esempio n. 10
0
$peer_user_display = format_user_name($user_peer['LOGON'], $user_peer['NICKNAME']);
html_draw_top(array('title' => sprintf(gettext('User Relationship - %s'), $peer_user_display), 'class' => 'window_title'));
$peer_relationship = user_get_relationship($_SESSION['UID'], $peer_uid);
$peer_nickname = user_get_peer_nickname($_SESSION['UID'], $peer_uid);
echo "<h1>", gettext("User Relationship"), html_style_image('separator'), "<a href=\"user_profile.php?webtag={$webtag}&amp;uid={$peer_uid}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags($peer_user_display, true), "</a></h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '600', 'left');
} else {
    if ($peer_perms & USER_PERM_FOLDER_MODERATE && !session::check_perm(USER_PERM_CAN_IGNORE_ADMIN, 0)) {
        html_display_warning_msg(gettext("You cannot ignore this user, as they are a moderator."), '600', 'left');
    }
}
if (isset($_POST['preview_signature'])) {
    if (($t_sig_content = user_get_sig($peer_uid)) !== false) {
        $preview_message['RECIPIENTS'] = array();
        $preview_from_user = user_get($peer_uid);
        $preview_message['FROM_LOGON'] = $preview_from_user['LOGON'];
        $preview_message['FROM_NICKNAME'] = $preview_from_user['NICKNAME'];
        $preview_message['FROM_UID'] = $preview_from_user['UID'];
        $preview_message['CONTENT'] = gettext("Signature Preview");
        $preview_message['CONTENT'] .= "<div class=\"sig\">" . fix_html($t_sig_content) . "</div>";
        $preview_message['CREATED'] = time();
        echo "  <br />\n";
        echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
        echo "    <tr>\n";
        echo "      <td align=\"left\">\n";
        echo "        <table class=\"box\" width=\"100%\">\n";
        echo "          <tr>\n";
        echo "            <td align=\"left\" class=\"posthead\">\n";
        echo "              <table class=\"posthead\" width=\"100%\">\n";
        echo "                <tr>\n";
Esempio n. 11
0
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'getQqGroup') {
    $account_qq = qq_get();
    $qq = intval($_GET['qq']);
    $qqgroup = qqGroup_get($qq);
    //指定qq下的Q群
    $account_qq = qq_get();
    $smarty->assign('account_qq', $account_qq);
    $smarty->assign('qq_group', $qqgroup);
    $res['main'] = $smarty->fetch('account_qqgroup.htm');
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'add_qqgroup') {
    $account_qq = qq_get();
    $department = department_get();
    //获取部门
    $user_name = user_get();
    //Q群使用者
    $smarty->assign('account_qq', $account_qq);
    $smarty->assign('department', $department);
    $res['main'] = $smarty->fetch('add_qqqroup.htm');
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'insert_qqgroup') {
    $qq = mysql_real_escape_string($_REQUEST['qq']);
    //所属QQ
    $qqgroup = mysql_real_escape_string($_REQUEST['qqgroup']);
    //Q群帐号
    $subject = mysql_real_escape_string($_REQUEST['subject']);
    //主题
    $strAdmin = mysql_real_escape_string($_REQUEST['strAdmin']);
    //Q管理员列表
    $department_id = intval($_REQUEST['departmentID']);
Esempio n. 12
0
    } else {
        $back = "lthread_list.php?webtag={$webtag}";
    }
}
light_html_draw_top(array('title' => gettext('Post message'), 'js' => array('js/fineuploader.min.js', 'js/attachments.js')));
light_navigation_bar(array('back' => $back));
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    light_html_display_error_array($error_msg_array);
}
if (!$new_thread && isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
    light_html_display_warning_msg(gettext("Warning: this thread is closed for posting to normal users."));
}
if ($valid && isset($_POST['preview'])) {
    echo "<h3>", gettext("Message Preview"), "</h3>";
    $preview_message['RECIPIENTS'] = $to_logon_array;
    $preview_fuser = user_get($_SESSION['UID']);
    $preview_message['FROM_LOGON'] = $preview_fuser['LOGON'];
    $preview_message['FROM_NICKNAME'] = $preview_fuser['NICKNAME'];
    $preview_message['FROM_UID'] = $preview_fuser['UID'];
    $preview_message['CONTENT'] = $content;
    if ($allow_sig == true && strlen(trim($sig)) > 0) {
        $preview_message['CONTENT'] = $preview_message['CONTENT'] . "<div class=\"sig\">" . $sig . "</div>";
    }
    $preview_message['CREATED'] = time();
    $preview_message['ATTACHMENTS'] = $attachments;
    light_message_display(0, $preview_message, 0, 0, 0, false, false, false, false, true);
}
if (!$new_thread) {
    if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
        light_html_display_warning_msg(gettext("This thread is closed, you cannot post in it!"));
    }
Esempio n. 13
0
            }
            if ($valid) {
                if ($admin_edit === true) {
                    header_redirect("admin_user.php?webtag={$webtag}&uid={$uid}&profile_updated=true", gettext("Profile updated."));
                    exit;
                } else {
                    header_redirect("edit_profile.php?webtag={$webtag}&uid={$uid}&profile_updated=true", gettext("Profile updated."));
                    exit;
                }
            }
        }
    }
}
if (is_array($profile_items_array) && sizeof($profile_items_array) > 0) {
    if ($admin_edit === true) {
        $user = user_get($uid);
        html_draw_top(sprintf('title=%s', sprintf(gettext("Admin - Edit Profile - %s"), format_user_name($user['LOGON'], $user['NICKNAME']))), 'class=window_title');
        echo "<h1>", gettext("Admin"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", gettext("Edit Profile"), "<img src=\"", html_style_image('separator.png'), "\" alt=\"\" border=\"0\" />", format_user_name($user['LOGON'], $user['NICKNAME']), "</h1>\n";
    } else {
        html_draw_top(sprintf('title=%s', gettext("My Controls - Edit Profile")), 'class=window_title');
        echo "<h1>", gettext("Edit Profile"), "</h1>\n";
    }
    if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
        html_display_error_array($error_msg_array, '600', $admin_edit ? 'center' : 'left');
    } else {
        if (isset($_GET['profile_updated'])) {
            html_display_success_msg(gettext("Profile updated."), '600', $admin_edit ? 'center' : 'left');
        }
    }
    if ($admin_edit === true) {
        echo "<div align=\"center\">\n";
Esempio n. 14
0
<?php

require_once 'includes/db.php';
require_once 'includes/users.php';
$errors = array();
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'password', FILTER_UNSAFE_RAW);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (empty($username)) {
        $errors['username'] = true;
    }
    if (empty($password)) {
        $errors['password'] = true;
    }
    if (empty($errors)) {
        $user_id = user_get($db, $username, $password);
        if ($user_id) {
            user_sign_in($user_id);
            // redirect back to the page they came from
            header('location: ' . $_SESSION['referrer']);
            exit;
        } else {
            $errors['no-user'] = true;
        }
    }
}
?>
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
Esempio n. 15
0
                exit;
            } else {
                $error_msg_array[] = gettext("Could not save message. Make sure you have enough available free space.");
                $valid = false;
            }
        }
    }
}
light_html_draw_top(sprintf("title=%s", gettext("Send New PM")), "robots=noindex,nofollow");
// preview message
if ($valid && isset($_POST['preview'])) {
    echo "<h3>", gettext("Message Preview"), "</h3>\n";
    $pm_preview_array['TLOGON'] = $t_new_recipient_array['LOGON'];
    $pm_preview_array['TNICK'] = $t_new_recipient_array['NICK'];
    $pm_preview_array['TO_UID'] = $t_new_recipient_array['TO_UID'];
    $preview_fuser = user_get($uid);
    $pm_preview_array['FLOGON'] = $preview_fuser['LOGON'];
    $pm_preview_array['FNICK'] = $preview_fuser['NICKNAME'];
    $pm_preview_array['FROM_UID'] = $preview_fuser['UID'];
    $pm_preview_array['SUBJECT'] = $t_subject;
    $pm_preview_array['CREATED'] = time();
    $pm_preview_array['AID'] = $aid;
    $pm_preview_array['CONTENT'] = $t_content;
    light_pm_display($pm_preview_array, PM_FOLDER_OUTBOX, true);
}
echo "<form accept-charset=\"utf-8\" name=\"f_post\" action=\"lpm_write.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
echo "  ", form_input_hidden('folder', htmlentities_array($folder)), "\n";
echo "  ", form_input_hidden("t_dedupe", htmlentities_array($t_dedupe));
echo "<div class=\"post\">\n";
echo "<h3>", gettext("Send New PM"), "</h3>\n";
Esempio n. 16
0
function html_email_confirmation_error()
{
    if (($uid = session::get_value('UID')) === false) {
        return;
    }
    $user_array = user_get($uid);
    html_draw_error(gettext("Email confirmation is required before you can post. If you have not received a confirmation email please click the button below and a new one will be sent to you. If your email address needs changing please do so before requesting a new confirmation email. You may change your email address by click My Controls above and then User Details"), 'confirm_email.php', 'get', array('resend' => gettext("Resend Confirmation")), array('uid' => $user_array['UID'], 'resend' => 'Y'), sprintf("title=%s", gettext("Email confirmation required")), "robots=noindex,nofollow");
}
Esempio n. 17
0
    }
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_radio("to_radio", "friends", gettext("Friends"), isset($to_radio) && $to_radio == "friends"), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_dropdown_array("t_to_uid", $friends_array, isset($t_to_uid) ? $t_to_uid : 0, "", "friends_dropdown"), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_radio("to_radio", "others", gettext("Others"), isset($to_radio) && $to_radio == "others" ? true : !isset($to_radio)), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\" style=\"white-space: nowrap\">", form_input_text_search("t_to_uid_others", isset($t_to_uid_others) ? htmlentities_array($t_to_uid_others) : "", false, false, SEARCH_LOGON, true, sprintf('title="%s"', gettext("Separate recipients by semi-colon or comma")), "post_to_others"), "</td>\n";
    echo "                      </tr>\n";
} else {
    if (isset($_GET['uid']) && is_numeric($_GET['uid'])) {
        $to_user = user_get($_GET['uid']);
        $t_to_uid_others = $to_user['LOGON'];
    }
    echo "                      <tr>\n";
    echo "                        <td align=\"left\" style=\"white-space: nowrap\">", form_input_text_search("t_to_uid_others", isset($t_to_uid_others) ? htmlentities_array($t_to_uid_others) : "", false, false, SEARCH_LOGON, true, sprintf('title="%s"', gettext("Separate recipients by semi-colon or comma")), "post_to_others"), "</td>\n";
    echo "                      </tr>\n";
}
if (!is_array($friends_array) && forum_check_webtag_available($webtag)) {
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">&nbsp;</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\"><h2>", gettext("Hint"), "</h2><span class=\"smalltext\">", gettext("Add users to your friends list to have them appear in a drop down on the PM Write Message Page."), "</span></td>\n";
    echo "                      </tr>\n";
}
echo "                      <tr>\n";
Esempio n. 18
0
     foreach ($arr_belong_name as $val) {
         $account_info['belong'] .= '<span name="' . $val['user_id'] . '" id="' . $val['user_id'] . '"><img src="images/0.gif" onclick="delBelong(this)">' . $val['user_name'] . '</span>';
     }
 }
 $res['code'] = 0;
 if ($account_info) {
     $res['code'] = 1;
 }
 $smarty->assign('account_info', $account_info);
 $type = type_get();
 //获取帐号类型
 $department = product_get();
 //获取部门
 $passwordprotect = get_passwordprotect();
 //密码保护
 $user = user_get();
 //帐号的使用者
 $admin = $_SESSION['admin_name'];
 //提交者
 $subject = product_get();
 $sql_select = 'SELECT * FROM ' . $GLOBALS['ecs']->table('account_purpose');
 $smarty->assign('purpose', $GLOBALS['db']->getAll($sql_select));
 $smarty->assign('user', $user);
 $smarty->assign('department', $department);
 $smarty->assign('type', $type);
 $smarty->assign('passwordprotect', $passwordprotect);
 $smarty->assign('subject', $subject);
 $smarty->assign('role_list', get_role());
 $smarty->assign('modify_do', 1);
 $smarty->assign('admin_id', $_SESSION['admin_id']);
 $smarty->assign('subject', $subject);
Esempio n. 19
0
$r = user_create($name, $password, $mail, $locale, $website);
dump($r);
$user_id = user_find($name);
dump($user_id);
if (!$user_id) {
    exit;
}
$r = user_id($user_id);
dump($r);
$r = user_get($user_id);
dump($r);
$mail = '*****@*****.**';
$website = 'www.izend.org';
$r = user_set($user_id, $name, $mail, $website, $locale);
dump($r);
$r = user_get($user_id);
dump($r);
$lastname = 'iZend';
$firstname = 'BarFoo';
$r = user_set_info($user_id, $lastname, $firstname);
dump($r);
$firstname = 'Bar-Foo';
$r = user_set_info($user_id, $lastname, $firstname);
dump($r);
$r = user_get_info($user_id);
dump($r);
$r = user_set_status($user_id, true, false);
dump($r);
$r = user_get_role($user_id);
dump($r);
$role = 'writer';
Esempio n. 20
0
$forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
// Array to hold error messages
$error_msg_array = array();
// User UID to send email to.
if (isset($_GET['uid']) && is_numeric($_GET['uid'])) {
    $to_uid = $_GET['uid'];
} else {
    if (isset($_POST['to_uid']) && is_numeric($_POST['to_uid'])) {
        $to_uid = $_POST['to_uid'];
    } else {
        html_draw_error(gettext("No user specified for emailing."));
    }
}
$uid = session::get_value('UID');
$to_user = user_get($to_uid);
$from_user = user_get($uid);
if (isset($_POST['send'])) {
    $valid = true;
    if (isset($_POST['t_subject']) && strlen(trim($_POST['t_subject'])) > 0) {
        $subject = trim($_POST['t_subject']);
    } else {
        $error_msg_array[] = gettext("Enter a subject for the message");
        $valid = false;
    }
    if (isset($_POST['t_message']) && strlen(trim($_POST['t_message'])) > 0) {
        $message = trim($_POST['t_message']);
    } else {
        $error_msg_array[] = gettext("Enter some content for the message");
        $valid = false;
    }
    if (isset($_POST['t_use_email_addr']) && $_POST['t_use_email_addr'] == 'Y') {
Esempio n. 21
0
    }
}
html_draw_top(sprintf("title=%s", gettext("Close Poll")), "post.js", "resize_width=720", "basetarget=_blank", 'class=window_title');
echo "<h1>", gettext("Close Poll"), " {$tid}.{$pid}</h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '720', 'left');
}
if ($preview_message['TO_UID'] == 0) {
    $preview_message['TLOGON'] = gettext("ALL");
    $preview_message['TNICK'] = gettext("ALL");
} else {
    $preview_tuser = user_get($preview_message['TO_UID']);
    $preview_message['TLOGON'] = $preview_tuser['LOGON'];
    $preview_message['TNICK'] = $preview_tuser['NICKNAME'];
}
$preview_tuser = user_get($preview_message['FROM_UID']);
$preview_message['FLOGON'] = $preview_tuser['LOGON'];
$preview_message['FNICK'] = $preview_tuser['NICKNAME'];
echo "<br />\n";
echo "<form accept-charset=\"utf-8\" name=\"f_delete\" action=\"close_poll.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
echo "  ", form_input_hidden('msg', htmlentities_array($msg)), "\n";
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"720\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
echo "              <table class=\"posthead\" width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" class=\"subhead\">", gettext("End Poll"), "</td>\n";
Esempio n. 22
0
 public static function refresh($uid)
 {
     $ip_address = get_ip_address();
     $http_referer = session::get_http_referer();
     if (!($forum_fid = get_forum_fid())) {
         $forum_fid = 0;
     }
     if (!($user = user_get($uid))) {
         $user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
     }
     unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER']);
     $_SESSION = array_merge($_SESSION, $user);
     $_SESSION['FID'] = $forum_fid;
     $_SESSION['IPADDRESS'] = get_ip_address();
     if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
         $_SESSION = array_merge($_SESSION, $user_prefs);
     }
     if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
         $_SESSION['PERMS'] = $user_perms;
     }
     if (!isset($_SESSION['REFERER'])) {
         $_SESSION['REFERER'] = session::get_http_referer();
     }
     if (!isset($_SESSION['RAND_HASH'])) {
         $_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
     }
     if (isset($user_prefs['STYLE'])) {
         html_set_cookie("forum_style", $user_prefs['STYLE'], time() + YEAR_IN_SECONDS);
     }
 }
Esempio n. 23
0
 public static function start($uid)
 {
     if (!($forum_fid = get_forum_fid())) {
         $forum_fid = 0;
     }
     if (!($user = user_get($uid))) {
         $user = array('UID' => 0, 'LOGON' => 'GUEST', 'NICKNAME' => 'Guest', 'EMAIL' => '');
     }
     unset($user['IPADDRESS'], $user['PASSWD'], $user['REFERER'], $user['PEER_NICKNAME']);
     $_SESSION = array_merge($_SESSION, $user);
     $_SESSION['FID'] = $forum_fid;
     $_SESSION['IPADDRESS'] = get_ip_address();
     if (session::logged_in() && ($user_prefs = user_get_prefs($uid))) {
         $_SESSION = array_merge($_SESSION, $user_prefs);
     } else {
         $_SESSION = array_merge($_SESSION, user_get_pref_names(array('STYLE')));
     }
     if ($user_perms = session::get_perm_array($uid, $forum_fid)) {
         $_SESSION['PERMS'] = $user_perms;
     }
     if (!isset($_SESSION['RAND_HASH'])) {
         $_SESSION['RAND_HASH'] = md5(uniqid(mt_rand()));
     }
     if ($uid > 0 && !forum_get_last_visit($uid) && ($gid = perm_get_default_group())) {
         perm_add_user_to_group($uid, $gid);
     }
 }
Esempio n. 24
0
function email_send_message_to_user($to_uid, $from_uid, $subject, $message_body, $use_email_addr)
{
    if (!is_numeric($to_uid)) {
        return false;
    }
    if (!is_numeric($from_uid)) {
        return false;
    }
    if (!($to_user = user_get($to_uid))) {
        return false;
    }
    if (!($from_user = user_get($from_uid))) {
        return false;
    }
    if (!($transport = Swift_TransportFactory::get())) {
        return false;
    }
    $mailer = Swift_Mailer::newInstance($transport);
    $message = Swift_MessageBeehive::newInstance();
    if (!email_address_valid($to_user['EMAIL'])) {
        return false;
    }
    $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $to_uid, true);
    $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $to_uid, true);
    $sent_from = word_filter_apply(format_user_name($from_user['LOGON'], $from_user['NICKNAME']), $to_uid, true);
    $message->setTo($to_user['EMAIL'], $recipient);
    if ($use_email_addr) {
        $message->setFrom($from_user['EMAIL'], $sent_from);
    }
    $message->setSubject($subject);
    $message->setBody(sprintf("%1\$s\n\n%2\$s", word_filter_apply(strip_tags($message_body), $to_uid, true), wordwrap(sprintf(gettext("This message was sent from %1\$s by %2\$s"), $forum_name, $sent_from))));
    $message->addPart(sprintf("<p>%1\$s</p><p>%2\$s</p>", word_filter_apply(strip_tags($message_body), $to_uid, true), wordwrap_html(sprintf(gettext("This message was sent from %1\$s by %2\$s"), $forum_name, $sent_from))), 'text/part');
    return $mailer->send($message);
}
Esempio n. 25
0
/**
 * 计算用户现有账户是否足以支付此项服务,并返回如果购买了此项服务后账户的净余额
 * 
 * @return	足够支付返回非负数,不够支付返回负数
 */
function vpn_afford($serviceid, $email)
{
    $serviceid = (int) $serviceid;
    $res = db_quick_fetch('service', "WHERE id={$serviceid}");
    if (count($res) <= 0) {
        vpn_log("No such service id {$serviceid}");
        return false;
    }
    $user = user_get($email);
    if ($user == false) {
        vpn_log("No such user `{$email}'");
        return false;
    }
    return $user['balance'] + $user['credit'] - $res[0]['price'];
}
Esempio n. 26
0
echo "<form accept-charset=\"utf-8\" name=\"prefs\" action=\"edit_signature.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_csrf_token_field(), "\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
if ($admin_edit === true) {
    echo "  ", form_input_hidden('sig_uid', htmlentities_array($sig_uid)), "\n";
}
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
if (isset($_POST['preview'])) {
    if ($valid) {
        $preview_message['RECIPIENTS'] = array();
        $preview_from_user = user_get($sig_uid);
        $preview_message['FROM_LOGON'] = $preview_from_user['LOGON'];
        $preview_message['FROM_NICKNAME'] = $preview_from_user['NICKNAME'];
        $preview_message['FROM_UID'] = $preview_from_user['UID'];
        $preview_message['CONTENT'] = gettext("Signature Preview");
        $preview_message['CONTENT'] .= "<div class=\"sig\">{$sig_text}</div>";
        $preview_message['CREATED'] = time();
        echo "              <table class=\"posthead\" width=\"100%\">\n";
        echo "                <tr>\n";
        echo "                  <td align=\"left\" class=\"subhead\">", gettext("Preview"), "</td>\n";
        echo "                </tr>\n";
        echo "              </table>\n";
        echo "              <table class=\"posthead\" width=\"100%\">\n";
        echo "                <tr>\n";
        echo "                  <td align=\"center\">\n";
        echo "                    <table class=\"posthead\" width=\"100%\">\n";
Esempio n. 27
0
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
if ($valid && (isset($_POST['preview_poll']) || isset($_POST['preview_form']))) {
    echo "              <table class=\"posthead\" width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" class=\"subhead\">", gettext("Preview"), "</td>\n";
    echo "                </tr>";
    $poll_data['POLLTYPE'] = $poll_type;
    $poll_data['VOTETYPE'] = $poll_vote_type;
    $poll_data['OPTIONTYPE'] = $option_type;
    $poll_data['TLOGON'] = gettext("ALL");
    $poll_data['TNICK'] = gettext("ALL");
    $preview_tuser = user_get($uid);
    $poll_data['FLOGON'] = $preview_tuser['LOGON'];
    $poll_data['FNICK'] = $preview_tuser['NICKNAME'];
    $poll_data['FROM_UID'] = $preview_tuser['UID'];
    $poll_preview_questions_array = $poll_questions_array;
    if (isset($_POST['preview_form'])) {
        $poll_display = poll_voting_form($poll_preview_questions_array, $poll_data);
    } else {
        $poll_display = "<div align=\"center\">\n";
        $poll_display .= "  <table class=\"box\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
        $poll_display .= "    <tr>\n";
        $poll_display .= "      <td align=\"center\">\n";
        $poll_display .= "        <table width=\"100%\">\n";
        foreach ($poll_preview_questions_array as $question_id => $question) {
            foreach (array_keys($question['OPTIONS_ARRAY']) as $option_id) {
                $poll_preview_questions_array[$question_id]['OPTIONS_ARRAY'][$option_id]['VOTES_ARRAY'] = array();
Esempio n. 28
0
function light_html_email_confirmation_error()
{
    if (!isset($_SESSION['UID']) || !is_numeric($_SESSION['UID'])) {
        return;
    }
    $user_array = user_get($_SESSION['UID']);
    light_html_draw_error(gettext("Email confirmation is required before you can post. If you have not received a confirmation email please click the button below and a new one will be sent to you. If your email address needs changing please do so before requesting a new confirmation email. You may change your email address by click My Controls above and then User Details"), 'confirm_email.php', 'get', array('resend' => gettext("Resend Confirmation")), array('uid' => $user_array['UID'], 'resend' => 'Y'));
}
Esempio n. 29
0
function email_send_message_to_user($tuid, $fuid, $subject, $message_body, $use_email_addr)
{
    // Validate function arguments
    if (!is_numeric($tuid)) {
        return false;
    }
    if (!is_numeric($fuid)) {
        return false;
    }
    // Get the to user details
    if (!($to_user = user_get($tuid))) {
        return false;
    }
    // Get the to user details
    if (!($from_user = user_get($fuid))) {
        return false;
    }
    // Get the Swift Mailer Transport
    if (!($transport = Swift_TransportFactory::get())) {
        return false;
    }
    //Create the Mailer using the returned Transport
    $mailer = Swift_Mailer::newInstance($transport);
    // Create a new message
    $message = Swift_MessageBeehive::newInstance();
    // Validate the email address before we continue.
    if (!email_address_valid($to_user['EMAIL'])) {
        return false;
    }
    // Get the forum name, subject, recipient, author, thread title and generate
    // the messages link. Pass all of them through the recipient's word filter.
    $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $tuid, true);
    $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $tuid, true);
    $sent_from = word_filter_apply(format_user_name($from_user['LOGON'], $from_user['NICKNAME']), $tuid, true);
    // Word filter the message to be sent.
    $message_body = word_filter_apply($message_body, $tuid, true);
    // Add the Sent By footer to the message.
    $message_body .= "\r\n\r\n" . wordwrap(sprintf(gettext("This message was sent from %s by %s"), $forum_name, $sent_from));
    // Add the recipient
    $message->setTo($to_user['EMAIL'], $recipient);
    // Set the from recipient
    if ($use_email_addr) {
        $message->setFrom($from_user['EMAIL'], $sent_from);
    }
    // Set the subject
    $message->setSubject($subject);
    // Set the message body
    $message->setBody($message_body);
    // Send the email
    return $mailer->send($message) > 0;
}
 function wp_create_nonce($action = -1)
 {
     $user = user_get();
     $uid = $user['userid'];
     $i = ceil(time() / 43200);
     return substr(wp_hash($i . $action . $uid), -12, 10);
 }