Beispiel #1
0
function sendMessage($sentMsg, $senderChatId, $senderEmail, $groupId)
{
    global $conn;
    writeToFile("msg: {$sentMsg}, chat_id: {$senderChatId}, email: {$senderEmail}, group_id: {$groupId}");
    //get the current timestamp
    $timeStamp = date("Y-m-d H:i:s");
    if ($groupId) {
        //insert the sent msg to DB
        $sql = "INSERT INTO CHATLINETABLE" . "(id, chat_id, user_email, text_line, time_stamp, group_id)" . "VALUES (NULL, {$senderChatId}, '{$senderEmail}', '{$sentMsg}', '{$timeStamp}', {$groupId})";
    } else {
        //insert the sent msg to DB
        $sql = "INSERT INTO CHATLINETABLE" . "(id, chat_id, user_email, text_line, time_stamp, group_id)" . "VALUES (NULL, {$senderChatId}, '{$senderEmail}', '{$sentMsg}', '{$timeStamp}',NULL)";
    }
    try {
        $result = $conn->query($sql);
        if ($result) {
            if (isset($_COOKIE['groupId'])) {
                getGroupData($_COOKIE['groupId']);
            } else {
                if (isset($_COOKIE['sender']) && isset($_COOKIE['receiver'])) {
                    getMessages($_COOKIE['sender'], $_COOKIE['receiver'], $_COOKIE['recName']);
                }
            }
        } else {
            echo "Error while inserting data to chat table";
        }
    } catch (Exception $e) {
        echo 'Exception in sendMessage() :' . $e->getMessage();
    }
}
Beispiel #2
0
/**
 * Saves a new message and updates the cache.
 */
function newMessage($conn, $cache, $message)
{
    // This is great PHP
    if ($message == "0" || $message) {
        $stmt = $conn->prepare("INSERT INTO messages (message) VALUES (:message);");
        $stmt->execute(array(':message' => $message));
        $cache->set("messages", getMessages($conn, null));
    }
}
Beispiel #3
0
 function render()
 {
     global $user, $twig;
     $this->user = $user;
     $this->loadMenu();
     $this->campaign = updatesCampaign();
     if ($this->user->loggedin and !$this->user->checkRole('miserend')) {
         $this->mychurches = feltoltes_block();
     }
     if ($this->user->checkRole('"any"')) {
         $this->chat = chat_load();
     }
     $this->messages = getMessages();
     $this->html = $twig->render($this->template, (array) $this);
 }
Beispiel #4
0
function show_messages($target = "_global")
{
    $mtypes = array("ERROR" => "danger", "WARN" => "warning", "OK" => "success");
    foreach ($mtypes as $mt => $mcl) {
        if (hasMessages($mt, $target)) {
            $msgs = getMessages($mt, $target);
            for ($i = 0; $i < count($msgs); $i++) {
                ?>
                    <div class="alert alert-<?php 
                echo $mcl;
                ?>
" role="alert"><?php 
                echo $msgs[$i];
                ?>
</div>
                <?php 
            }
        }
    }
    clearMessages($target);
}
Beispiel #5
0
 public function run()
 {
     parent::run();
     $this->getInputJson();
     $newuser = new \User();
     $validFields = array('username', 'email', 'password', 'nickname', 'name');
     $fieldsToSubmit = array();
     foreach ($validFields as $field) {
         if ($this->input[$field] and $this->input[$field] != '') {
             $fieldsToSubmit[$field] = $this->input[$field];
         }
     }
     $success = $newuser->submit($fieldsToSubmit);
     $messages = getMessages();
     if (!$success) {
         $exceptionTexts = array();
         foreach ($messages as $message) {
             $exceptionTexts[] = $message['text'];
         }
         throw new \Exception(implode("\n", $exceptionTexts));
     }
 }
Beispiel #6
0
<?php

if (!defined('BASEPATH')) {
    exit(__('No direct script access allowed'));
}
?>
<!-- START:: Global Messages | General Helper -->
<?php 
echo getMessages();
?>
<!-- END:: Global Messages -->

<?php 
/*
 * TODO:: Below this is deprecated | To be removed after all file update finish
 * Please use above method to get all global messages
 */
