function get_all($mysqli, $friend_ids) { if (!isset($_SESSION)) { session_start(); } if (!isset($_SESSION["id"]) || !valid_friends($friend_ids)) { die("[]"); } $my_id = $_SESSION["id"]; $friend_ids[] = $my_id; $ids = $friend_ids; sort($ids); $room_id = get_room_id($mysqli, $ids); return get_messages($mysqli, $room_id); }
function draw_message_box() { $messages = get_messages(); while ($message = $messages->fetch_array()){ ?><div class="mssg_text"><b> <?php echo '<div class='; if ($message['user_id']==$_SESSION['user_id']) echo 'mssg-self'; else if ($message['user_id']==get_team_leader()) echo 'mssg-tl'; echo '>'; echo ucfirst($message['fname']).' '; echo ucfirst($message['lname']); echo '</div>'; ?></b> <?php echo '<BR>'.$message['message']; echo '<BR></div><P>'; } }
mysql_query($sql); break; case "list": $password = $_GET["password"]; if (empty($password)) { break; } #Check password. $password = mysql_real_escape_string($password); $node = get_node($node_id); if ($node == FALSE) { break; } if ($node["password"] != $password) { break; } #Get messages. $messages = get_messages($node_id); #Delete old messages. $node_id = mysql_real_escape_string($node_id); $sql = "DELETE FROM `messages` WHERE `node_id`='{$node_id}'"; mysql_query($sql); #Return messages as JSON. echo json_encode($messages); break; default: break; } } //All done. mysql_close($con);
/** * The forgot password page */ public function forgot() { //Redirect if logged in $this->load->model('User_model'); if ($this->User_model->checkSession()) { redirect('user/index'); } //Check for post if ($this->input->post()) { $form = $this->input->post(NULL, TRUE); //Check if email is unique $this->load->helper('email'); //Check email if (!valid_email($form['email'])) { set_message("The email that you have entered is not Invalid", 'error'); } else { $email = check_plain($form['email']); //Based on email generate new login url token $this->load->model('User_model'); $this->load->model('Mail_model'); $user = $this->User_model->loadFromMail($email); if ($user && $user->uid) { //Generate new token and add to system $token = $this->User_model->addUrlToken($user); //Send email $this->Mail_model->forgotMail($user, array('token' => $token)); set_message("Check your mail to Reset your password"); } else { set_message("We dont have records for the email that you have given", 'error'); } } } $this->load->view('include/header', array('scripts' => array('assets/js/register.js'))); $data['messages'] = get_messages(); $this->load->view('templates/forgot', $data); //Show Footer $this->load->view('include/footer'); }
<?php $max = 5; if (!isset($_SESSION['pseudo'])) { header('location: ../'); } else { include_once 'model/messagerie/get_messages.php'; include_once 'model/messagerie/get_nb_messages.php'; if (array_key_exists('goto', $_GET)) { if ($_GET['goto'] < 1) { $pageact = 1; } else { $pageact = $_GET['goto']; } } else { $pageact = 1; } $messages = get_messages($_SESSION['pseudo'], $pageact, $max); $nb_total = get_nb_messages($_SESSION['pseudo']); include 'view/messagerie/index.php'; }
$delete = in('delete'); $message_sent_to = null; // Sending mail section. if ($message && $messenger) { if ($to_clan && $has_clan) { $message_sent_to = message_to_clan($message); } elseif (!!$target_id) { send_message($user_id, $target_id, $message); $message_sent_to = $to; // ( } } if ($delete) { delete_messages(); } $messages = get_messages($user_id, $limit, $offset); $message_count = message_count(); $pages = ceil($message_count / $limit); // Total pages. //$current_page = floor(($message_count/$limit) - $limit); // $nav = render_message_nav($page, $pages, $limit); read_messages($user_id); // mark messages as read for next viewing. // TODO: Handle "send" and "deletion"; $message_list = ''; if (!empty($messages)) { foreach ($messages as $loop_message) { $loop_message['message'] = out($loop_message['message']); $message_list .= render_template('single_message.tpl', array('message' => $loop_message)); } }
define("context", "weblog"); // You must be logged on to view this! protect(1); templates_page_setup(); cleanup_messages(time() - 86400 * 30); $title = run("profile:display:name") . " :: " . __gettext("Recent activity"); // If we haven't specified a start time, start time = 1 day ago $starttime = optional_param('starttime', time() - 86400, PARAM_INT); $body = "<p>" . __gettext("Currently viewing recent activity since ") . gmstrftime("%B %d, %Y", $starttime) . ".</p>"; $body .= "<p>" . __gettext("You may view recent activity during the following time-frames:") . "</p>"; $body .= "<ul><li><a href=\"index.php?starttime=" . (time() - 86400) . "\">" . __gettext("The last 24 hours") . "</a></li>"; $body .= "<li><a href=\"index.php?starttime=" . (time() - 86400 * 2) . "\">" . __gettext("The last 48 hours") . "</a></li>"; $body .= "<li><a href=\"index.php?starttime=" . (time() - 86400 * 7) . "\">" . __gettext("The last week") . "</a></li>"; $body .= "<li><a href=\"index.php?starttime=" . (time() - 86400 * 30) . "\">" . __gettext("The last month") . "</a></li></ul>"; $body .= "<h2>" . __gettext("Your recent messages") . "</h2>"; $user_messages = get_messages($page_owner, null, time() - $starttime); if (is_array($user_messages) && !empty($user_messages)) { foreach ($user_messages as $user_message) { $body .= "<div class=\"user_message\">" . display_message($user_message) . "</div>"; } } $body .= "<h2>" . __gettext("Activity on weblog posts you have marked as interesting") . "</h2>"; if ($activities = get_records_sql('SELECT wc.*, u.username, u.name as weblogname, wp.weblog, wp.ident AS weblogpost, wp.title AS weblogtitle, wp.weblog AS weblog FROM ' . $CFG->prefix . 'weblog_comments wc LEFT JOIN ' . $CFG->prefix . 'weblog_watchlist wl ON wl.weblog_post = wc.post_id LEFT JOIN ' . $CFG->prefix . 'weblog_posts wp ON wp.ident = wc.post_id LEFT JOIN ' . $CFG->prefix . 'users u ON u.ident = wp.weblog WHERE wc.posted > ? AND wl.owner = ? ORDER BY wc.posted DESC', array($starttime, $page_owner))) { foreach ($activities as $activity) { $commentbody = stripslashes($activity->body);
<?php //Подключение модулей include 'startup.php'; include 'model.php'; //Подготовка startup(); //Была отправка формы? if (!empty($_POST)) { send_message($_POST['category'], $_POST['link'], $_POST['description'], $_POST['comment']); //header('Location: index.php'); /* Если убрать эту строчку то вы дублируете запрос методом пост при перезагрузке. т.е. при перезагрузке страницы постоянно будут идти последние сообщения пользователя */ //exit(); } $messages = get_messages(); ?> <!-- //<?php /* Файл с этого сайта = http://objectone.ru/ */ ?> --> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Минимальный каркас странички</title> <link href="css/bootstrap.min.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="row">
<?php include "../model/msgdb.php"; if ($_POST['method'] == "insert") { insert_message(); } if ($_POST['method'] == "getall") { get_messages(); }
</head> <body> <h1>Pompiedom</h1> <div style="width:600px"> <p style="float:left">What are you doing?</p><span style="color:#888;float:right;font-size:33pt" id="counter"></span> <form action="/status/admin/post.php" method="post"> <textarea name='message' rows='2' cols='55' id='status'></textarea><br/> <input type='submit' value='Update' /> </form> <? require_once '../../../inc/database.inc.php'; $link = database_init(); $messages = get_messages($link); foreach ($messages as $message) { ?> <p><?php echo $message['message']; ?> </p> <p class="info">Posted by <? echo USERNAME ?> on <span class="created"><?php echo $message['created']; ?> </p> <? } ?> </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
if (isset($ltime)) { $time_diff = round($ltime / 1000) - $_SERVER['REQUEST_TIME']; $c['time_diff'] = $time_diff; set_timediff($time_diff, $username); } else { $time_diff = $c['time_diff']; } if (isset($message)) { $message = mysql_real_escape_string($message); $recepient = mysql_real_escape_string($recepient); send_message($recepient, $message, $username); } if (isset($solution)) { send_solution($solution, $username); } $c['messages'] = get_messages($self); $usersonline = userlist($username); $c['usersonline'] = $usersonline; $cond = give_conditions($username); $c['cond'] = $cond; /// Stop changing the session variable, compare it to the old state, generate a response and save in DB $c['md5_hash'] = ''; $c_old['md5_hash'] = ''; $old_session_hash = md5(serialize($c_old)); $new_session_hash = md5(serialize($c)); //if (isset($_GET['last_seen_session_hash']) and $_GET['last_seen_session_hash'] != $old_session_hash) { // $sql = "select ses_value from session_buffer where ses_hash = '".$_GET['last_seen_session_hash']."'"; // $q = mysql_query($sql); // if (mysql_num_rows($q)>0) $c_old = mysql_result($q,0); //} $c_old['md5_hash'] = $old_session_hash;
?> <div class="row margin-bottom-20"> <div class="col-md-12 text-right"> <a href="<?php echo url(); ?> /logout" class="btn btn-primary btn-sm" id="js-link-logout">logout</a> </div> </div> <?php } ?> <?php if (has_messages()) { foreach (get_messages() as $message) { ?> <div class="row"> <div class="col-md-12"> <div class="alert alert-info alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span> </button> <strong>Message:</strong> <?php echo $message; ?> </div> </div> </div> <?php }
define("USER_FILE", "user.txt"); // define icon set directory //define("ICON_SET", "smiley_fuge_icons"); //define("ICON_SET", "smiley_onigiri_riceballs"); define("ICON_SET", "smiley_the_glassy"); $icons = array(":-)" => array("file" => "smiley.png", "tooltip" => "Lächeln"), ":)" => array("file" => "smiley.png", "tooltip" => "Lächeln"), ";-)" => array("file" => "smiley-wink.png", "tooltip" => "Zwinkern"), ";)" => array("file" => "smiley-wink.png", "tooltip" => "Zwinkern"), ":-D" => array("file" => "smiley-grin.png", "tooltip" => "Grinsen"), ":D" => array("file" => "smiley-grin.png", "tooltip" => "Grinsen"), ":-(" => array("file" => "smiley-sad.png", "tooltip" => "Traurig"), ":(" => array("file" => "smiley-sad.png", "tooltip" => "Traurig"), ";-(" => array("file" => "smiley-cry.png", "tooltip" => "Weinen"), ";(" => array("file" => "smiley-cry.png", "tooltip" => "Weinen"), ":-O" => array("file" => "smiley-yell.png", "tooltip" => "Schreien"), ":O" => array("file" => "smiley-yell.png", "tooltip" => "Schreien"), ">-(" => array("file" => "smiley-mad.png", "tooltip" => "Sauer"), ">(" => array("file" => "smiley-mad.png", "tooltip" => "Sauer"), ":-@" => array("file" => "smiley-evil.png", "tooltip" => "Wütend"), ":@" => array("file" => "smiley-evil.png", "tooltip" => "Wütend"), ">-@" => array("file" => "smiley-twist.png", "tooltip" => "Zornig"), ">@" => array("file" => "smiley-twist.png", "tooltip" => "Zornig"), ":-o" => array("file" => "smiley-frighten.png", "tooltip" => "Erschrocken"), ":o" => array("file" => "smiley-frighten.png", "tooltip" => "Erschrocken"), ":-P" => array("file" => "smiley-razz.png", "tooltip" => "Zunge raustrecken"), ":P" => array("file" => "smiley-razz.png", "tooltip" => "Zunge raustrecken"), ":-X" => array("file" => "smiley-kiss.png", "tooltip" => "Küssen"), ":X" => array("file" => "smiley-kiss.png", "tooltip" => "Küssen"), "8-|" => array("file" => "smiley-roll.png", "tooltip" => "Ironisch"), "8|" => array("file" => "smiley-roll.png", "tooltip" => "Ironisch"), "B-)" => array("file" => "smiley-cool.png", "tooltip" => "Cool"), "B)" => array("file" => "smiley-cool.png", "tooltip" => "Cool"), ":-#" => array("file" => "smiley-zipper.png", "tooltip" => "Schweigen"), ":#" => array("file" => "smiley-zipper.png", "tooltip" => "Schweigen"), ":-§" => array("file" => "smiley-red.png", "tooltip" => "Verlegen"), ":§" => array("file" => "smiley-red.png", "tooltip" => "Verlegen"), "O:)" => array("file" => "smiley-angel.png", "tooltip" => "Unschuldig"), "O)" => array("file" => "smiley-angel.png", "tooltip" => "Unschuldig"), ":-Z" => array("file" => "smiley-sleep.png", "tooltip" => "Schlafen"), ":Z" => array("file" => "smiley-sleep.png", "tooltip" => "Schlafen"), ":-/" => array("file" => "smiley-confuse.png", "tooltip" => "Verwirrt"), ":/" => array("file" => "smiley-confuse.png", "tooltip" => "Verwirrt"), "\$-)" => array("file" => "smiley-money.png", "tooltip" => "Geldgierig"), "\$)" => array("file" => "smiley-money.png", "tooltip" => "Geldgierig"), "ccd" => array("file" => "thumb-up.png", "tooltip" => "Daumen hoch"), "cd" => array("file" => "thumb-up.png", "tooltip" => "Daumen hoch"), "ccq" => array("file" => "thumb-down.png", "tooltip" => "Daumen runter"), "cq" => array("file" => "thumb-down.png", "tooltip" => "Daumen runter")); // perform as requested by GET if ($_GET['action'] && $_SESSION['auth'] == true) { switch ($_GET['action']) { case 'logout': remove_user($_SESSION['name']); session_destroy(); header("Location: " . $_SERVER['PHP_SELF']); break; case 'get_messages': echo get_messages($_SESSION['last_action']); die; break; /*case 'get_userlist': echo get_userlist(); die; break;*/ } } // message was sent, write to file if ($_POST['msg'] && $_SESSION['auth'] == true) { write_message(microtime_float(), $_SESSION['name'], htmlspecialchars($_POST['msg'])); die; } // check if login is valid if ($_GET['name'] && $_GET['password'] && $_SESSION['auth'] != true) {
function get_message_preview($binding, $id) { $messages = get_messages($binding, $id, false, true); if ($messages) { return $messages[0]->preview_url; } else { return null; } }
Date </th> </tr> </thead> <tfoot> <tr> <td colspan="3">All times are in EST (UTC-05:00)</td> </tr> </tfoot> <tbody> <?php $Alert_Id = ''; if (isset($_GET['Alert_Id'])) { $Alert_Id = $_GET['Alert_Id']; } $posts = get_messages($params, $Alert_Id); foreach ($posts as $post) { $Extra_Classes = ''; $Alerts_Id = get_post_meta($post->ID, 'Edd_Alert_Id', true); if (isset($_GET['Alert_Id']) && $_GET['Alert_Id'] == $Alerts_Id) { $Extra_Classes = 'active_alert'; $Alert_Post_Id = get_alert_id_by_meta_value($Alerts_Id); if (get_post_meta($Alert_Post_Id, 'Is_Alert_Read', true) == '') { echo "<script>\$(function(){ Edd.collaboration.Alerts.Read('" . $Alert_Post_Id . "'); });</script>"; update_post_meta($Alert_Post_Id, 'Is_Alert_Read', 'YES', false); } } ?> <tr class="odd <?php echo $Extra_Classes; ?>
<?php require_once "messaging.php"; if ($_POST) { add_message($_POST['username'], $_POST['text'], $dbh); echo '[]'; } else { echo json_encode(get_messages($_GET['next'], $dbh)); }
function format_entry($r) { if (!is_array($r)) { return; } extract($r); if (!$time) { list($date, $time) = explode(' ', $date); } list($hour, $minute, $second) = explode(':', $time); list($year, $month, $day) = explode('-', $date); $timestamp = timezone_mktime($timezone, $hour, $minute, $second, $month, $day, $year); $data = handle_content($data, $contenttype); $date_f = format_date($timestamp, $timezone); $time_f = format_time($timestamp, $timezone); if ($date and $time) { $n = get_message_sum("{$date} {$time}"); $messages = get_messages(array("entrydate = '{$date} {$time}'", "entryuser = '******'", 'messages.messageid = entrymessages.messageid'), 'entrymessages'); } if (defined("JOURNAL_USECSS")) { return "<div class='journal'" . ($friend ? "" : " id='" . JOURNAL_USERNAME . "'") . "><div class='date'>{$date_f}</div>" . row_to_td($r) . "</div><div class='messages'>" . (is_array($messages) ? format_messages($messages) : "") . "</div>"; } else { return "<table><tr><td><h1>{$date_f}</h1></td>" . "<th>{$subject}</th>" . "<td align='right'><h1>{$time_f}</h1></td></tr>" . "<tr><td colspan='3'>{$data}</td></tr></table>" . (is_array($messages) ? format_messages($messages) : ""); } }
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) ReloadCMS Development Team // // http://reloadcms.com // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// $messages = get_messages(0, true); foreach ($messages as $id => $message) { $feed->addItem(__('Message by') . ' ' . $message['nickname'], htmlspecialchars($message['text']), 'http://' . $_SERVER['HTTP_HOST'] . '?module=' . $module, $message['time']); }
function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid = null) { global $webim_encoding, $webimroot, $connection_timeout, $settings; $threadid = $thread['threadid']; $istyping = abs($thread['current'] - $thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout && $thread[$isuser ? "agentTyping" : "userTyping"] == "1" ? "1" : "0"; if ($format == "xml") { $output = get_messages($threadid, "xml", $isuser, $lastid); start_xml_output(); print "<thread lastid=\"{$lastid}\" typing=\"" . $istyping . "\" canpost=\"" . ($isuser || $agentid != null && $agentid == $thread['agentId'] ? 1 : 0) . "\">"; foreach ($output as $msg) { print $msg; } print "</thread>"; } else { if ($format == "html") { loadsettings(); $output = get_messages($threadid, "html", $isuser, $lastid); start_html_output(); $url = "{$webimroot}/thread.php?act=refresh&thread={$threadid}&token={$token}&html=on&user="******"true" : "false"); print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . "<html>\n<head>\n" . "<link href=\"{$webimroot}/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n" . "<meta http-equiv=\"Refresh\" content=\"" . $settings['updatefrequency_oldchat'] . "; URL={$url}&sn=11\">\n" . "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n" . "<title>chat</title>\n" . "</head>\n" . "<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' onload=\"if( location.hash != '#aend' ){location.hash='#aend';}\">" . "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>"; foreach ($output as $msg) { print $msg; } print "</td></tr></table><a name='aend'></a>" . "</body></html>"; } } }
$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)) { show_window('', $pagination, 'center'); } foreach ($messages as $id => $message) { $message['id'] = $id; show_window('', rcms_parse_module_template('gb-mesg.tpl', $message), 'center'); } $system->config['pagename'] = __('Guest book');
function admin_started() { if (isset($_POST['filter_button'])) { if ($_POST['filter'] == '-1') { $_POST['filter'] = 'all'; } set_transient('Filter_By', admin_filter_type($_POST['filter']), 600); wp_redirect($_POST['_wp_http_referer']); exit; } if (isset($_POST['page']) && $_POST['page'] == 'collaboration_problem' && isset($_POST['problem']) && is_array($_POST['problem'])) { foreach ($_POST['problem'] as $Workroom_Id) { wp_delete_post($Workroom_Id); delete_post_meta_by_post_id($Workroom_Id); $files = get_files($Workroom_Id); foreach ($files as $file) { wp_delete_post($file->ID); delete_post_meta_by_post_id($file->ID); } $messages = get_messages($Workroom_Id); foreach ($messages as $message) { wp_delete_post($message->ID); delete_post_meta_by_post_id($message->ID); } } wp_redirect($_SERVER['HTTP_REFERER']); exit; } }
<? $user_id = user_id(); $msg_params = array(); // $msg_params['user_id'] = $user_id; //the user id //$msg_params['show'] = false; // params: read, unread, 'all' //$msg_params['parent_id']= '0'; //$msg_params['from_user'] = $user_id; //the user id $msg = get_messages($msg_params); ?> <script type="text/javascript"> $(document).ready(function(){ $('.unread').mouseover(function(){ //$(this).addClass('red'); $(this).removeClass('unread'); var getvalue = $(this).attr('rel'); // alert(getvalue); if(getvalue != 0){ mw.users.UserMessage.read(getvalue) $('#new_'+getvalue).fadeOut(); } }).mouseout(function(){ // $(this).removeClass('red'); $(this).attr('rel',0); }); });
function Delete_Workroom() { $Workroom_Id = $_POST['Workroom_Id']; $Workroom = wp_delete_post($Workroom_Id); delete_post_meta_by_post_id($Workroom_Id); if (is_wp_error($Workroom)) { $status = array('Status' => 'error', 'Message' => $user_id->get_error_message(), 'Color' => 'red', 'URL' => 'stay'); echo json_encode($status); die; } delete_post_meta_by_post_id($Workroom_Id); $files = get_messages($Workroom_Id); foreach ($files as $file) { wp_delete_post($file->ID); delete_post_meta_by_post_id($file->ID); } $messages = get_messages($Workroom_Id); foreach ($messages as $message) { wp_delete_post($message->ID); delete_post_meta_by_post_id($message->ID); } $status = array('Status' => 'success', 'Workroom_Id' => $Workroom_Id, 'Message' => 'Workroom is Successfully deleted.', 'Color' => 'green', 'URL' => get_permalink(get_page_by_path('collaboration'))); echo json_encode($status); }
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) ReloadCMS Development Team // // http://reloadcms.com // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if (!empty($_POST['d'])) { foreach ($_POST['d'] as $id => $cond) { if ($cond) { post_remove($id, DF_PATH . 'support.dat'); } } } $messages = get_messages(null, true, false, DF_PATH . 'support.dat'); $frm = new InputForm('', 'post', __('Submit')); $frm->addbreak(__('Feedback requests')); if (!empty($messages)) { foreach ($messages as $id => $message) { $frm->addrow('[' . rcms_format_time('d F Y H:i:s', $message['time'], $system->user['tz']) . '] ' . __('Message by') . ' ' . user_create_link($message['username'], $message['nickname']) . '<hr>' . $message['text'], $frm->checkbox('d[' . $id . ']', '1', __('Delete'))); } } else { $frm->addmessage(__('Nothing founded')); } $frm->show();
private function initVars() { $this->set('site_title', config('application')['site_name']); $this->set('messages', $this->render_messages(get_messages())); }
function message_content(&$a) { $o = ''; nav_set_selected('messages'); if (!local_user()) { notice(t('Permission denied.') . EOL); return; } $myprofile = $a->get_baseurl(true) . '/profile/' . $a->user['nickname']; $tpl = get_markup_template('mail_head.tpl'); $header = replace_macros($tpl, array('$messages' => t('Messages'), '$tab_content' => $tab_content)); if ($a->argc == 3 && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if (!intval($a->argv[2])) { return; } // Check if we should do HTML-based delete confirmation if ($_REQUEST['confirm']) { // <form> can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); $inputs = array(); foreach ($query['args'] as $arg) { if (strpos($arg, 'confirm=') === false) { $arg_parts = explode('=', $arg); $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); } } //$a->page['aside'] = ''; return replace_macros(get_markup_template('confirm.tpl'), array('$method' => 'get', '$message' => t('Do you really want to delete this message?'), '$extra_inputs' => $inputs, '$confirm' => t('Yes'), '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel'))); } // Now check how the user responded to the confirmation query if ($_REQUEST['canceled']) { goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } $cmd = $a->argv[1]; if ($cmd === 'drop') { $r = q("DELETE FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), intval(local_user())); if ($r) { info(t('Message deleted.') . EOL); } //goaway($a->get_baseurl(true) . '/message' ); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } else { $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), intval(local_user())); if (count($r)) { $parent = $r[0]['parent-uri']; $convid = $r[0]['convid']; $r = q("DELETE FROM `mail` WHERE `parent-uri` = '%s' AND `uid` = %d ", dbesc($parent), intval(local_user())); // remove diaspora conversation pointer // Actually if we do this, we can never receive another reply to that conversation, // as we will never again have the info we need to re-create it. // We'll just have to orphan it. //if($convid) { // q("delete from conv where id = %d limit 1", // intval($convid) // ); //} if ($r) { info(t('Conversation removed.') . EOL); } } //goaway($a->get_baseurl(true) . '/message' ); goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); } } if ($a->argc > 1 && $a->argv[1] === 'new') { $o .= $header; /* $plaintext = false; if(intval(get_pconfig(local_user(),'system','plaintext'))) $plaintext = true;*/ $plaintext = true; if (local_user() && feature_enabled(local_user(), 'richtext')) { $plaintext = false; } $tpl = get_markup_template('msg-header.tpl'); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:'))); $tpl = get_markup_template('msg-end.tpl'); $a->page['end'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:'))); $preselect = isset($a->argv[2]) ? array($a->argv[2]) : false; $prename = $preurl = $preid = ''; if ($preselect) { $r = q("select name, url, id from contact where uid = %d and id = %d limit 1", intval(local_user()), intval($a->argv[2])); if (count($r)) { $prename = $r[0]['name']; $preurl = $r[0]['url']; $preid = $r[0]['id']; } } $prefill = $preselect ? $prename : ''; // the ugly select box $select = contact_select('messageto', 'message-to-select', $preselect, 4, true, false, false, 10); $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl, array('$header' => t('Send Private Message'), '$to' => t('To:'), '$showinputs' => 'true', '$prefill' => $prefill, '$autocomp' => $autocomp, '$preid' => $preid, '$subject' => t('Subject:'), '$subjtxt' => x($_REQUEST, 'subject') ? strip_tags($_REQUEST['subject']) : '', '$text' => x($_REQUEST, 'body') ? escape_tags(htmlspecialchars($_REQUEST['body'])) : '', '$readonly' => '', '$yourmessage' => t('Your message:'), '$select' => $select, '$parent' => '', '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), '$wait' => t('Please wait'), '$submit' => t('Submit'))); return $o; } $_SESSION['return_url'] = $a->query_string; if ($a->argc == 1) { // List messages $o .= $header; $r = q("SELECT count(*) AS `total` FROM `mail`\n\t\t\tWHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC", intval(local_user()), dbesc($myprofile)); if (count($r)) { $a->set_pager_total($r[0]['total']); } $r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']); if (!count($r)) { info(t('No messages.') . EOL); return $o; } $o .= render_messages($r, 'mail_list.tpl'); $o .= paginate($a); return $o; } if ($a->argc > 1 && intval($a->argv[1])) { $o .= $header; $plaintext = true; if (local_user() && feature_enabled(local_user(), 'richtext')) { $plaintext = false; } $r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`\n\t\t\tFROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`\n\t\t\tWHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1", intval(local_user()), intval($a->argv[1])); if (count($r)) { $contact_id = $r[0]['contact-id']; $convid = $r[0]['convid']; $sql_extra = sprintf(" and `mail`.`parent-uri` = '%s' ", dbesc($r[0]['parent-uri'])); if ($convid) { $sql_extra = sprintf(" and ( `mail`.`parent-uri` = '%s' OR `mail`.`convid` = '%d' ) ", dbesc($r[0]['parent-uri']), intval($convid)); } $messages = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`\n\t\t\t\tFROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`\n\t\t\t\tWHERE `mail`.`uid` = %d {$sql_extra} ORDER BY `mail`.`created` ASC", intval(local_user())); } if (!count($messages)) { notice(t('Message not available.') . EOL); return $o; } $r = q("UPDATE `mail` SET `seen` = 1 WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc($r[0]['parent-uri']), intval(local_user())); require_once "include/bbcode.php"; $tpl = get_markup_template('msg-header.tpl'); $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:'))); $tpl = get_markup_template('msg-end.tpl'); $a->page['end'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl(true), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:'))); $mails = array(); $seen = 0; $unknown = false; foreach ($messages as $message) { if ($message['unknown']) { $unknown = true; } if ($message['from-url'] == $myprofile) { $from_url = $myprofile; $sparkle = ''; } else { $from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id']; $sparkle = ' sparkle'; } $extracted = item_extract_images($message['body']); if ($extracted['images']) { $message['body'] = item_redir_and_replace_images($extracted['body'], $extracted['images'], $message['contact-id']); } if ($a->theme['template_engine'] === 'internal') { $from_name_e = template_escape($message['from-name']); $subject_e = template_escape($message['title']); $body_e = template_escape(smilies(bbcode($message['body']))); $to_name_e = template_escape($message['name']); } else { $from_name_e = $message['from-name']; $subject_e = $message['title']; $body_e = smilies(bbcode($message['body'])); $to_name_e = $message['name']; } $mails[] = array('id' => $message['id'], 'from_name' => $from_name_e, 'from_url' => $from_url, 'sparkle' => $sparkle, 'from_photo' => $message['from-photo'], 'subject' => $subject_e, 'body' => $body_e, 'delete' => t('Delete message'), 'to_name' => $to_name_e, 'date' => datetime_convert('UTC', date_default_timezone_get(), $message['created'], 'D, d M Y - g:i A'), 'ago' => relative_date($message['created'])); $seen = $message['seen']; } $select = $message['name'] . '<input type="hidden" name="messageto" value="' . $contact_id . '" />'; $parent = '<input type="hidden" name="replyto" value="' . $message['parent-uri'] . '" />'; $tpl = get_markup_template('mail_display.tpl'); if ($a->theme['template_engine'] === 'internal') { $subjtxt_e = template_escape($message['title']); } else { $subjtxt_e = $message['title']; } $o = replace_macros($tpl, array('$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], '$thread_seen' => $seen, '$delete' => t('Delete conversation'), '$canreply' => $unknown ? false : '1', '$unknown_text' => t("No secure communications available. You <strong>may</strong> be able to respond from the sender's profile page."), '$mails' => $mails, '$header' => t('Send Reply'), '$to' => t('To:'), '$showinputs' => '', '$subject' => t('Subject:'), '$subjtxt' => $subjtxt_e, '$readonly' => ' readonly="readonly" style="background: #BBBBBB;" ', '$yourmessage' => t('Your message:'), '$text' => '', '$select' => $select, '$parent' => $parent, '$upload' => t('Upload photo'), '$insert' => t('Insert web link'), '$submit' => t('Submit'), '$wait' => t('Please wait'))); return $o; } }
function get_last_messages($num = 10, $parse = true, $limited = false, $file = RCMS_GB_DEFAULT_FILE, $config = 'comments.ini') { $tmp_arr = get_messages(0, $parse, $limited, $file, $config); return array_slice($tmp_arr, 0, $num, true); }
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once '../libs/common.php'; require_once '../libs/operator.php'; require_once '../libs/chat.php'; require_once '../libs/userinfo.php'; $operator = check_login(); $page = array(); loadsettings(); setlocale(LC_TIME, getstring("time.locale")); function thread_info($id) { global $mysqlprefix; $link = connect(); $thread = select_one_row("select userName,agentName,remote,userAgent," . "unix_timestamp(dtmmodified) as modified, unix_timestamp(dtmcreated) as created," . "vclocalname as groupName " . "from {$mysqlprefix}chatthread left join {$mysqlprefix}chatgroup on {$mysqlprefix}chatthread.groupid = {$mysqlprefix}chatgroup.groupid " . "where threadid = " . intval($id), $link); mysql_close($link); return $thread; } if (isset($_GET['threadid'])) { $threadid = verifyparam("threadid", "/^(\\d{1,10})?\$/", ""); $lastid = -1; $page['threadMessages'] = get_messages($threadid, "html", false, $lastid); $page['thread'] = thread_info($threadid); } prepare_menu($operator, false); start_html_output(); require '../view/thread_log.php';
$page['email'] = $email; if (!$email) { $errors[] = no_field("form.field.email"); } else { if (!is_valid_email($email)) { $errors[] = wrong_field("form.field.email"); } } if (count($errors) > 0) { $page['formemail'] = $email; $page['ct.chatThreadId'] = $thread['threadid']; $page['ct.token'] = $thread['ltoken']; $page['level'] = ""; setup_logo(); expand("styles", getchatstyle(), "mail.tpl"); exit; } $history = ""; $lastid = -1; $output = get_messages($threadid, "text", true, $lastid); foreach ($output as $msg) { $history .= $msg; } $subject = getstring("mail.user.history.subject"); $body = getstring2("mail.user.history.body", array($thread['userName'], $history)); $link = connect(); webim_mail($email, $webim_mailbox, $subject, $body, $link); mysql_close($link); setup_logo(); expand("styles", getchatstyle(), "mailsent.tpl"); exit;
$frm->addbreak(__('Additional information')); $frm->addrow(__('News') . ', ' . __('Articles'), format_size(get_dir_size(DATA_PATH . 'a/'))); $frm->addrow(__('Various datafiles'), format_size(get_dir_size(DF_PATH))); $frm->addrow(__('Users profiles') . ' (' . get_user_count() . ')', format_size(get_dir_size(USERS_PATH) + get_dir_size(DATA_PATH . 'avatars/') + get_dir_size(DATA_PATH . 'pm/'))); $frm->addrow(__('Uploads'), format_size(get_dir_size(FILES_PATH))); if (defined('GALLERY_PATH')) { $frm->addrow(__('Gallery'), format_size(get_dir_size(GALLERY_PATH))); } if (defined('FORUM_PATH')) { $frm->addrow(__('Forum'), format_size(get_dir_size(FORUM_PATH))); } $frm->addrow(__('Logs'), format_size(get_dir_size(LOGS_PATH))); $frm->addrow(__('Config'), format_size(get_dir_size(CONFIG_PATH))); $frm->addrow(__('Backups'), format_size(get_dir_size(BACKUP_PATH))); $frm->addrow(__('Skins'), format_size(get_dir_size(SKIN_PATH))); $frm->addrow(__('Images'), format_size(get_dir_size(IMAGES_PATH))); $frm->addrow(__('All'), format_size(get_dir_size(RCMS_ROOT_PATH))); if (class_exists('articles') && $system->checkForRight('ARTICLES-EDITOR')) { $frm->addbreak(__('Information from users')); $articles = new articles(); $articles->setWorkContainer('#hidden'); $count = sizeof($articles->getArticles(0, false, false, false)); $frm->addrow($count . ' ' . __('article(s) awaits moderation')); } if ($system->checkForRight('SUPPORT')) { $count = sizeof(get_messages(null, true, false, DF_PATH . 'support.dat')); $frm->addrow($count . ' ' . __('feedback requests in database')); } $frm->addbreak(__('Here you can leave message for other administrators')); $frm->addrow($frm->textarea('remarks', file_get_contents(DATA_PATH . 'admin_remarks.txt'), 60, 10), '', 'middle', 'center'); $frm->show();