public function updateFile() { $my = JXFactory::getUser(); $file_id = JRequest::getInt('file_id'); $file_name = JRequest::getVar('new_name', ''); $result = new stdClass(); $result->result = false; if (intval($file_id) > 0 && preg_match("/^[^\\/?*:;{}\\\\]+\$/", $file_name)) { $file = JTable::getInstance('File', 'StreamTable'); if ($file->load($file_id)) { if ($my->authorise('stream.file.edit', $file)) { $originalName = explode('.', $file->filename); $extension = array_pop($originalName); $file->filename = $file_name . '.' . $extension; $file->store(); $result->result = true; $result->fileid = $file_id; $result->filename = StreamTemplate::escape(JHtmlString::truncate($file->filename, 32)); $result->full_filename = StreamTemplate::escape(preg_replace('/\\.[a-z]+$/i', '', $file->filename)); } else { $result->error = JText::_('Not authorized to edit file!'); } } else { $result->error = $file->getError(); } } else { $result->error = JText::_('Invalid filename!'); } echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); exit; }
public function getInput() { $this->_multiFieldsId = 'multiTexts_' . $this->id; $values = json_decode($this->value, true); // decode data from db $totalRows = 1; $html = $jsInputHtml = array(); $html[] = '<div id="' . $this->_multiFieldsId . '" class="' . $this->type . '">'; if ($values !== null) { $totalRows = count($values); } for ($i = 0; $i < $totalRows; $i++) { $html[] = '<p class="' . $this->type . '">'; foreach ($this->element->children() as $element) { // if the javascript modify the input field by ADD/REMOVE field, it will break the iteration index. // skipping unexistent field as a sanity check //if (empty($values[$i])) continue; $fieldValue = StreamTemplate::escape($values[$i][(string) $element['name']]); // bind values from json decoded array $elementName = $this->name . "[{$i}][" . $element['name'] . "]"; // name for POST $showRemove = false; // hide remove button if ($i > 0) { $showRemove = true; } if ($element['type'] == 'list') { // create a new select list $html[] = $this->_getSelectList($element, $elementName, $fieldValue); if ($i == 0) { // only need one as the rest will dynamically added with js $jsInputHtml[] = $this->_getSelectList($element, $elementName); } } elseif ($element['type'] == 'text') { // create a new input field $html[] = $this->_getInputField($element, $elementName, $fieldValue, $showRemove); if ($i == 0) { // only need one as the rest will dynamically added with js $jsInputHtml[] = $this->_getInputField($element, $elementName, '', true); } } } if ($i == 0) { $html[] = '<a href="#" id="add"><span>Add</span></a>'; } $html[] = '</p>'; } $html[] = '</div>'; $this->_attachScripts($jsInputHtml); return implode($html); }
echo StreamTemplate::escape($user->name); ?> created Milestone: <?php } else { ?> Milestone updated - <?php } ?> <a href="<?php echo $stream->getUri(); ?> "> <?php echo StreamTemplate::escape($stream->message); ?> </a> </span> <span class="meta-date-compact"> - <?php //$date = new JDate( $stream->created ); $startDate = new JDate($stream->start_date); ?> <a class="meta-date" href="<?php echo $stream->getUri(); ?> "><?php echo $startDate->format(JText::_('JXLIB_DATE_SHORT_FORMAT'));
<h3>Files</h3> <a href="<?php echo JRoute::_('index.php?option=com_stream&view=files&user_id=' . $this->user->id); ?> ">Show All (<?php echo $this->fileCount; ?> )</a> </div> <ol class="content-list"> <?php foreach ($this->files as $file) { $dlLink = JRoute::_('index.php?option=com_stream&view=system&task=download&file_id=' . $file->id); echo '<li class="message-content-file">'; echo '<a title="Click to download" href="' . $dlLink . '">' . StreamTemplate::escape(JHtmlString::truncate($file->filename, 24)) . '</a>'; echo ' <span class="small hint">(' . StreamMessage::formatBytes($file->filesize, 1) . ')</span>'; echo '</li>'; } ?> </ol> </div> <div class="data-grid"> <div class="content-title"> <h3>Links</h3> <a href="<?php echo JRoute::_('index.php?option=com_stream&view=links&user_id=' . $this->user->id); ?>
<ul id="edit-attachment-list" class="edit-attachment"> <!-- show attachement to allow file deletion --> <?php if (!empty($files)) { foreach ($files as $file) { ?> <li style="list-style: none outside none;margin-left:0px;padding-left: 8px;" class="qq-upload-success"> <div data-filename="<?php echo $file->filename; ?> " class="message-content-file" file_id="<?php echo $file->id; ?> "> <?php echo StreamTemplate::escape(JHtmlString::abridge($file->filename, 24)); ?> <span class="small hint">(<?php echo StreamMessage::formatBytes($file->filesize, 1); ?> )</span> <a file_id="<?php echo $file->id; ?> " href="#unlinkAttachment" class="meta-edit">Remove</a> <input type="hidden" value="<?php echo $file->id; ?> " name="attachment[]"> </div> </li>
<?php } ?> <?php if ($nextMsg->id) { ?> <p class="next"> <a href="<?php echo $nextMsg->getUri(); ?> "><?php echo JText::_('COM_STREAM_BLOG_NEXT'); ?> : <?php echo StreamTemplate::escape(JHtmlString::truncate($nextMsg->getData()->title, 32)); ?> →</a> </p> <?php } ?> <div class="clear"></div> </div> <?php } ?> <div class="clear"></div> </li>
echo $position->category; } } } else { // If it's not decoded it means it's not a multiple value field/array echo StreamTemplate::escape($field->value); } } else { echo '<ul>'; foreach ($values as $value) { echo '<li><div class="profile-arrow">›</div>'; // Get the last item so we can wrap it with rounded brackets $last_item = end($value); foreach ($value as $elementKey => $elementValue) { echo '<div class="' . $elementKey . ' details-' . strtolower(str_replace(' ', '-', $elementValue)) . '">'; echo StreamTemplate::escape($elementValue); echo '</div>'; } echo '<div class="clear"></div></li>'; } echo '</ul>'; } echo '</div>'; echo '</div>'; echo '<div class="clear"></div>'; ?> </li> <?php } ?>
<ul> <?php foreach ($users as $user) { $name = $user->name; ?> <li class="eList" onclick="S.suggestMember.add(this, '<?php echo $user->id; ?> ');"><img src="<?php echo $user->getThumbAvatarURL(); ?> "><span><span class="eList-Bold"></span><?php echo StreamTemplate::escape($name); ?> </span></li> <?php } ?> </ul>
<div class="clear"></div> </li> <li> <label for="params_group_limited" class=""><?php echo JText::_('COM_ACCOUNT_LABEL_GROUP_LIMITED'); ?> </label> <div class="params-invitation"> <?php foreach ($this->myJoinedGroups as $idx => $group) { ?> <input type="checkbox" class="checkbox" name="params[group_limited][]" value="<?php echo $group->id; ?> "><?php echo StreamTemplate::escape($group->name); ?> <br> <?php } ?> </div> <div class="clear"></div> </li> </ul> <div class="submit"> <?php if ($this->allowInvite) { ?> <input type="hidden" value="invite" name="task"/> <input class="btn btn-info" type="submit" value="<?php
public static function getMentionUserId($strMessage) { $arrUserId = array(); if (empty($strMessage)) { return $arrUserId; } $str = StreamTemplate::escape($strMessage); // Autolinked the @username preg_match_all("/@([\\w.]+)/", $str, $matches, PREG_SET_ORDER); if (!empty($matches)) { foreach ($matches as $username) { // Find out if the user exist $userId = JuserHelper::getUserId($username[1]); $username[3] = $userId; $arrUserId[$userId] = $username; } // reorder to that the longest username gets replaced first usort($arrUserId, function ($a, $b) { if (strlen($a[0]) > strlen($b[0])) { return -1; } if (strlen($a[0]) < strlen($b[0])) { return 1; } return 0; }); } return $arrUserId; }
<?php if ($userWhoViewed && count($userWhoViewed) > 0) { ?> <div class="user-horizontal-list"> <div class="small"> <?php echo JText::_('COM_STREAM_LABEL_READ_BY'); ?> <?php $avatarListWhoMakeAction = ''; $avatarListWhoMakeAction .= '<a href="#showReaders" data-content="<ul>'; foreach ($userWhoViewed as $user_id) { // there will be 0 as user which in return will load current user if ($user_id != 0 && $user_id != NULL) { $user = JXFactory::getUser($user_id); $avatarListWhoMakeAction .= StreamTemplate::escape('<li><a href="' . $user->getURL() . '">' . $user->name . '</a></li>'); } } $avatarListWhoMakeAction .= '</ul>">'; $label = count($userWhoViewed) > 1 ? JText::_('COM_STREAM_LABEL_USERS') : JText::_('COM_STREAM_LABEL_USER'); $avatarListWhoMakeAction .= count($userWhoViewed) . " {$label}</a>"; echo $avatarListWhoMakeAction; ?> </div> </div> <?php } ?> </div> <div class="message-meta-compact" style="display: none;">
<?php $document = JFactory::getDocument(); $docTitle = $document->getTitle(); $groupTitle = StreamTemplate::escape($docTitle); $task = JRequest::getVar('task'); ?> <div class="group-page-title clearfix"> <div class="group-page-title-inner pull-left"> <h1><?php echo $groupTitle; ?> </h1> <?php if ($group->access) { ?> <span class="label label-danger">Private Group</span> <?php } elseif ($group->archived) { ?> <span class="label">Archived Group</span> <?php } else { ?>
} else { ?> <a href="<?php echo JRoute::_('index.php?option=com_stream&view=groups&task=show&group_id=' . $group->id); ?> "><?php echo $this->escape($group->name); ?> </a> <?php } ?> </div> <div class="group-list-desc"> <?php echo StreamTemplate::escape($group->description); ?> </div> <div class="group-list-content"> <div class="user-horizontal-list"> <label class="bold">Members:</label> <?php foreach ($members as $row) { $user = JXFactory::getUser($row); ?> <span class="user-list"> <a href="<?php echo $user->getURL(); ?> "> <img title="<?php
foreach ($readBy as $recipientId) { $readByUsers[] = JXFactory::getUser($recipientId)->name; } echo implode(', ', $readByUsers); ?> <?php } ?> </span> </div> </li> <li class="inbox-delete"> <a href="" class="close">×</a> </li> <?php if (!empty($attachments)) { echo '<li style="border-top: 1px solid #EFEFEF; width: 540px; margin-left: 40px;">'; foreach ($attachments as $attachment) { $dlLink = JRoute::_('index.php?option=com_messaging&task=download&file_id=' . $attachment->id); $html = '<div class="message-content-file ">'; $html .= '<a title="Click to download" href="' . $dlLink . '">' . StreamTemplate::escape(JHtmlString::abridge($attachment->filename, 16)) . '</a>'; $html .= ' <span class="small hint">(' . StreamMessage::formatBytes($attachment->filesize, 1) . ')</span>'; $html .= '</div>'; echo $html; } echo '</li>'; } ?> </ul> </li>
* To change this template, choose Tools | Templates * and open the template in the editor. */ ?> <div class="task-list"> <div class="milestone-task <?php //if($task->status == StreamTodoType::COMPLETED) { echo 'toggle-item'; } ?> "> <!--CSSHACK--> <div class="milestone-task-title"> <a href="<?php echo $task->getUri(); ?> "><?php echo StreamTemplate::escape($task->message); ?> </a> <span> • <a href="#toggleTasks">View all tasks</a></span> </div> <ul class="todolist noBorder" id="todo-list-<?php echo $task->id; ?> "> <?php $todoData = json_decode($task->raw); $todoIndex = 0; $numTodo = count($todoData->todo); $doneTodo = 0; foreach ($todoData->todo as $todo) { // @todo: move checking to input filtering
<div class="clear"></div> </div> <!-- Components --> <div id="main-content" class="grid_9 alpha omega"> <div id="content-left" class="grid_6"> <jdoc:include type="modules" name="breadcrumbs" style="none"/> <jdoc:include type="message" /> <jdoc:include type="modules" name="component_top" style="default"/> <?php // If page title is set, add it here. BUT, don't show it // if it is the same as site title (which mean, the title is not set) $docTitle = $document->getTitle(); if (!empty($docTitle) && $docTitle != $config->sitename) { echo '<h1>' . StreamTemplate::escape($docTitle) . '</h1>'; } ?> <jdoc:include type="component" /> <jdoc:include type="modules" name="component_bottom" style="default"/> </div> <div id="sidebar-right" class="grid_3"> <?php // Add guest invite right module $accountView = AccountFactory::getView('invite'); JXModule::addBuffer('right', $accountView->modMemberInvite()); $buffer =& JXModule::getBuffer('right'); foreach ($buffer as $buff) { echo $buff;
function offiria_list_groups($groups, $title, $groupIJoin, $groupIFollow) { $group_id = JRequest::getVar('group_id'); $my = JXFactory::getUser(); $streamModel = StreamFactory::getModel('stream'); ?> <div class="groups-listing followed"> <h3><?php echo $title; ?> </h3> <?php // Only show list of groups if there is any if (!empty($groups)) { ?> <ul> <?php foreach ($groups as $group) { ?> <li class="groups <?php if ($group_id == $group->id) { echo 'active'; } ?> "> <?php $lastReadId = $my->getParam('group_' . $group->id . '_read'); $statusClass = JXUtility::csvExist($groupIJoin, $group->id) ? 'joined' : 'followed'; $groupLastMsg = $group->getParam('last_message'); $groupNewMsg = 0; // Only calculate if there is a diff here if ($lastReadId != $groupLastMsg) { $groupNewMsg = $streamModel->countStream(array('!user_id' => $my->id, 'id_more' => $lastReadId, 'group_id' => $group->id)); } $styleHide = ''; ?> <a class="<?php echo $statusClass; ?> " id="groups_<?php echo $group->id; ?> _link" href="<?php echo JRoute::_('index.php?option=com_stream&view=groups&task=show&group_id=' . $group->id); ?> "><?php echo StreamTemplate::escape($group->name); ?> </a> <?php if (intval($groupNewMsg) == 0) { $styleHide = 'display:none'; } echo '<span style="' . $styleHide . '" class="navigator-notice" id="groups_' . $group->id . '">' . intval($groupNewMsg) . '</span>'; ?> <!-- <span class="navigator-notice"></span> --> </li> <?php } ?> </ul> <?php } ?> </div> <?php }
</p> </div> <div class="group-module-members"> <span class="count-members"><strong><?php echo JXUtility::csvCount($group->members); ?> </strong> <?php echo JText::_('COM_STREAM_LABEL_MEMBERS'); ?> </span> <span class="count-followers"><a data-group_id="<?php echo $group->id; ?> " data-content="<?php echo StreamTemplate::escape($followersHtml); ?> " href="#showFollowers"><strong><?php echo JXUtility::csvCount(JXUtility::csvDiff($group->followers, $group->members)); ?> </strong> <?php echo JText::_('COM_STREAM_LABEL_FOLLOWERS'); ?> </a></span> </div> </div> <?php /*?> <div class="group-module-actions"> <form name="group-actions">
} } ?> (<?php echo StreamMessage::formatBytes($row->filesize); ?> ) </span> <div class="file-list-meta-content"> <div class="file-list-meta-inner"> <span>Attached in:</span> <a href="<?php echo $streamObj->getUri(); ?> "><?php echo StreamTemplate::escape(JHtmlString::truncate($streamObj->message, 200)); ?> </a> </div> <span class="uploader"><a href="<?php echo $user->getURL(); ?> " class="actor-link"><?php echo $this->escape($user->name); ?> </a></span> </div> </div> <?php /*
?> </span> <?php if (!empty($rowData->group_limited)) { ?> <?php echo JText::_('Limited to these groups'); ?> : <span class="last-invite-date"> <?php $groupModel = StreamFactory::getModel('groups'); $limitedGroups = $groupModel->getGroups(array('id' => $rowData->group_limited), 100); foreach ($limitedGroups as $idx => $group) { echo '• ' . StreamTemplate::escape($group->name) . '<br />'; } ?> </span> <?php } ?> </span> </div> </td> <td><span class="label label-info"><?php echo $rowData->translateStatus($rowData->status); ?> </span></td> <td>
/** * Return */ public function modGetPendingTask($inFilter) { $tasks = ''; $tmpl = new StreamTemplate(); $model = StreamFactory::getModel('stream'); $my = JXFactory::getUser(); // Get todo list with due date $filter = array(); $filter['type'] = 'todo'; $filter['has_end_date'] = true; $filter['order_by_asc'] = 'end_date'; $filter = array_merge($filter, $inFilter); $data = $model->getStream($filter); // calculate total task $hasWarnDue = false; $hasWarnToday = false; $hasWarnThisWeek = false; $hasWarnLater = false; $username = ''; $showName = JRequest::getVar('option') == 'com_stream'; $today = new JXDate(); //echo count($data); exit; foreach ($data as $stream) { $dueDate = new JDate($stream->end_date); $raw = json_decode($stream->raw); $todoIndex = 0; $class = $my->authorise('stream.todo.done', $stream) ? '' : 'readonly'; foreach ($raw->todo as $todo) { if (!empty($todo)) { if (!$stream->getState($todoIndex)) { // Put the due labels if ($today->isOverdue($dueDate)) { if (!$hasWarnDue) { $tasks .= '<li class="todo-overdue"><span class="label label-important">' . JText::_('COM_PROFILE_LABEL_OVERDUE') . '</span></li>'; $hasWarnDue = true; } } elseif ($today->isToday($dueDate)) { if (!$hasWarnToday) { $tasks .= '<li class="todo-today"><span class="label label-success">' . JText::_('COM_PROFILE_LABEL_TODAY') . '</span></li>'; $hasWarnToday = true; } } elseif ($today->isThisWeek($dueDate)) { if (!$hasWarnThisWeek) { $tasks .= '<li class="todo-thisweek"><span class="label label-warning">' . JText::_('COM_PROFILE_LABEL_THIS_WEEK') . '</span></li>'; $hasWarnThisWeek = true; } } elseif (!$hasWarnLater) { $tasks .= '<li class="todo-later"><span class="label">' . JText::_('COM_PROFILE_LABEL_LATER') . '</span></li>'; $hasWarnLater = true; } // end due labels if ($showName) { $username = '******' . StreamTemplate::escape(JXFactory::getUser($stream->user_id)->name) . '</span>'; } $tasks .= '<li class="clearfix todo-item"><a class="done-todo-item ' . $class . '" data-message_id="' . $stream->id . '" data-todo_index="' . $todoIndex . '" href="javascript: void(0);"></a><span>' . StreamMessage::format($todo) . $username . '</span></li>'; } $todoIndex++; } } } // Get todo with NO due date unset($filter); $filter = array(); $filter['type'] = 'todo'; $filter['!has_end_date'] = true; $filter['order_by_asc'] = 'id'; $filter = array_merge($filter, $inFilter); $data = $model->getStream($filter); $hasWarnAnytime = false; foreach ($data as $stream) { $raw = json_decode($stream->raw); $todoIndex = 0; foreach ($raw->todo as $todo) { if (!empty($todo)) { $class = $my->authorise('stream.todo.done', $stream) ? '' : 'readonly'; if (!$stream->getState($todoIndex)) { if (!$hasWarnAnytime) { $tasks .= '<li class="todo-anytime"><span class="label">' . JText::_('COM_PROFILE_LABEL_ANYTIME') . '</span></li>'; $hasWarnAnytime = true; } if ($showName) { $username = '******' . StreamTemplate::escape(JXFactory::getUser($stream->user_id)->name) . '</span>'; } $tasks .= '<li class="clearfix todo-item"><a class="done-todo-item ' . $class . '" data-message_id="' . $stream->id . '" data-todo_index="' . $todoIndex . '" href="javascript:void(0);"></a><span>' . StreamMessage::format($todo) . $username . '</span></li>'; } $todoIndex++; } } } if (empty($tasks)) { $tasks = '<div class="alert-message block-message info"><p>' . JText::_('COM_STREAM_LABEL_NO_PENDING_TASK') . '</p></div>'; } $tmpl->set('tasks', $tasks); return $tmpl->fetch('todo.module.pending'); }
<?php $date = new JDate($stream->created); $user = JXFactory::getUser($stream->user_id); ?> <li class="<?php echo $stream->group_id ? 'notification-group' : 'notification-public'; ?> "> <?php echo JHtmlString::truncate($stream->message, 40); ?> <br/> <span class="hint small"><?php echo StreamTemplate::escape($user->name); ?> , <a href="<?php echo $stream->getUri(); ?> "><?php echo JXDate::formatLapse($date); ?> </a></span> <div class="clear"></div> </li>
?> <?php if (isset($filterArr['create_start'])) { ?> <span class="filtered-item tags">from <strong><?php echo StreamTemplate::escape($filterArr['create_start'][0]); ?> </strong></span> <?php } ?> <?php if (isset($filterArr['create_end'])) { ?> <span class="filtered-item tags">to <strong><?php echo StreamTemplate::escape($filterArr['create_end'][0]); ?> </strong></span> <?php } ?> </div> <?php } ?> <div class="customlist-filter clearfix" id="cl-view-edit" style="display: none"> <div class="cl-text pull-left">Messages</div> <ul class="customlist-list clearfix pull-left"> <li class="filter-item groups">
<!-- Milestone Start --> <?php if (isset($data->milestone) && !empty($data->milestone)) { ?> <div class="message-milestone"> <?php $milestone = JTable::getInstance('Stream', 'StreamTable'); $milestone->load($data->milestone); $mDate = new JDate($milestone->start_date); ?> Milestone: <a href="<?php echo $milestone->getUri(); ?> "><?php echo StreamTemplate::escape($milestone->message); ?> </a> - <span class="hint"><?php echo $mDate->format(JText::_('JXLIB_DATE_SHORT_FORMAT')); ?> </span> </div> <?php } ?> <!-- Milestone End --> <div class="message-todo-item"> <ul class="todo-item"> <?php