/*
if(!isset($error_message) || !is_array($error_message)) {$error_message = array();}
if(!isset($success_message) || !is_array($success_message)) {$success_message = array();}

if(count($success_message) > 0) { ?>
    <div class="success"><?php
        foreach($success_message as $v) { ?>
            <p><?php echo "$v\n"; ?></p><?php
        } ?>
    </div><?php
}

if(count($error_message) > 0) { ?>
    <div class="error"><?php
Beispiel #7
0
<?php

$page_title = "Postkast";
$file_name = "messages.php";
require_once "../header.php";
require_once "functions.php";
if (!isset($_SESSION["logged_in_user_id"])) {
    header("Location: login.php");
}
$messages = getMessages();
?>
<html>
<body>
<table border=1 >
	<tr>
		<th>Eesnimi</th>
		<th>Perekonnanimi</th>
		<th>Sõnum</th>
	</tr>
	
	<?php 
//iga massiivis oleva elemendi kohta
//count($tasks) - massiivi pikkus
for ($i = 0; $i < count($messages); $i++) {
    echo "<tr>";
    //echo "<td>".$lectures[$i]->id."</td>";
    echo "<td align=center>" . $messages[$i]->fname . "</td>";
    echo "<td align=center>" . $messages[$i]->lname . "</td>";
    echo "<td align=center>" . $messages[$i]->message . "</td>";
    //echo "<td align=center>".$lectures[$i]->title."</td>";
    //echo "<td><a href='tasks.php?lecture_id=".$messages[$i]->lectureid."'>".$lectures[$i]->lname."</a></td>";
Beispiel #8
0
function authed($username)
{
    if (!isset($username)) {
        getMessages($_POST["username"], true);
        echo "<br>sent msgs:<br>";
        getMessages($_POST["username"] . ".sent", true, false);
    } else {
        getMessages($username, true);
        echo "<br>sent msgs:<br>";
        getMessages($username . ".sent", true, false);
    }
    if (isset($_POST["api"])) {
        break;
    }
    include "form.php";
    return true;
}
Beispiel #9
0
 public function add_photoAction($id = null)
 {
     $userSession = $this->session->get('userSession');
     $id = $userSession['id'];
     $member = Members::findFirst($id);
     if (!$member) {
         $this->response->redirect('biz/add_photo/' . $userSession['id']);
     }
     $photos = MemberPhotos::find(array('member_id = "' . $id . '"', 'order' => 'id DESC'));
     $this->view->setVars(['photos' => $photos, 'member' => $member]);
     // POST
     if ($this->request->isPost() && $this->request->hasFiles() == true) {
         //ini_set('upload_max_filesize', '64M');
         set_time_limit(1200);
         $uploads = $this->request->getUploadedFiles();
         $isUploaded = false;
         #do a loop to handle each file individually
         foreach ($uploads as $upload) {
             #define a “unique” name and a path to where our file must go
             $fileName = $upload->getname();
             $fileInfo = new SplFileInfo($fileName);
             $fileExt = $fileInfo->getExtension();
             $fileExt = strtolower($fileExt);
             $newFileName = substr(md5(uniqid(rand(), true)), 0, 10) . date('ymdhis') . '.' . $fileExt;
             //$fileExt = $upload->getExtension();
             $fileImageExt = array('jpeg', 'jpg', 'png');
             //error_log("File Extension :".$fileExt, 0);
             $fileType = '';
             $filePath = '';
             $path = '';
             //$path = ''.$newFileName;
             if (in_array($fileExt, $fileImageExt)) {
                 $path = 'img/member/' . $newFileName;
                 // img/business_member ?
                 $filePath = 'img/member/';
                 // img/business_member ?
                 //$fileType = 'Image';
             }
             #move the file and simultaneously check if everything was ok
             $upload->moveTo($path) ? $isUploaded = true : ($isUploaded = false);
         }
         #if any file couldn't be moved, then throw an message
         if ($isUploaded) {
             $memberPhotos = new MemberPhotos();
             $memberPhotos->created = date('Y-m-d H:i:s');
             $memberPhotos->modified = date('Y-m-d H:i:s');
             $memberPhotos->member_id = $userSession['id'];
             $memberPhotos->file_path = $filePath;
             $memberPhotos->filename = $newFileName;
             $memberPhotos->caption = $this->request->getPost('caption');
             if (count($photos) > 0) {
                 $memberPhotos->primary_pic = 'No';
             } else {
                 $memberPhotos->primary_pic = 'Yes';
                 $userSession['primary_pic'] = $filePath . $newFileName;
                 $this->session->set('userSession', $userSession);
             }
             if ($memberPhotos->create()) {
                 return $this->response->redirect('biz/add_photo/' . $id);
             } else {
                 // if member photos creation is failed.
                 $this->view->disable();
                 print_r($memberPhotos . getMessages());
             }
         }
     }
 }
        $chatID_temp = $chatIDobj->fetch();
        $chatID = $chatID_temp['chatID'];
        ?>
		<table class="chatTable" id="Message_<?php 
        echo $chatID_temp['chatID'];
        ?>
" rows="31" cols="2" id='messageArea'>
			<tr>
				<td><?php 
        echo $firstname . " " . $lastname;
        ?>
</td>
				<td>You</td>
			</tr>
			<?php 
        echo getMessages($chatID_temp);
        ?>
		</table>
		<input id="messageText" type="text" name="messageArea"></input>
	<?php 
        echo "<button id='btn_send' onclick=sendMessage({$chatID}); > Send </button>";
    } else {
        echo "<p> No messages to display, say something! </p>";
    }
} else {
    echo "<p>derp</p>";
}
//gets all the messages between two people
function getMessages($chatID)
{
    include 'db.php';
Beispiel #11
0
	<!-- sidebar -->
	<?php 
include 'templates/sidebar.php';
?>
	<!-- End sidebar -->



	<!-- mainContent --> 
	<div id="mainContent">
                
                <div id="inboxList">
			<ul>
			   <?php 
getMessages();
?>
			</ul>
		</div><!-- End inboxList -->
               
	</div>
	<!-- End mainContent --> 



	<!-- sidebar2 -->
	<?php 
include 'templates/sidebar2.php';
?>
	<!-- End sidebar2 -->
            <?php 
}
?>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>
	<!-- Contents -->
    <div style="height:4em"></div>
	<div class="container">
		<div class="row messages">
		<?php 
$message_types = array(MSG_TYPE_ERR => 'alert-danger', MSG_TYPE_WARN => 'alert-warning', MSG_TYPE_INFO => 'alert-info');
$fmt = '<div class="alert %s" role="alert">%s</div>';
foreach ($message_types as $message_type => $alert_class) {
    $messages = getMessages($message_type);
    foreach ($messages as $message) {
        printf($fmt, $alert_class, $message);
    }
}
?>
		</div>
		<div class="row theme-showcase" role="main">
		<?php 
print $contents;
?>
	  </div>
	</div>
  </body>
 </html>
Beispiel #13
0
function showMessage($mess)
{
	if ($mess['last'] > (time() - 3600*24*28)) {
		global $db;
		global $maxDepth;
		global $maxLen;
		$id = $mess['ID'];
		$poster = $mess['poster'];
		$subject = $mess['subject'];
		$time = gmdate('j F Y H:i:s T',$mess['time']);
		$message = strip_tags($mess['message'],'<b><i><u><a><s><font>');
		if (strlen($message) > $maxLen) {
			$message = substr($message, 0, $maxLen - 20) . '[truncated]' . substr($message, -20);
		}
		$importance = $mess['importance'];
		$reply_to = $mess['reply_to'];
		$ip = $mess['ip'];
		$replies = numberOfReplies($id);
		global $depth;
		$tempDepth = $depth;
		
		$query = "SELECT * FROM `messages` WHERE `poster` = \"$poster\"";
		$postCount = mysql_num_rows(mysql_query($query,$db));
	
		?>
	
	<div style="padding-left: <?= $depth*20 ?>px;">
	<p>
	<small>
	<a href="<?= $_PHP_SELF ?>?post=<?= $id ?>&maxDepth=1">View <?= $replies ?> Direct Replies</a>&nbsp;&nbsp;
	<a href="<?= $_PHP_SELF ?>?post=<?= $id ?>">Permanent link</a>&nbsp;&nbsp;
	<a href="postreply.php?reply=<?= $id ?>">Reply</a>&nbsp;&nbsp;
	</small>
	<?php if($_COOKIE['admin']) {?>
		<small><a href="deletepost.php?post=<?= $id ?>">Delete</a></small>&nbsp;&nbsp;
		<small><a href="editpost.php?post=<?= $id ?>">Edit</a></small><br />
	<? } ?>
	<br />
	<strong><?= str_repeat('*',$importance) ?> <?=$subject?> <?= str_repeat('*',$importance) ?></strong><br />
	<em><!--(<?=$id?> <?=$depth?> <?=$postCount?>)-->Posted by <b><?=$poster?></b> at <b><?=$time?></b></em></p>
	
	<p><?=$message?></p>
	
	<hr/>
	</div>
	
	<?
	
		if ($depth < $maxDepth || $maxDepth == 0) {
			$messages = getMessages($id);
			$rows = mysql_num_rows($messages);
			$depth++;
			for ($i = 0; $i < $rows; $i++) {
				showMessage(mysql_fetch_assoc($messages));
			}
			$depth = $tempDepth;
		}
	} 
}
Beispiel #14
0
    if ($_SESSION[$guid]["i18n"]["dateFormatRegEx"] == "") {
        print "/^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\\d\\d\$/i";
    } else {
        print $_SESSION[$guid]["i18n"]["dateFormatRegEx"];
    }
    ?>
, failureMessage: "Use <?php 
    if ($_SESSION[$guid]["i18n"]["dateFormat"] == "") {
        print "dd/mm/yyyy";
    } else {
        print $_SESSION[$guid]["i18n"]["dateFormat"];
    }
    ?>
." } ); 
					date.add(Validate.Presence);
				</script>
				 <script type="text/javascript">
					$(function() {
						$( "#date" ).datepicker();
					});
				</script>
				<input style='min-width: 30px; margin-top: 0px; float: right' type='submit' value='<?php 
    print _('Go');
    ?>
'>
				<?php 
    print "</form>";
    print "</div>";
    print "</div>";
    print getMessages($guid, $connection2, "print", dateConvert($guid, $date));
}
<?php

/*
** Zabbix
** Copyright (C) 2001-2016 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
list($table, $info) = make_latest_issues($data['filter'], 'zabbix.php?action=dashboard.view');
$output = ['header' => _n('Last %1$d issue', 'Last %1$d issues', DEFAULT_LATEST_ISSUES_CNT), 'body' => (new CDiv([getMessages(), $table]))->toString(), 'footer' => (new CListItem($info))->toString() . (new CListItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS))))->toString()];
if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
    CProfiler::getInstance()->stop();
    $output['debug'] = CProfiler::getInstance()->make()->toString();
}
echo (new CJson())->encode($output);
Beispiel #16
0
$url = 'contact.php?admin=index';
//pour la pagination, on va compter le nombre de produits correspondant à notre requète
$nbMessage = getNombreContact();
//on souhaite 5 news par page, le nombre de page est égal au nombre de news total divisé par 5.
//dans la plupart des cas, on aura un réel. pas de possibilité d'avoir 2.6 pages, on rajoute une page au cas où ca ne tombe pas juste
$nbPages = (int) ($nbMessage / $contactParPage) + 1;
//on vérifie qu'au cas où le résultat tombe juste, on affiche pas une page en plus qui serait vide
if ($nbMessage % $contactParPage == 0) {
    $nbPages = $nbPages - 1;
}
if (!isset($_GET['page'])) {
    $_GET['page'] = '1';
}
// pas de pages --> page 1
//on transforme le numero de page en entier, si la variable page n'est pas un nombre, page sera égal à 0
if (isset($_GET['page'])) {
    $page = (int) $_GET['page'];
}
//on vérifie maintenant que le numero de page existe bien
if (isset($page) and $page <= $nbPages and $page > 0) {
    $contactArray = getMessages(($page - 1) * $contactParPage, $contactParPage);
    include_once 'vue/contact/admin/index.php';
} else {
    $js = false;
    $redirect[0] = $url;
    $redirect[1] = '3';
    $page = 'admin';
    $titreErreur = 'administration ~ contact - erreur';
    $erreur = 'Aucun message ne se trouve sur cette page!';
    include_once 'vue/erreur.php';
}
Beispiel #17
0
function sendMessage($chatId, $message, $sender, $reciever)
{
    $message = htmlspecialchars($message);
    setChatContacts($sender, $reciever);
    $messages = getMessages();
    $messages[$chatId][] = array('t' => date("H:i:s", time()), 'm' => $message);
    shm_put_var(getMemoryId(), 0, json_encode($messages));
}
            width: calc(100% - 270px);
            font-family: Arial;
            min-height: 40px;
            display:inline-block;
            color: yellow;
            background: #6090e0;
            text-align: right;
            box-shadow: 2px 3px 10px #5080d0;
        }

    </style>
</head>
<body>
<div id="guest-desk">
    <?php 
if ($allMessages = getMessages($path)) {
    ?>
        <?php 
    foreach ($allMessages as $data) {
        ?>
                <div class="message">
                    <div>
                        <?php 
        echo $data['username'];
        ?>
                        <hr>
                        <small><?php 
        echo $data['date'];
        ?>
</small>
                    </div>
Beispiel #19
0
session_start();
require_once 'global.php';
$database = new Database();
if (Tools::isLogged() && isset($_POST['mpcontenu'])) {
    $conversationid = $_GET['mpid'];
    $user = new User($_SESSION['login']);
    // this is us
    // create new mp
    $database->newMP($user->getid(), $conversationid, $_POST['mpcontenu']);
    // Set conversation as unread for all recipients
    $recipients = $database->getConversationDest($user->getid(), $conversationid);
    foreach ($recipients as $dest) {
        $database->changeConversationReadStatus($conversationid, $dest[0], '1');
    }
}
if (Tools::isLogged() && isset($_GET['mpid'])) {
    $user = new User($_SESSION['login']);
    $conversation = $database->getFullConversationByID($_GET['mpid']);
    // if we are just looking at the conversation, get its posts
    $database->changeConversationReadStatus($_GET['mpid'], $user->getid(), '0');
    // make it read
}
Tools::callTwig('detailmp.twig', array('connected' => Tools::isLogged(), 'user' => $user, 'conversation' => getMessages($conversation, $user), 'conversationinfo' => getMessages($conversation, $user)[0]->getConversation()));
function getMessages($conversation, $user)
{
    foreach ($conversation as $message) {
        $messagesobj[] = new Message($message, $user);
    }
    return $messagesobj;
}
Beispiel #20
0
}
function shareAlreadyUploadedFile($id, $user)
{
    $content = '{username|' . $user . '} {lang|' . "userUploadedFile" . '} {file|' . $id . '}.';
    postMessage($content, 0);
}
//Escape all input
$_GET = escapeArray($_GET);
$_POST = escapeArray($_POST);
//Handle actions
if ($_GET['action'] == 'postMessage') {
    postMessage($_POST['content'], $_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getMessage') {
    getMessage($_POST['id']);
} elseif ($_GET['action'] == 'getMessages') {
    getMessages($_POST['lastReceivedId']);
} elseif ($_GET['action'] == 'getRecentMessages') {
    getRecentMessages();
} elseif ($_GET['action'] == 'getNextMessages') {
    getNextMessages($_POST['lastTimestamp']);
} elseif ($_GET['action'] == 'setStatus') {
    setStatus($_SESSION['user']['id'], $_POST['status']);
} elseif ($_GET['action'] == 'logOn') {
    logOn($_SESSION['user']['id']);
} elseif ($_GET['action'] == 'getAllUsers') {
    getAllUsers();
} elseif ($_GET['action'] == 'editMessage') {
    editMessage($_SESSION['user']['id'], $_POST['message'], $_POST['content']);
} elseif ($_GET['action'] == 'getAllEmoticons') {
    getAllEmoticons();
} elseif ($_GET['action'] == 'getAllImages') {
Beispiel #21
0
             break;
         case ERR::TOKEN_EXPIRED:
         case ERR::TOKEN_FAIL:
         case ERR::USER_NO_TOKEN:
             header("Location: logout.php?error=" . $receivedError);
             break;
         default:
             echo "<p>Error: " . $ERRORS[$sentError] . "</p>";
             break;
     }
 } else {
     $userInfo = array();
     // We want to get messages that have been SENT by US and RECEIVED by ANYONE...
     $sentMessages = getMessages($db, $_SESSION['id'], $_SESSION['id'], null, $_SESSION['token']);
     // ...and messages that have been SENT by ANYONE and RECEIVED by US
     $receivedMessages = getMessages($db, $_SESSION['id'], null, $_SESSION['id'], $_SESSION['token']);
     $sentError = $sentMessages[SP::ERROR];
     $receivedError = $receivedMessages[SP::ERROR];
     unset($sentMessages[SP::ERROR]);
     unset($receivedMessages[SP::ERROR]);
     /*
     	const ID = "MessageID";
     	const SENDER = "FromUserID";
     	const RECIPIENT = "ToUserID";
     	const CONTENT = "Content";
     	const MADE_AT = "CreatedAt";
     	const TITLE = "Title";
     */
     //MessageID, FromUserID, ToUserID, Title, CreatedAt
     switch ($sentError) {
         case ERR::OK:
Beispiel #22
0
<?php

// configuration
require_once "../includes/config.php";
require "../includes/interactionService.php";
$db = new mysql_db(SERVER, USERNAME, PASSWORD, DATABASE);
$username = $_SESSION["username"];
if (isset($_POST["receiver"])) {
    $receiver = $_POST["receiver"];
    $message = $_POST["content"];
    $sender = $username;
    sendMessage($sender, $receiver, $message);
}
$userid1 = $username;
$friends = getFriends($userid1);
$contacts = getContacts($userid1);
$messages = getMessages($username);
$contacts = array_merge($friends, $contacts);
render("message_template.php", ["messages" => $messages, "contacts" => $contacts]);
$db->sql_close();
Beispiel #23
0
function start()
{
    if (!empty($_POST)) {
        if (!isset($_POST['id'])) {
            addUser($_POST);
            $fla = flash("Ajout reussie");
        } else {
            editUser($_POST);
            $fla = flash("Edition reussie");
        }
        $people = getPeople();
        require '../views/list.php';
        return;
    }
    if (!isset($_GET['id']) && !isset($_GET['page'])) {
        $people = getPeople();
        return require '../views/list.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'add') {
        return require '../views/add.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'list') {
        $people = getPeople();
        return require '../views/list.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'edit') {
        if (!isset($_GET['id'])) {
            die('Nope, ou est ID ?');
        }
        $id = $_GET['id'];
        $editable = ORM::for_table('users')->find_one($id);
        return require '../views/edit.php';
    }
    if (isset($_GET['id'])) {
        $user = getUser();
        $message = getMessages($_GET['id']);
        require '../views/show.php';
    }
}
Beispiel #24
0
function getMinorLinks($connection2, $guid, $cacheLoad)
{
    $return = FALSE;
    if (isset($_SESSION[$guid]["username"]) == FALSE) {
        if ($_SESSION[$guid]["webLink"] != "") {
            $return .= _("Return to") . " <a style='margin-right: 12px' target='_blank' href='" . $_SESSION[$guid]["webLink"] . "'>" . $_SESSION[$guid]["organisationNameShort"] . " " . _('Website') . "</a>";
        }
    } else {
        $return .= $_SESSION[$guid]["preferredName"] . " " . $_SESSION[$guid]["surname"] . " . ";
        $return .= "<a href='./logout.php'>" . _("Logout") . "</a> . <a href='./index.php?q=preferences.php'>" . _('Preferences') . "</a>";
        if ($_SESSION[$guid]["emailLink"] != "") {
            $return .= " . <a target='_blank' href='" . $_SESSION[$guid]["emailLink"] . "'>" . _('Email') . "</a>";
        }
        if ($_SESSION[$guid]["webLink"] != "") {
            $return .= " . <a target='_blank' href='" . $_SESSION[$guid]["webLink"] . "'>" . $_SESSION[$guid]["organisationNameShort"] . " " . _('Website') . "</a>";
        }
        if ($_SESSION[$guid]["website"] != "") {
            $return .= " . <a target='_blank' href='" . $_SESSION[$guid]["website"] . "'>" . _('My Website') . "</a>";
        }
        //GET AND SHOW LIKES
        //Get likes
        $getLikes = FALSE;
        if ($cacheLoad) {
            $getLikes = TRUE;
        } else {
            if (isset($_GET["q"])) {
                if ($_GET["q"] == "likes.php") {
                    $getLikes = TRUE;
                }
            }
        }
        if ($getLikes) {
            $_SESSION[$guid]["likesCount"] = countLikesByRecipient($connection2, $_SESSION[$guid]["gibbonPersonID"], "count", $_SESSION[$guid]["gibbonSchoolYearID"]);
        }
        //Show likes
        if (isset($_SESSION[$guid]["likesCount"])) {
            if ($_SESSION[$guid]["likesCount"] > 0) {
                $return .= " . <a title='" . _('Likes') . "' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=likes.php'>" . $_SESSION[$guid]["likesCount"] . " x <img class='minorLinkIcon' style='margin-left: 2px; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/like_large_on.png'></a>";
            } else {
                $return .= " . " . $_SESSION[$guid]["likesCount"] . " x <img class='minorLinkIcon' title='" . _('Likes') . "' style='margin-left: 2px; opacity: 0.8; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/like_large_off.png'>";
            }
        }
        //GET & SHOW NOTIFICATIONS
        try {
            $dataNotifications = array("gibbonPersonID" => $_SESSION[$guid]["gibbonPersonID"], "gibbonPersonID2" => $_SESSION[$guid]["gibbonPersonID"]);
            $sqlNotifications = "(SELECT gibbonNotification.*, gibbonModule.name AS source FROM gibbonNotification JOIN gibbonModule ON (gibbonNotification.gibbonModuleID=gibbonModule.gibbonModuleID) WHERE gibbonPersonID=:gibbonPersonID AND status='New')\n\t\t\tUNION\n\t\t\t(SELECT gibbonNotification.*, 'System' AS source FROM gibbonNotification WHERE gibbonModuleID IS NULL AND gibbonPersonID=:gibbonPersonID2 AND status='New')\n\t\t\tORDER BY timestamp DESC, source, text";
            $resultNotifications = $connection2->prepare($sqlNotifications);
            $resultNotifications->execute($dataNotifications);
        } catch (PDOException $e) {
            $return .= "<div class='error'>" . $e->getMessage() . "</div>";
        }
        //Refresh notifications every 10 seconds for staff, 120 seconds for everyone else
        $interval = 120000;
        if ($_SESSION[$guid]["gibbonRoleIDCurrentCategory"] == "Staff") {
            $interval = 10000;
        }
        $return .= "<script type=\"text/javascript\">\n\t\t\t\$(document).ready(function(){\n\t\t\t\tsetInterval(function() {\n\t\t\t\t\t\$(\"#notifications\").load(\"index_notification_ajax.php\");\n\t\t\t\t}, " . $interval . ");\n\t\t\t});\n\t\t</script>";
        $return .= "<div id='notifications' style='display: inline'>";
        //CHECK FOR SYSTEM ALARM
        if (isset($_SESSION[$guid]["gibbonRoleIDCurrentCategory"])) {
            if ($_SESSION[$guid]["gibbonRoleIDCurrentCategory"] == "Staff") {
                $alarm = getSettingByScope($connection2, "System", "alarm");
                if ($alarm == "General" or $alarm == "Lockdown" or $alarm == "Custom") {
                    $type = "general";
                    if ($alarm == "Lockdown") {
                        $type = "lockdown";
                    } else {
                        if ($alarm == "Custom") {
                            $type = "custom";
                        }
                    }
                    $return .= "<script>\n\t\t\t\t\t\t\tif (\$('div#TB_window').is(':visible')===false) {\n\t\t\t\t\t\t\t\tvar url = '" . $_SESSION[$guid]["absoluteURL"] . "/index_notification_ajax_alarm.php?type=" . $type . "&KeepThis=true&TB_iframe=true&width=1000&height=500';\n\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\ttb_show('', url);\n\t\t\t\t\t\t\t\t\t\$('div#TB_window').addClass('alarm') ;\n\t\t\t\t\t\t\t\t}) ;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>";
                }
            }
        }
        if ($resultNotifications->rowCount() > 0) {
            $return .= " . <a title='" . _('Notifications') . "' href='" . $_SESSION[$guid]["absoluteURL"] . "/index.php?q=notifications.php'>" . $resultNotifications->rowCount() . " x " . "<img class='minorLinkIcon' style='margin-left: 2px; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/notifications_on.png'></a>";
        } else {
            $return .= " . 0 x " . "<img title='" . _('Notifications') . "' class='minorLinkIcon' style='margin-left: 2px; opacity: 0.8; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/notifications_off.png'>";
        }
        $return .= "</div>";
        //MESSAGE WALL!
        if (isActionAccessible($guid, $connection2, "/modules/Messenger/messageWall_view.php")) {
            include "./modules/Messenger/moduleFunctions.php";
            $addReturn = NULL;
            if (isset($_GET["addReturn"])) {
                $addReturn = $_GET["addReturn"];
            }
            $updateReturn = NULL;
            if (isset($_GET["updateReturn"])) {
                $updateReturn = $_GET["updateReturn"];
            }
            $deleteReturn = NULL;
            if (isset($_GET["deleteReturn"])) {
                $deleteReturn = $_GET["deleteReturn"];
            }
            if ($cacheLoad or @$_GET["q"] == "/modules/Messenger/messenger_post.php" and $addReturn == "success0" or @$_GET["q"] == "/modules/Messenger/messenger_postQuickWall.php" and $addReturn == "success0" or @$_GET["q"] == "/modules/Messenger/messenger_manage_edit.php" and $updateReturn == "success0" or @$_GET["q"] == "/modules/Messenger/messenger_manage.php" and $deleteReturn == "success0") {
                $messages = getMessages($guid, $connection2, "result");
                $messages = unserialize($messages);
                try {
                    $resultPosts = $connection2->prepare($messages[1]);
                    $resultPosts->execute($messages[0]);
                } catch (PDOException $e) {
                }
                $_SESSION[$guid]["messageWallCount"] = 0;
                if ($resultPosts->rowCount() > 0) {
                    $count = 0;
                    $output = array();
                    $last = "";
                    while ($rowPosts = $resultPosts->fetch()) {
                        if ($last == $rowPosts["gibbonMessengerID"]) {
                            $output[$count - 1]["source"] = $output[$count - 1]["source"] . "<br/>" . $rowPosts["source"];
                        } else {
                            $output[$_SESSION[$guid]["messageWallCount"]]["photo"] = $rowPosts["image_240"];
                            $output[$_SESSION[$guid]["messageWallCount"]]["subject"] = $rowPosts["subject"];
                            $output[$_SESSION[$guid]["messageWallCount"]]["details"] = $rowPosts["body"];
                            $output[$_SESSION[$guid]["messageWallCount"]]["author"] = formatName($rowPosts["title"], $rowPosts["preferredName"], $rowPosts["surname"], $rowPosts["category"]);
                            $output[$_SESSION[$guid]["messageWallCount"]]["source"] = $rowPosts["source"];
                            $output[$_SESSION[$guid]["messageWallCount"]]["gibbonMessengerID"] = $rowPosts["gibbonMessengerID"];
                            $_SESSION[$guid]["messageWallCount"]++;
                            $last = $rowPosts["gibbonMessengerID"];
                            $count++;
                        }
                    }
                    $_SESSION[$guid]["messageWallOutput"] = $output;
                }
            }
            //Check for house logo (needed to get bubble, below, in right spot)
            $isHouseLogo = FALSE;
            if (isset($_SESSION[$guid]["gibbonHouseIDLogo"]) and isset($_SESSION[$guid]["gibbonHouseIDName"])) {
                if ($_SESSION[$guid]["gibbonHouseIDLogo"] != "") {
                    $isHouseLogo = TRUE;
                }
            }
            $URL = $_SESSION[$guid]["absoluteURL"] . "/index.php?q=/modules/Messenger/messageWall_view.php";
            if (isset($_SESSION[$guid]["messageWallCount"]) == FALSE) {
                $return .= " . 0 x <img title='" . _('Message Wall') . "' class='minorLinkIcon' style='margin-left: 4px; opacity: 0.8; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/messageWall_none.png'>";
            } else {
                if ($_SESSION[$guid]["messageWallCount"] < 1) {
                    $return .= " . 0 x <img title='" . _('Message Wall') . "' class='minorLinkIcon' style='margin-left: 4px; opacity: 0.8; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/messageWall_none.png'>";
                } else {
                    $return .= " . <a title='" . _('Message Wall') . "' href='{$URL}'>" . $_SESSION[$guid]["messageWallCount"] . " x <img class='minorLinkIcon' style='margin-left: 4px; vertical-align: -75%' src='" . $_SESSION[$guid]["absoluteURL"] . "/themes/" . $_SESSION[$guid]["gibbonThemeName"] . "/img/messageWall.png'></a>";
                    if ($_SESSION[$guid]["pageLoads"] == 0 and ($_SESSION[$guid]["messengerLastBubble"] == NULL or $_SESSION[$guid]["messengerLastBubble"] < date("Y-m-d"))) {
                        print $messageBubbleBGColor = getSettingByScope($connection2, "Messenger", "messageBubbleBGColor");
                        $bubbleBG = "";
                        if ($messageBubbleBGColor != "") {
                            $bubbleBG = "; background-color: rgba(" . $messageBubbleBGColor . ")!important";
                            $return .= "<style>";
                            $return .= ".ui-tooltip, .arrow:after { {$bubbleBG} }";
                            $return .= "</style>";
                        }
                        $messageBubbleWidthType = getSettingByScope($connection2, "Messenger", "messageBubbleWidthType");
                        $bubbleWidth = 300;
                        $bubbleLeft = 770;
                        if ($messageBubbleWidthType == "Wide") {
                            $bubbleWidth = 700;
                            $bubbleLeft = 370;
                        }
                        if ($isHouseLogo) {
                            //Spacing with house logo
                            $bubbleLeft = $bubbleLeft - 70;
                            $return .= "<div id='messageBubbleArrow' style=\"left: 1019px; top: 58px; z-index: 9999\" class='arrow top'></div>";
                            $return .= "<div id='messageBubble' style=\"left: " . $bubbleLeft . "px; top: 74px; width: " . $bubbleWidth . "px; min-width: " . $bubbleWidth . "px; max-width: " . $bubbleWidth . "px; min-height: 100px; text-align: center; padding-bottom: 10px\" class=\"ui-tooltip ui-widget ui-corner-all ui-widget-content\" role=\"tooltip\">";
                        } else {
                            //Spacing without house logo
                            $return .= "<div id='messageBubbleArrow' style=\"left: 1089px; top: 38px; z-index: 9999\" class='arrow top'></div>";
                            $return .= "<div id='messageBubble' style=\"left: " . $bubbleLeft . "px; top: 54px; width: " . $bubbleWidth . "px; min-width: " . $bubbleWidth . "px; max-width: " . $bubbleWidth . "px; min-height: 100px; text-align: center; padding-bottom: 10px\" class=\"ui-tooltip ui-widget ui-corner-all ui-widget-content\" role=\"tooltip\">";
                        }
                        $return .= "<div class=\"ui-tooltip-content\">";
                        $return .= "<div style='font-weight: bold; font-style: italic; font-size: 120%; margin-top: 10px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dotted rgba(255,255,255,0.5); display: block'>" . _('New Messages') . "</div>";
                        $test = count($output);
                        if ($test > 3) {
                            $test = 3;
                        }
                        for ($i = 0; $i < $test; $i++) {
                            $return .= "<span style='font-size: 120%; font-weight: bold'>";
                            if (strlen($output[$i]["subject"]) <= 30) {
                                $return .= $output[$i]["subject"];
                            } else {
                                $return .= substr($output[$i]["subject"], 0, 30) . "...";
                            }
                            $return .= "</span><br/>";
                            $return .= "<i>" . $output[$i]["author"] . "</i><br/><br/>";
                        }
                        if (count($output) > 3) {
                            $return .= "<i>" . _('Plus more') . "...</i>";
                        }
                        $return .= "</div>";
                        $return .= "<div style='text-align: right; margin-top: 20px; color: #666'>";
                        $return .= "<a onclick='\$(\"#messageBubble\").hide(\"fade\", {}, 1); \$(\"#messageBubbleArrow\").hide(\"fade\", {}, 1)' style='text-decoration: none; color: #666' href='" . $URL . "'>" . _('Read All') . "</a> . ";
                        $return .= "<a style='text-decoration: none; color: #666' onclick='\$(\"#messageBubble\").hide(\"fade\", {}, 1000); \$(\"#messageBubbleArrow\").hide(\"fade\", {}, 1000)' href='#'>" . _('Dismiss') . "</a>";
                        $return .= "</div>";
                        $return .= "</div>";
                        $messageBubbleAutoHide = getSettingByScope($connection2, "Messenger", "messageBubbleAutoHide");
                        if ($messageBubbleAutoHide != "N") {
                            $return .= "<script type=\"text/javascript\">";
                            $return .= "\$(function() {";
                            $return .= "setTimeout(function() {";
                            $return .= "\$(\"#messageBubble\").hide('fade', {}, 3000)";
                            $return .= "}, 10000);";
                            $return .= "});";
                            $return .= "\$(function() {";
                            $return .= "setTimeout(function() {";
                            $return .= "\$(\"#messageBubbleArrow\").hide('fade', {}, 3000)";
                            $return .= "}, 10000);";
                            $return .= "});";
                            $return .= "</script>";
                        }
                        try {
                            $data = array("messengerLastBubble" => date("Y-m-d"), "gibbonPersonID" => $_SESSION[$guid]["gibbonPersonID"]);
                            $sql = "UPDATE gibbonPerson SET messengerLastBubble=:messengerLastBubble WHERE gibbonPersonID=:gibbonPersonID";
                            $result = $connection2->prepare($sql);
                            $result->execute($data);
                        } catch (PDOException $e) {
                        }
                    }
                }
            }
        }
        //House logo
        if (@$isHouseLogo) {
            $return .= " . <img class='minorLinkIconLarge' title='" . $_SESSION[$guid]["gibbonHouseIDName"] . "' style='vertical-align: -75%; margin-left: 4px' src='" . $_SESSION[$guid]["absoluteURL"] . "/" . $_SESSION[$guid]["gibbonHouseIDLogo"] . "'/>";
        }
    }
    return $return;
}
<?php

//printList.php
require '../includes/includeMeBlank.php';
require 'routineTaskTable.php';
//echo "IM PRINTING";
$date = $_GET['date'];
//This file checks permissions and then calls the function to print out the routine task list
$permission = can("update", "f9244d83-d0fe-4205-a4eb-f0a1c9de8d88");
//routineTasks resource// this is where permissions will be checked
tableHeader($permission);
getMessages($netID, $permission, $date, $area);
Beispiel #26
0
<?php

include_once '../../config/init.php';
include_once '../../database/messages.php';
if (is_null($_SESSION['username'])) {
    header('Location: ' . $BASE_URL . 'pages/session/login.php');
    exit;
}
$messages = getMessages($_SESSION['username'], $_GET['username']);
echo json_encode($messages);
//$smarty->assign('content', 'chat/messages.tpl');
//$smarty->display('application.tpl');
            if (++$popup_rows == ZBX_WIDGET_ROWS) {
                break;
            }
        }
        $problematic_count = (new CSpan($hosts_data[$group['groupid']]['problematic']))->addClass(ZBX_STYLE_LINK_ACTION)->setHint($table_inf);
    } else {
        $problematic_count = 0;
    }
    switch ($data['filter']['extAck']) {
        case EXTACK_OPTION_ALL:
            $group_row->addItem((new CCol($problematic_count))->addClass(getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic'])));
            $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']);
            break;
        case EXTACK_OPTION_UNACK:
            $group_row->addItem((new CCol($lastUnack_count))->addClass(getSeverityStyle(isset($highest_severity2[$group['groupid']]) ? $highest_severity2[$group['groupid']] : 0, $hosts_data[$group['groupid']]['lastUnack'])));
            $group_row->addItem($hosts_data[$group['groupid']]['lastUnack'] + $hosts_data[$group['groupid']]['ok']);
            break;
        case EXTACK_OPTION_BOTH:
            $unackspan = $lastUnack_count ? [$lastUnack_count, ' ' . _('of') . ' '] : null;
            $group_row->addItem((new CCol([$unackspan, $problematic_count]))->addClass(getSeverityStyle($highest_severity[$group['groupid']], $hosts_data[$group['groupid']]['problematic'])));
            $group_row->addItem($hosts_data[$group['groupid']]['problematic'] + $hosts_data[$group['groupid']]['ok']);
            break;
    }
    $table->addRow($group_row);
}
$output = ['header' => _('Host status'), 'body' => (new CDiv([getMessages(), $table]))->toString(), 'footer' => (new CListItem(_s('Updated: %s', zbx_date2str(TIME_FORMAT_SECONDS))))->toString()];
if ($data['user']['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
    CProfiler::getInstance()->stop();
    $output['debug'] = CProfiler::getInstance()->make()->toString();
}
echo (new CJson())->encode($output);
Beispiel #28
0
            echo '</div>';
        }
    }
    ?>
				</form>
			</div>
		</div>
		<br />
		<br />
		<div class="row">
			<div class="col-lg-12">
				<legend>Liste de vos messages</legend>
				<?php 
    // On apelle la fonction de récupération des messages
    include 'modele/messages/get_msg_function.php';
    getMessages($_SESSION['login']);
    ?>
			</div>
		</div>
		<br />
		<br />
		<br />
		<br />
		<br />
	</div>

	
	<?php 
    include 'footer.php';
    ?>
	
