Example #1
0
session_start();
require_once 'connection.php';
// Initialize message array if it doesn't exist
if (!isset($_SESSION['success'])) {
    $_SESSION['success'] = array();
}
if (isset($_POST['action'])) {
    // This is registration
    if ($_POST['action'] == 'register') {
        register_user($_POST);
    } else {
        if ($_POST['action'] == 'login') {
            login_user($_POST);
        } else {
            if ($_POST['action'] == 'message') {
                post_message($_POST);
            } else {
                post_comment($_POST);
            }
        }
    }
} else {
    session_destroy();
    header('Location: index.php');
}
function register_user($post)
{
    //--------------being of validation checks-----------------------//
    $_SESSION['errors'] = array();
    if (empty($post['first_name'])) {
        $_SESSION['errors'][] = "First name can't be blank";
Example #2
0
function check_for_reassign($thread, $operator)
{
    global $state_waiting, $home_locale, $kind_events, $kind_avatar;
    $operatorName = $thread['locale'] == $home_locale ? $operator['vclocalename'] : $operator['vccommonname'];
    if ($thread['istate'] == $state_waiting && ($thread['nextagent'] == $operator['operatorid'] || $thread['agentId'] == $operator['operatorid'])) {
        do_take_thread($thread['threadid'], $operator['operatorid'], $operatorName);
        if ($operatorName != $thread['agentName']) {
            $message_to_post = getstring2_("chat.status.operator.changed", array($operatorName, $thread['agentName']), $thread['locale']);
        } else {
            $message_to_post = getstring2_("chat.status.operator.returned", array($operatorName), $thread['locale']);
        }
        post_message($thread['threadid'], $kind_events, $message_to_post);
        post_message($thread['threadid'], $kind_avatar, $operator['vcavatar'] ? $operator['vcavatar'] : "");
    }
}
Example #3
0
<?php

include __DIR__ . '/../lib/IronMQWrapper.php';
$queue_name = "test_queue_name";
include __DIR__ . '/../lib/IronWorkerWrapper.php';
$name = "sampleWorker.php";
$start = get_time();
for ($i = 1; $i <= 10; $i++) {
    queue_worker($iw, $name);
}
$worker_time = get_time() - $start;
$start = get_time();
for ($i = 1; $i <= 10; $i++) {
    post_message($ironmq, $queue_name);
}
$sent_time = get_time() - $start;
$start = get_time();
for ($i = 1; $i <= 10; $i++) {
    get_message($ironmq, $queue_name);
}
$received_time = get_time() - $start;
$details = array("worker" => $worker_time, "sent" => $sent_time, "received" => $received_time);
echo json_encode($details);
function get_time()
{
    return (double) array_sum(explode(' ', microtime()));
}
function get_message($ironmq, $queue_name)
{
    $ironmq->getMessage($queue_name);
}
Example #4
0
 function postComment($filename, $text)
 {
     global $system;
     if (empty($this->indexes['main'][$filename]) || !is_file(GALLERY_IMAGES_DIR . $filename)) {
         return false;
     }
     if (!empty($text)) {
         return post_message($system->user['username'], $system->user['nickname'], $text, GALLERY_COMMENTS_DIR . $filename . '.dat');
     }
 }
Example #5
0
     }
     new_message($group, $groups, $start, "", $from, "");
     break;
 case 'p':
     // Post message
     if ($LOGIN_USER == "") {
         $options = str_replace("+", "%2B", "+g" . urlencode($group) . $options);
         header("Location: login.php?PAGE={$PHP_SELF}?l{$options}");
         return;
     }
     if (ereg(".*\\.announce", $group) || ereg(".*\\.commit", $group)) {
         nntp_header("Forum Posting Error", array("All Forums" => "forums.php?g{$options}", "Back to {$group}" => "forums.php?g{$group}+s{$start}{$options}"));
         print "<p>We are sorry, but we could not post your message for the " . "following reason:\n" . "<blockquote>Forum {$group} is read-only.</blockquote>\n";
         html_footer();
     } else {
         post_message($group, $groups, $start, $msg, $search, $threaded);
     }
     break;
 case 'r':
     // Reply message
     if ($LOGIN_USER == "") {
         $options = str_replace("+", "%2B", "+g" . urlencode($group) . $options);
         header("Location: login.php?PAGE={$PHP_SELF}?r{$msg}{$options}");
         return;
     }
     reply_message($group, $groups, $start, $msg, $search, $threaded, $from);
     break;
 case 'v':
     // View message
     show_message($group, $groups, $start, $msg, $search, $threaded);
     break;
Example #6
0
 *
 * Allows Admins to post an message
 */
require_once '../.lib/functions.php';
restrict_access('A');
page_title('Post Message');
if (isset($_POST["do_preview_message"]) || isset($_POST["do_post_message"]) || isset($_POST["do_reedit_message"])) {
    //POSTed.
    if ($_POST['xsrf_token'] != $_SESSION['xsrf_token']) {
        trigger_error('XSRF code incorrect', E_USER_ERROR);
    }
    //Stuff was posted, AND it's validated.
    if (isset($_POST['do_preview_message'])) {
        preview_message();
    } elseif (isset($_POST['do_post_message'])) {
        post_message();
    } else {
        edit_message();
    }
    //Re-edit!
} else {
    edit_message();
    //nothing was POSTed (just got here and starting to post a msg), or error occurred in validation.
}
function edit_message()
{
    //"$post_through"??
    $email_checked = array('yes-captains' => '', 'yes-you' => '', 'no' => '');
    $email_checked[empty($_POST['email']) ? 'yes-you' : $_POST['email']] = 'checked="checked"';
    // Assemble Page
    ?>
Example #7
0
$pagination = rcms_pagination($pages * $system->config['perpage'], $system->config['perpage'], $page + 1, '?module=' . $module);
if (!empty($_POST['comtext'])) {
    if (isset($system->config['guestbook-guest']) and !LOGGED_IN) {
        show_window(__('Error'), __('You are not logined!'));
    } else {
        if (isset($_POST['antispam']) and isset($_POST['captcheckout'])) {
            $defcatp = substr(md5($_POST['antispam']), 0, 5);
            $intcapt = $_POST['captcheckout'];
            if ($defcatp == $intcapt) {
                post_message($system->user['username'], $system->user['nickname'], $_POST['comtext'], RCMS_GB_DEFAULT_FILE, 'guestbook.ini');
                rcms_redirect('');
            } else {
                show_window(__('Error'), __('Invalid form data'));
            }
        } else {
            post_message($system->user['username'], $system->user['nickname'], $_POST['comtext'], RCMS_GB_DEFAULT_FILE, 'guestbook.ini');
            rcms_redirect('');
        }
    }
}
if (isset($_POST['gbd']) && $system->checkForRight('GUESTBOOK')) {
    post_remove($_POST['gbd'], RCMS_GB_DEFAULT_FILE);
    rcms_redirect('');
}
if (!(isset($system->config['guestbook-guest']) and !LOGGED_IN)) {
    show_window(__('Post message'), rcms_parse_module_template('gb-form.tpl', array()), 'center');
} else {
    show_window(__('Error'), __('You are not logined!'), 'center');
}
$messages = get_messages($page, true, false, RCMS_GB_DEFAULT_FILE, 'guestbook.ini');
if (!empty($pagination)) {
Example #8
0
                     $feedback .= $Language->getText('forum_forum_utils', 'insert_err');
                 }
             }
         }
     }
     // Note: there is a 'msg_id' send but not used here.
     $vFollowUp = new Valid_UInt('is_followup_to');
     $vFollowUp->required();
     $vSubject = new Valid_String('subject');
     $vSubject->required();
     $vSubject->setErrorMessage($GLOBALS['Language']->getText('forum_forum_utils', 'include_body_and_subject'));
     $vBody = new Valid_Text('body');
     $vBody->required();
     $vBody->setErrorMessage($GLOBALS['Language']->getText('forum_forum_utils', 'include_body_and_subject'));
     if ($request->valid($vThreadId) && $request->valid($vFollowUp) && $request->valid($vSubject) && $request->valid($vBody)) {
         post_message($request->get('thread_id'), $request->get('is_followup_to'), $request->get('subject'), $request->get('body'), $forum_id);
     }
 }
 /*
 	set up some defaults if they aren't provided
 */
 // Offset
 if ($request->valid(new Valid_UInt('offset'))) {
     $offset = $request->get('offset');
 } else {
     $offset = 0;
 }
 // Style
 if ($request->valid(new Valid_WhiteList('style', forum_utils_get_styles()))) {
     $style = $request->get('style');
 } else {
Example #9
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (!empty($_POST['support_req']) && LOGGED_IN) {
    post_message($system->user['username'], $system->user['nickname'], $system->user['email'] . "\n" . $_POST['support_req'], DF_PATH . 'support.dat');
    show_window('', __('Message sent'), 'center');
}
if (!LOGGED_IN) {
    show_window(__('Error'), __('You are not logined!'));
}
$result = '<form method="post" action="" name="form1">';
$result .= '<textarea name="support_req" cols="70" rows="7"></textarea>
<p align="center"><input type="submit" value="' . __('Submit') . '" /></p>
</form>';
if (LOGGED_IN) {
    show_window(__('Feedback request'), $result, 'center');
}
$system->config['pagename'] = __('Feedback');
Example #10
0
 $allow_anonymous = db_result($result, 0, 'allow_anonymous');
 $send_all_posts_to = db_result($result, 0, 'send_all_posts_to');
 //private forum check
 if (!db_result($result, 0, 'is_public')) {
     if (!user_isloggedin() || !user_ismember($group_id)) {
         /*
         	If this is a private forum, kick 'em out
         */
         exit_error('ERROR', 'Forum is restricted to members of this group');
     }
 }
 /*
 	if necessary, insert a new message into the forum
 */
 if ($post_message) {
     if (!post_message($thread_id, $is_followup_to, $subject, $body, $forum_id)) {
         exit_error('ERROR', $feedback);
     } else {
         $feedback = 'Message Posted Successfully';
         $style = '';
         $thread_id = '';
     }
 }
 /*
 	set up some defaults if they aren't provided
 */
 if (!$offset || $offset < 0) {
     $offset = 0;
 }
 if ($thread_id) {
     $style = 'nested';
Example #11
0
if (!empty($_POST['mctext']) && (LOGGED_IN || $minichat_config['allow_guests_post'])) {
    if (isset($_POST['antispam']) and isset($_POST['captcheckout'])) {
        $defcatp = substr(md5($_POST['antispam']), 0, 5);
        $intcapt = $_POST['captcheckout'];
        if ($defcatp == $intcapt) {
            $username = $system->user['username'];
            $nickname = $system->user['nickname'];
            post_message($username, $nickname, $_POST['mctext'], RCMS_MC_DEFAULT_FILE, 'minichat.ini');
            rcms_redirect('');
        } else {
            show_window(__('Error'), __('Invalid form data'));
        }
    } else {
        $username = $system->user['username'];
        $nickname = $system->user['nickname'];
        post_message($username, $nickname, $_POST['mctext'], RCMS_MC_DEFAULT_FILE, 'minichat.ini');
        rcms_redirect('');
    }
}
/*
* If admin delete comment
*/
if (isset($_POST['mcdelete']) && $system->checkForRight('MINICHAT')) {
    post_remove($_POST['mcdelete'], RCMS_MC_DEFAULT_FILE);
    rcms_redirect('');
}
/*
* Minichat post form
*/
$result = '';
if (LOGGED_IN || $minichat_config['allow_guests_post']) {