<?php foreach ($_['conversation'] as $post) : 
	$post = OC_Conversations::preparePost($post);
	extract($post); ?>
	<div class="comment" data-id="<?php p($id); ?>">
		<div class="comment-header">
			<?php if ( ! empty($avatar) ) { ?>
				<div class="avatar">
					<img src="<?php p($avatar); ?>" />
				</div>
			<?php } ?>
			<div class="author">
				<strong><?php p(OC_User::getDisplayName($author)); ?></strong>				
			</div>
			<div class="date">
				<time class="timeago" datetime="<?php p($date['ISO8601']); ?>"><?php p($date['datetime']); ?></time>
			</div>
			<?php 
			$uid = OC_User::getUser();
			if( USER_CONVERSATIONS_CAN_DELETE && ( OC_User::isAdminUser($uid) || $author == $uid ) ): ?>
				<div class="delete"><a href="#" class="action delete delete-icon"></a></div>
			<?php endif; ?>
		</div>
		<?php if ( ! empty($text) ) { ?>
			<div class="comment-text">
				<?php print_unescaped( $text ); ?>
			</div>
		<?php } 
		if ( ! empty($attachment) ) { ?>
			<div class="comment-attachment">
				<?php echo $this->inc('part.attachment', array('attachment' => $attachment)); ?>
			</div>
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$room = isset($_REQUEST['room']) ? $_REQUEST['room'] : false;
// TODO: remove room argument!
if ($room) {
    // store room as user default
    OCP\Config::setUserValue(OC_User::getUser(), 'conversations', 'activeRoom', $room);
    // read the next 30 items for the endless scrolling
    // get the page that is requested. Needed for endless scrolling
    $count = 5;
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0;
    $from_id = isset($_REQUEST['from_id']) ? intval($_REQUEST['from_id']) : null;
    // load room
    $tmpl = new OCP\Template('conversations', 'part.conversation');
    $tmpl->assign('conversation', OC_Conversations::getConversation(false, $page * $count, $count, $from_id));
    if (isset($_REQUEST['print_tmpl'])) {
        // print for infinite scroll
        $tmpl->printPage();
    } else {
        // return json for submit or polling
        $conversation = $tmpl->fetchPage();
        OCP\JSON::success(array('data' => array('conversation' => $conversation)));
    }
}
        $showUsers = true;
        $newMsgCounter = 0;
        foreach ($_['rooms'] as $rid => $room) {
            $room_name = $room['name'];
            if ($room['type'] == "group" && $showGroups) {
                $showGroups = false;
                ?>
						<li class='user-label'><label><?php 
                p($l->t("Groups"));
                ?>
</label></li>
					<?php 
            }
            if ($room['type'] == "user") {
                $room_name = OC_User::getDisplayName($room['name']);
                $avatar = OC_Conversations::getUserAvatar($room['name']);
                if ($showUsers) {
                    $showUsers = false;
                    ?>
							<li class='user-label'><label><?php 
                    p($l->t("User"));
                    ?>
</label></li>
						<?php 
                }
            }
            ?>
					<li class="<?php 
            p($room['type']);
            ?>
 <?php 
<?php

/**
* ownCloud - User Conversations
*
* @author Simeon Ackermann
* @copyright 2014 Simeon Ackermann amseon@web.de
* 
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$comment = isset($_POST['comment']) ? $_POST['comment'] : false;
$attachment = isset($_POST['attachment']) ? $_POST['attachment'] : false;
if ($comment || $attachment) {
    OC_Conversations::newComment($comment, $attachment);
    OCP\JSON::success(array());
}
/**
* ownCloud - User Conversations
*
* @author Simeon Ackermann
* @copyright 2014 Simeon Ackermann amseon@web.de
* 
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$id = isset($_POST['id']) ? $_POST['id'] : false;
if ($id) {
    $result = OC_Conversations::deleteComment($id);
    if ($result) {
        OCP\JSON::success(array());
    }
}
* 
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$path = isset($_POST['path']) ? $_POST['path'] : false;
if ($path) {
    $room = OC_Conversations::getRoom();
    $userId = OC_User::getUser();
    \OC_Util::setupFS($userId);
    \OC\Files\Filesystem::initMountPoints($userId);
    $view = new \OC\Files\View('/' . $userId . '/files');
    $fileinfo = $view->getFileInfo($path);
    $owner = $view->getOwner($path);
    if (strpos($fileinfo['mimetype'], "image") !== false) {
        $type = 'internal_image';
    } else {
        $type = 'internal_file';
    }
    $download_url = OCP\Util::linkToRoute('download', array('file' => $path));
    // File not found
    if (\OC\Files\Filesystem::is_file($path) == false) {
        $fileinfo['name'] = "File not found.";
OCP\Util::addScript('conversations', 'jquery.timeago');
OCP\Util::addstyle('conversations', 'style');
// add timeago translations
$lang = OC_L10N::findLanguage('conversations');
// TODO: may find a better solution than file_exists
if (in_array($lang, OC_L10N::findAvailableLanguages('conversations')) && file_exists('./apps/conversations/js/jquery.timeago.' . $lang . '.js')) {
    OCP\Util::addScript('conversations', 'jquery.timeago.' . $lang);
}
// rooms
$rooms = OC_Conversations::getRooms();
$updates = OC_Conversations::updateCheck();
$rooms = array_merge_recursive($rooms, $updates);
// get the page that is requested. Needed for endless scrolling
$count = 5;
if (isset($_GET['page'])) {
    $page = intval($_GET['page']) - 1;
} else {
    $page = 0;
}
$nextpage = \OCP\Util::linkToAbsolute('conversations', 'index.php', array('page' => $page + 2));
$tmpl = new OCP\Template('conversations', 'main', 'user');
if (!empty($rooms)) {
    $tmpl->assign('rooms', $rooms);
}
if ($page == 0) {
    $tmpl->assign('nextpage', $nextpage);
}
$room = OC_Conversations::getRoom();
$tmpl->assign('active_room', $room);
$tmpl->assign('conversation', OC_Conversations::getConversation($room, $page * $count, $count));
$tmpl->printPage();
<?php

/**
* ownCloud - User Conversations
*
* @author Simeon Ackermann
* @copyright 2014 Simeon Ackermann amseon@web.de
* 
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either 
* version 3 of the License, or any later version.
* 
* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$update = OC_Conversations::updateCheck();
OCP\JSON::success(array('data' => $update));