Beispiel #29
0
////////////////////////////////////////////////////////////////////////
$content .= <<<M
<div class="moduletitle">
  Documentos
</div>
<div class="submenu">
  <a href="?">Inicio</a> 
  <span class="level5">| <a href="?mode=mode">Modo</a></span>
</div>
<div class="container">
M;
////////////////////////////////////////////////////////////////////////
//BODY
////////////////////////////////////////////////////////////////////////
$content .= <<<C
<p>
En este módulo tendrá acceso a documentos de interés sobre el
Currículo en la Facultad de Ciencias Exactas y Naturales FCEN.
</p>
C;
////////////////////////////////////////////////////////////////////////
//FOOTER AND RENDER
////////////////////////////////////////////////////////////////////////
end:
$content .= "</div>";
$content .= getMessages();
$content .= getFooter();
echo $content;
?>
</html>
Beispiel #30
0
<?php

$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$type = isset($_GET['type']) ? $_GET['type'] : NULL;
$cat = isset($_GET['cat']) ? $_GET['cat'] : NULL;
$count = countMessages($mysql_link, $type, $cat);
if ($count != 0) {
    $messages = getMessages($mysql_link, $type, $cat, $page, PERPAGE);
    if (is_array($messages)) {
        $messages = messageIntro($messages);
    }
    $pager = Pager($page, $count, PERPAGE);
} else {
    $messages = FALSE;
    $pager = FALSE;
}
if ($type) {
    $type = '&type=' . $type;
}
if ($cat) {
    $cat = '&cat=' . $cat;
}
$content = template('content.tpl.php', array('title' => 'Главная страница', 'messages' => $messages, 'pager' => $pager, 'type' => $type, 'cat' => $cat));