本文整理汇总了PHP中check_user_status函数的典型用法代码示例。如果您正苦于以下问题:PHP check_user_status函数的具体用法?PHP check_user_status怎么用?PHP check_user_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_user_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: put_question_to_db
/** Laita kysymys tietokantaan
* @param $question_id integer
*/
function put_question_to_db($question_id)
{
/* $title string
* $body string
* $tags string
*/
if (check_user_status()) {
echo "User status pelaa";
$body = pg_escape_string($_POST['question']['body']);
$title = pg_escape_string($_POST['question']['title']);
$tags = $_POST['question']['tags'];
if (validate_input($title, $body, $tags)) {
echo "User input pelaa";
$title = $_POST['question']['title'];
set_question($question_id);
set_tags($question_id);
header("Location: /pgCodesS/index.php?" . "question_updated" . "&" . "question_id=" . $question_id . "&" . $title);
} else {
header("Location: /pgCodesS/index.php?" . "&unsuccessful_new_question");
}
} else {
header("Location: /pgCodesS/index.php" . "&unsuccessful_new_question");
}
}
示例2: T_
?>
<div class="ft_no_post">
<?php
echo T_('There is no topic in this forum yet.');
?>
</div>
<?php
}
?>
</section>
<div class="panel-body comments_link__pagination">
<?php
// Buttons to post/reply
$Skin->display_post_button($single_cat_ID);
if (check_user_status('can_be_validated')) {
// Display a warning if current user cannot post a topic because he must activate account:
global $Messages;
$Messages->clear();
$Messages->add(T_('You must activate your account before you can post a new topic.') . ' <a href="' . get_activate_info_url(NULL, '&') . '">' . T_('More info »') . '</a>', 'warning');
$Messages->display();
}
// -------------------- PREV/NEXT PAGE LINKS (POST LIST MODE) --------------------
mainlist_page_links(array('block_start' => '<ul class="pagination">', 'block_end' => '</ul>', 'page_current_template' => '<span>$page_num$</span>', 'page_item_before' => '<li>', 'page_item_after' => '</li>', 'page_item_current_before' => '<li class="active">', 'page_item_current_after' => '</li>', 'prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>'));
// ------------------------- END OF PREV/NEXT PAGE LINKS -------------------------
?>
</div>
</div>
<?php
}
// ---------------------------------- END OF POSTS ------------------------------------
示例3: skin_init
//.........这里部分代码省略.........
break;
case 'user':
$seo_page_type = 'User display';
if (is_logged_in()) {
// Used for combo_box contacts groups
require_js('form_extensions.js', 'blog');
}
break;
case 'edit':
init_datepicker_js('blog');
require_js('admin.js', 'blog');
init_inskin_editing('blog');
init_plugins_js('blog');
break;
case 'edit_comment':
init_plugins_js('blog');
break;
case 'useritems':
case 'usercomments':
global $inc_path, $display_params, $viewed_User;
// get user_ID because we want it in redirect_to in case we need to ask for login.
$user_ID = param('user_ID', 'integer', true, true);
if (empty($user_ID)) {
bad_request_die(sprintf(T_('Parameter «%s» is required!'), 'user_ID'));
}
// set where to redirect in case of error
$error_redirect_to = empty($Blog) ? $baseurl : $Blog->gen_blogurl();
if (!is_logged_in()) {
// Redirect to the login page if not logged in and allow anonymous user setting is OFF
$Messages->add(T_('You must log in to view this user profile.'));
header_redirect(get_login_url('cannot see user'), 302);
// will have exited
}
if (is_logged_in() && !check_user_status('can_view_user', $user_ID)) {
// user is logged in, but his/her status doesn't permit to view user profile
if (check_user_status('can_be_validated')) {
// user is logged in but his/her account is not active yet
// Redirect to the account activation page
$Messages->add(T_('You must activate your account before you can view this user profile. <b>See below:</b>'));
header_redirect(get_activate_info_url(), 302);
// will have exited
}
$Messages->add(T_('Your account status currently does not permit to view this user profile.'));
header_redirect($error_redirect_to, 302);
// will have exited
}
if (!empty($user_ID)) {
$UserCache =& get_UserCache();
$viewed_User = $UserCache->get_by_ID($user_ID, false);
if (empty($viewed_User)) {
$Messages->add(T_('The requested user does not exist!'));
header_redirect($error_redirect_to);
// will have exited
}
if ($viewed_User->check_status('is_closed')) {
$Messages->add(T_('The requested user account is closed!'));
header_redirect($error_redirect_to);
// will have exited
}
}
// Require results.css to display thread query results in a table
require_css('results.css');
// Results/tables styles
// Require functions.js to show/hide a panel with filters
require_js('functions.js', 'blog');
// Include this file to expand/collapse the filters panel when JavaScript is disabled
示例4: md5
include_once "../dao/consumer.php";
$errors = "";
$_SESSION['zip'] = $_POST['keyword_hidden'];
$zipcode = $_SESSION['zip'];
$emails = $_POST['email'];
// email
$_SESSION['email'] = $emails;
if (isset($_POST['pwd'])) {
$password = $_POST['pwd'];
// password
$sec_pass = md5($password);
} else {
$password = "";
}
if ($password != '') {
$status = check_user_status($emails, $sec_pass);
} else {
$status = check_user_status1($emails);
}
$temp2 = consumer_findByEmail2($emails);
if ($status) {
$user_profile = $status['recordstatus'];
//$type = get_user_type($emails,$password);
$user_type = $status['usertype'];
$consumer_email = $status['emailaddress'];
$consumer_password = $status['password'];
if (isset($consumer_email) && ($user_profile = 'initialentry' && !isset($consumer_password) && $consumer_password == "")) {
$_SESSION['consumer'] = $temp2;
echo "search";
} else {
if (isset($consumer_email) && isset($consumer_password) && $consumer_password != "") {
示例5: set_answer
function set_answer($question_id)
{
/*
* $answer_sanitized string
*/
$answer_sanitized = pg_escape_string($_POST['answer']);
// to sanitize answer
$dbconn = pg_connect("host=localhost port=5432 dbname=noaa user=noaa password=123");
// to put answer and question_id to Answers -table
$result = pg_query_params($dbconn, 'INSERT INTO answers
(answer, question_id, user_id)
VALUES ($1, $2, $3)', array($answer_sanitized, $question_id, $_SESSION['login']['user_id']));
// to redirect the user
if ($result) {
header("Location: /pgCodesS/index.php?" . "answer_sent" . "&" . "question_id=" . $question_id);
} else {
header("Location: /pgCodesS/index.php?" . "answer_not_sent" . "&" . "question_id=" . $question_id);
}
}
// Let's fire!
/** Tarkasta, ettei vastaus ole tyh\"{a} ja salli vain kirjautunet
* k\"{a}ytt\"{a}j\"{a}
*/
if (!empty($_POST['answer'])) {
if (check_user_status()) {
set_answer(get_questionID_at_question());
}
} else {
header("Location: /pgCodesS/index.php");
}
ob_flush();
示例6: add_suffix
if ($body_title == 'Leaderboard' && $username == $row->username) {
?>
<a href="http://twitter.com/?status=I'm the <?php
echo add_suffix($rank);
?>
overall in OneExtraLap!">Tweet about your rank.</a>
<?php
}
?>
</li>
</ul>
<div class="clear"></div>
<?php
}
if ($content_type == 'find') {
$status = check_user_status($row->id, $username);
if ($status == 'create') {
?>
<div class="indicator purple" title="You created this quiz!"></div>
<?php
} elseif ($status == 'take') {
?>
<div class="indicator red" title="You took this quiz already!"></div>
<?php
} else {
}
?>
<h2>
<?php
echo get_title($row->id);
?>
示例7: check_allow_disp
/**
* Check if user is activated and status allow to display the requested form ($disp).
* Do nothing if status is activated or can't be activated or display is not allowed, add error message to activate the account otherwise.
* asimo>TODO: We may find a better name and a better place for this function ( maybe user.funcs.php )
*
* @param string the requested view name
*/
function check_allow_disp($disp)
{
global $Blog, $Messages, $Settings, $current_User, $secure_htsrv_url;
if (!check_user_status('can_be_validated')) {
// we don't have the case when user is logged in and the account is not active
return;
}
$messages_content = $Messages->get_string('', '', '', 'raw');
if (strstr($messages_content, 'disp=activateinfo') !== false || strstr($messages_content, 'action=req_validatemail') !== false) {
// If there is already a message to display activateinfo link, then don't add this message again
return;
}
switch ($disp) {
case 'activateinfo':
// don't display activate account error notification in activate info page
return;
break;
// already exited before this
// already exited before this
case 'contacts':
if (!$current_User->check_status('can_view_contacts')) {
// contacts view display is not allowed
return;
}
break;
case 'edit':
if (!$current_User->check_status('can_edit_post')) {
// edit post is not allowed
return;
}
break;
case 'messages':
if (!$current_User->check_status('can_view_messages')) {
// messages view display is not allowed
return;
}
break;
case 'msgform':
if (!$current_User->check_status('can_view_msgform')) {
// msgform display is not allowed
return;
}
break;
case 'threads':
if (!$current_User->check_status('can_view_threads')) {
// threads view display is not allowed
return;
}
break;
case 'user':
$user_ID = param('user_ID', 'integer', '', true);
if (!$current_User->check_status('can_view_user', $user_ID)) {
// user profile display is not allowed
return;
}
break;
case 'users':
if (!$current_User->check_status('can_view_users')) {
// not active user can't see users list
return;
}
break;
default:
break;
}
// User is allowed to see the requested view, but show an account activation error message
if ($Blog->get_setting('in_skin_login')) {
$activateinfo_link = 'href="' . url_add_param($Blog->gen_blogurl(), 'disp=activateinfo') . '"';
} else {
$activateinfo_link = 'href="' . $secure_htsrv_url . 'login.php?action=req_validatemail' . '"';
}
$Messages->add(sprintf(T_('IMPORTANT: your account is not active yet! Activate your account now by clicking on the activation link in the email we sent you. <a %s>More info »</a>'), $activateinfo_link));
}
示例8: md5
$page = "";
$emails = $_POST['email'];
$name = $_POST['name'];
$pass = $_POST['password'];
$substype = $_POST['usertype'];
$sec_pass = md5($pass);
$_SESSION['to_email'] = $_POST['email'];
$_SESSION['to_name'] = $_POST['name'];
$_SESSION['to_password'] = $_POST['password'];
if (isset($_SESSION['a'])) {
$page = $_SESSION['a'];
} else {
$page = "";
}
//user already exists w password check
$signedupuser = check_user_status($emails, $sec_pass);
if ($signedupuser) {
$temp = consumer_findByEmail($emails);
$_SESSION['consumer'] = $temp;
echo "OK";
} else {
$user = consumer_findByEmail2($emails);
if (!is_valid_email($emails)) {
$message = "Whoa check again, that email address is not valid!";
echo $message;
} else {
if (!$user) {
create_user_in_db();
// login successfull
$temp = consumer_findByEmail($emails);
$_SESSION['consumer'] = $temp;
示例9: receive_new_question
/**
* Ota uusi kysymys tietokantaan
*/
function receive_new_question()
{
/* $question_id integer
* $title string
* $body string
* $tags string
*/
$body = pg_escape_string($_POST['question']['body']);
$title = pg_escape_string($_POST['question']['title']);
$tags = $_POST['question']['tags'];
/**
* Tarkasta sisaankirjaus
*/
if (check_user_status()) {
echo "User status pelaa";
if (validate_input($title, $body, $tags)) {
echo "User input pelaa";
$title = $_POST['question']['title'];
set_question();
set_tags();
$question_id = get_question_id();
// question must be set before
header("Location: /pgCodesS/index.php?" . "question_sent" . "&" . "question_id=" . $question_id . "&" . $title);
} else {
header("Location: /pgCodesS/index.php?" . "ask_question" . "&unsuccessful_new_question");
}
} else {
header("Location: /pgCodesS/index.php" . "ask_question" . "&unsuccessful_new_question");
}
}
示例10: param
param('recipient_name', 'string', $Comment->get_author_name());
}
}
}
if ($recipient_User) {
// recipient User is set
// get_msgform_possibility returns NULL (false), only if there is no messaging option between current_User and recipient user
$allow_msgform = $recipient_User->get_msgform_possibility();
if ($allow_msgform == 'login') {
// user must login first to be able to send a message to this User
$disp = 'login';
param('action', 'string', 'req_login');
// override redirect to param
param('redirect_to', 'url', regenerate_url(), true, true);
$Messages->add(T_('You must log in before you can contact this user'));
} elseif ($allow_msgform == 'PM' && check_user_status('can_be_validated')) {
// user is not activated
if ($recipient_User->accepts_email()) {
// recipient User accepts email allow to send email
$allow_msgform = 'email';
$msg_type = 'email';
$activateinfo_link = 'href="' . get_activate_info_url() . '"';
$Messages->add(sprintf(T_('You must activate your account before you can send a private message to %s. However you can send them an email if you\'d like. <a %s>More info »</a>'), $recipient_User->get('login'), $activateinfo_link), 'warning');
} else {
// Redirect to the activate info page for not activated users
$Messages->add(T_('You must activate your account before you can contact a user. <b>See below:</b>'));
header_redirect(get_activate_info_url(), 302);
// will have exited
}
} elseif ($msg_type == 'PM' && $allow_msgform == 'email') {
// only email is allowed but user expect private message form
示例11: header
//解决跨域提交
header("Access-Control-Allow-Methods: POST, GET,PUT, OPTIONS, DELETE");
header("Access-Control-Max-Age:3600");
define('APPTYPEID', 0);
require './core/class/class_core.php';
$dzz = C::app();
$modarray = array('user', 'news');
$mod = !in_array($dzz->var['mod'], $modarray) && (!preg_match('/^\\w+$/', $dzz->var['mod']) || !file_exists(DZZ_ROOT . './member/member_' . $dzz->var['mod'] . '.php')) ? 'space' : $dzz->var['mod'];
define('CURMODULE', $mod);
$dzz->init();
if (@(!file_exists(DZZ_ROOT . './api/api_' . $mod . '.php'))) {
json_error(lang('message', 'undefined_action'));
}
//根据token检查是否处于登录状态
$token = isset($_SERVER['HTTP_X_AUTH_TOKEN']) ? $_SERVER['HTTP_X_AUTH_TOKEN'] : '';
check_user_status($token);
require DZZ_ROOT . './api/api_' . $mod . '.php';
function json_error($t)
{
die(json_message(false, $t));
}
function json_success($message = '', $data = array())
{
die(json_message(true, $message, $data));
}
function json_message($status, $message, $data = array())
{
return json_encode(array('status' => $status, 'message' => $message, 'data' => $data));
}
function check_user_status($token)
{
示例12: time
$payment_end_date = @$payment->end_date;
$now = time();
$response = '{"success":"1","message":"success"}';
if ($payment_end_date < $now) {
$response = '{"success":"0","message":"failed"}';
}
$callback = trim($_REQUEST['callback']);
$json = $callback . '({
"proposals":
';
$json .= $response;
$json .= '})';
echo $json;
break;
case "check_user_status":
echo check_user_status($_REQUEST['phone'], $_REQUEST['client_id'], $_REQUEST['callback']);
break;
//**********************COMMENTS******************************************************************************
//**********************COMMENTS******************************************************************************
case "add_comment":
$valid = add_comment($_REQUEST['aid'], $_REQUEST['username'], $_REQUEST['comment'], @$_REQUEST['client_id']);
$response = '{"success":"1","message":"success"}';
if (!$valid) {
$response = $callback . '({"proposals":{"success":"0","message":"failed"}})';
} else {
$response = get_comments_article($_REQUEST['aid'], @$_REQUEST['callback']);
}
echo $response;
break;
case "get_comments_article":
$response = get_comments_article($_REQUEST['aid']);
示例13: elseif
$Debuglog->add('Login: User has been authenticated through plugin #' . $event_return['plugin_ID'] . ' (AlternateAuthentication)', '_init_login');
$current_User =& $UserCache->get_by_ID($Session->user_ID);
} elseif ($login_required) {
/*
* ---------------------------------------------------------
* User was not logged in at all, but login is required
* ---------------------------------------------------------
*/
// echo ' NOT logged in...';
$Debuglog->add('Login: NOT logged in... (did not try)', '_init_login');
}
}
unset($pass);
$action = param('action', 'string', NULL);
// Check if the user needs to be validated, but is not yet:
if (check_user_status('can_be_validated') && $action != 'logout' && $action != 'req_validatemail' && $action != 'validatemail' && $validate_required) {
// we're not in that action already:
$action = 'req_validatemail';
// for login.php
if ($is_admin_page) {
$login_error = T_('In order to access the admin interface, you must first activate your account by clicking on the activation link in the email we sent you. <b>See below:</b>');
}
}
// asimo> If login action is not empty and there was no login error, and action is not logut the we must log in
if (!empty($login_action) && empty($login_error) && $action != 'logout') {
// Trigger plugin event that allows the plugins to re-act on the login event:
// TODO: dh> these events should provide a flag "login_attempt_failed".
if (empty($current_User)) {
$Plugins->trigger_event('AfterLoginAnonymousUser', array());
} else {
$Plugins->trigger_event('AfterLoginRegisteredUser', array());
示例14: header_redirect
// redirect Will save $Messages into Session:
header_redirect($redirect_to);
/* exited */
break;
}
// switch( $action ) (1st)
/* For actions that other delegate to from the switch above: */
switch ($action) {
case 'req_validatemail':
// Send activation link by email (initial form and action)
if (!is_logged_in()) {
$Messages->add(T_('You have to be logged in to request an account validation link.'), 'error');
$action = '';
break;
}
if (check_user_status('is_validated')) {
// Activation not required (check this after login, so it does not get "announced")
$action = '';
break;
}
param('req_validatemail_submit', 'integer', 0);
// has the form been submitted
$email = utf8_strtolower(param($dummy_fields['email'], 'string', $current_User->email));
// the email address is editable
if ($req_validatemail_submit) {
// Form has been submitted
param_check_email($dummy_fields['email'], true);
// check if user email was changed
$email_changed = $current_User->get('email') != $email;
// check if we really needs to send a new validation email
if (!$email_changed) {
示例15: can_see_comments
/**
* Check if user can see comments on this post, which he cannot if they
* are disabled for the Item or never allowed for the blog.
*
* @param boolean true will display why user can't see comments
* @return boolean
*/
function can_see_comments($display = false)
{
global $Settings, $disp;
if ($disp == 'terms') {
// Don't display the comments on page with terms & conditions:
return false;
}
if (!$this->get_type_setting('use_comments')) {
// Comments are not allowed on this post by post type
return false;
}
if ($this->get_type_setting('allow_disabling_comments') && $this->comment_status == 'disabled') {
// Comments are disabled on this post
return false;
}
if ($this->check_blog_settings('allow_view_comments')) {
// User is allowed to see comments
return true;
}
if (!$display) {
return false;
}
$this->load_Blog();
$number_of_comments = $this->get_number_of_comments('published');
$allow_view_comments = $this->Blog->get_setting('allow_view_comments');
$user_can_be_validated = check_user_status('can_be_validated');
if ($allow_view_comments != 'any' && $user_can_be_validated) {
// change allow view comments to activated, because user is logged in but the account is not activated, and anomnymous users can't see comments
$allow_view_comments = 'active_users';
}
// Set display text
switch ($allow_view_comments) {
case 'active_users':
// users must activate their accounts before they can see the comments
if ($number_of_comments == 0) {
$display_text = T_('You must activate your account to see the comments.');
} elseif ($number_of_comments == 1) {
$display_text = T_('There is <b>one comment</b> on this post but you must activate your account to see the comments.');
} else {
$display_text = sprintf(T_('There are <b>%s comments</b> on this post but you must activate your account to see the comments.'), $number_of_comments);
}
break;
case 'registered':
// only registered users can see this post's comments
if ($number_of_comments == 0) {
$display_text = T_('You must be logged in to see the comments.');
} elseif ($number_of_comments == 1) {
$display_text = T_('There is <b>one comment</b> on this post but you must be logged in to see the comments.');
} else {
$display_text = sprintf(T_('There are <b>%s comments</b> on this post but you must be logged in to see the comments.'), $number_of_comments);
}
break;
case 'member':
// only members can see this post's comments
if ($number_of_comments == 0) {
$display_text = T_('You must be a member of this blog to see the comments.');
} elseif ($number_of_comments == 1) {
$display_text = T_('There is one comment on this post but you must be a member of this blog to see the comments.');
} else {
$display_text = sprintf(T_('There are %s comments on this post but you must be a member of this blog to see the comments.'), $number_of_comments);
}
break;
default:
// any is already handled, moderators shouldn't get any message
return false;
}
echo '<div class="comment_posting_disabled_msg">';
if (!is_logged_in()) {
// user is not logged in at all
$redirect_to = $this->get_permanent_url() . '#comments';
$login_link = '<a href="' . get_login_url('cannot see comments', $redirect_to) . '">' . T_('Log in now!') . '</a>';
echo '<p>' . $display_text . ' ' . $login_link . '</p>';
if ($Settings->get('newusers_canregister') == 'yes' && $Settings->get('registration_is_public')) {
// needs to display register link
echo '<p>' . sprintf(T_('If you have no account yet, you can <a href="%s">register now</a>...<br />(It only takes a few seconds!)'), get_user_register_url($redirect_to, 'reg to see comments')) . '</p>';
}
} elseif ($user_can_be_validated) {
// user is logged in but not activated
$activateinfo_link = '<a href="' . get_activate_info_url($this->get_permanent_url() . '#comments', '&') . '">' . T_('More info »') . '</a>';
echo '<p>' . $display_text . ' ' . $activateinfo_link . '</p>';
} else {
// user is activated, but not allowed to view comments
echo $display_text;
}
echo '</div>';
return false;
}