Exemple #1
0
 public function action_create()
 {
     // Include the file needed to create the sitemap.
     include "lib/Sitemap.php";
     $sitemap = new Sitemap(C("esoTalk.baseURL"));
     $sitemap->setPath(PATH_ROOT . "/");
     $sitemap->addItem("", "1.0", "hourly", 'now');
     $result = ET::SQL()->select("ch.channelId")->select("ch.slug")->from("channel ch")->orderBy("ch.channelId ASC")->exec();
     $channels = $result->allRows("channelId");
     foreach ($channels as $channel) {
         if (!in_array($channel["slug"], C("plugin.Sitemap.channels"))) {
             $sitemap->addItem("conversations/" . $channel["slug"], C("plugin.Sitemap.priority3"), C("plugin.Sitemap.frequency3"), 'now');
             $result = ET::SQL()->select("c.conversationId")->select("c.title")->select("c.channelId")->select("c.sticky")->select("lastPostTime")->from("conversation c")->where("c.channelId = :channelId")->where("private", 0)->orderBy("c.conversationId ASC")->bind(":channelId", $channel["channelId"])->exec();
             $conversations = $result->allRows();
             foreach ($conversations as $conversation) {
                 $url = conversationURL($conversation["conversationId"], $conversation["title"]);
                 if ($conversation["sticky"]) {
                     $sitemap->addItem($url, C("plugin.Sitemap.priority2"), C("plugin.Sitemap.frequency2"), $conversation["lastPostTime"]);
                 } else {
                     $sitemap->addItem($url, C("plugin.Sitemap.priority1"), C("plugin.Sitemap.frequency1"), $conversation["lastPostTime"]);
                 }
             }
         }
     }
     $sitemap->createSitemapIndex("http://www.bitcoinclub.nl/", 'now');
 }
Exemple #2
0
function makeURL($startFrom = 0, $searchString = "")
{
    global $conversation;
    $urlParts = array(conversationURL($conversation["conversationId"], $conversation["title"]));
    if ($startFrom > 0 or $startFrom[0] == "p" or $startFrom == "last" or $startFrom == "unread" or $searchString) {
        $urlParts[] = $startFrom;
    }
    if ($searchString) {
        $urlParts[] = "?search={$searchString}";
    }
    return implode("/", $urlParts);
}
 public function conversationController_status($sender, $conversationId)
 {
     if (!$sender->validateToken()) {
         return;
     }
     $conversation = ET::conversationModel()->getById((int) $conversationId);
     if (!$conversation || !$conversation["canModerate"]) {
         $sender->renderMessage(T("Error"), T("message.noPermission"));
         return false;
     }
     $model = ET::conversationModel();
     $model->updateById($conversationId, array("status" => $_GET["status"]));
     redirect(URL(R("return", conversationURL($conversationId))));
 }
Exemple #4
0
 public function action_conversationController_unanswer($sender, $conversationId)
 {
     $conversation = ET::conversationModel()->getById($conversationId);
     if (!$conversation or !$sender->validateToken()) {
         return;
     }
     // Stop here with an error if the user isn't allowed to mark the conversation as answered.
     if ($conversation["startMemberId"] != ET::$session->userId and !$conversation["canModerate"]) {
         $sender->renderMessage(T("Error"), T("message.noPermission"));
         return false;
     }
     $model = ET::conversationModel();
     $model->updateById($conversation["conversationId"], array("answered" => 0));
     redirect(URL(R("return", conversationURL($conversation["conversationId"], $conversation["title"]))));
 }
Exemple #5
0
 /**
  * Toggle the muted flag of a conversation for the current user.
  *
  * @param int $conversationId The ID of the conversation.
  * @return void
  */
 public function action_conversationController_bookmark($controller, $conversationId = false)
 {
     if (!ET::$session->user or !$controller->validateToken()) {
         return;
     }
     // Get the conversation.
     if (!($conversation = $controller->getConversation($conversationId))) {
         return;
     }
     // Bookmark/unbookmark the conversation.
     $bookmarked = !$conversation["bookmarked"];
     $this->setBookmarked($conversation, ET::$session->userId, $bookmarked);
     $controller->json("bookmarked", $bookmarked);
     // Redirect back to the conversation.
     if ($controller->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL(R("return", conversationURL($conversation["conversationId"], $conversation["title"]))));
     } elseif ($controller->responseType === RESPONSE_TYPE_AJAX) {
         $controller->json("labels", $controller->getViewContents("conversation/labels", array("labels" => $conversation["labels"])));
     }
     $controller->render();
 }
Exemple #6
0
' class='<?php 
echo $className;
?>
'>
<?php 
if (ET::$session->user) {
    ?>
<div class='col-star'><?php 
    echo star($conversation["conversationId"], $conversation["starred"]);
    ?>
</div>
<?php 
}
?>
<div class='col-conversation'><?php 
$conversationURL = conversationURL($conversation["conversationId"], $conversation["title"]);
// Output the conversation title, highlighting search keywords.
echo "<strong class='title'><a href='" . URL($conversationURL) . "'>" . highlight(sanitizeHTML($conversation["title"]), ET::$session->get("highlight")) . "</a></strong> ";
// Output the conversation's labels.
echo "<span class='labels'>";
foreach ($conversation["labels"] as $label) {
    echo "<span class='label label-{$label}'>" . T("label.{$label}") . "</span> ";
}
echo "</span> ";
// Output an "unread indicator", showing the number of unread posts.
if (ET::$session->user and $conversation["unread"]) {
    echo "<a href='" . URL("conversation/markAsRead/" . $conversation["conversationId"] . "?token=" . ET::$session->token . "&return=" . urlencode(ET::$controller->selfURL)) . "' class='unreadIndicator' title='" . T("Mark as read") . "'>" . $conversation["unread"] . "</a> ";
}
// Output controls which apply to this conversation.
echo "<span class='controls'>";
// A Jump to last/unread link, depending on the user and the unread state.
Exemple #7
0
?>
' id='control-changeChannel'><i class='icon-tag'></i> <?php 
echo T("Change channel");
?>
</a>

</div>

<?php 
// Controls
if ($conversation["conversationId"]) {
    echo $form->saveButton();
    ?>
 
<a href='<?php 
    echo URL(R("return", conversationURL($conversation["conversationId"], $conversation["title"])));
    ?>
' class='button cancel'><?php 
    echo T("Cancel");
    ?>
</a>
<?php 
}
?>

<?php 
// Members allowed list (if starting a conversation)
if (!$conversation["conversationId"]) {
    ?>

<div id='conversationPrivacy' class='area'>
 /**
  * Returns a formatted email subject+body for the "post" activity type.
  *
  * @see mentionEmail() for parameter and return information.
  */
 public static function postEmail($item, $member)
 {
     $content = ET::formatter()->init($item["data"]["content"])->format()->get();
     $url = URL(conversationURL($item["data"]["conversationId"], $item["data"]["title"]) . "/unread", true);
     return array(sprintf(T("email.post.subject"), $item["data"]["title"]), sprintf(T("email.post.body"), name($item["fromMemberName"]), sanitizeHTML($item["data"]["title"]), $content, "<a href='{$url}'>{$url}</a>"));
 }
 /**
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 public function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteTime"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteTime"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteTime"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     $date = smartTime($post["time"], true);
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . _strftime(T("date.full"), $post["time"]) . "' data-timestamp='" . $post["time"] . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteTime"]) {
         // Add the user's online status / last action next to their name.
         if (empty($post["preferences"]["hideOnline"])) {
             $lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
             if ($lastAction[0]) {
                 $lastAction[0] = " (" . sanitizeHTML($lastAction[0]) . ")";
             }
             if ($lastAction) {
                 array_unshift($formatted["info"], "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . "{$lastAction[0]}'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">");
             }
         }
         // Show the user's group type.
         $formatted["info"][] = "<span class='group'>" . memberGroup($post["account"], $post["groups"]) . "</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . _strftime(T("date.full"), $post["editTime"]) . "' data-timestamp='" . $post["editTime"] . "'>" . relativeTime($post["editTime"], true) . "</span>", memberLink($post["editMemberId"], $post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         } elseif (!$conversation["locked"] && !ET::$session->isSuspended() && $post["memberId"] == ET::$session->userId && (!$post["deleteMemberId"] || $post["deleteMemberId"] == ET::$session->userId) && C("esoTalk.conversation.editPostTimeLimit") == "reply") {
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-edit disabled'><i class='icon-edit'></i></span>";
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-delete disabled'><i class='icon-remove'></i></span>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . _strftime(T("date.full"), $post["deleteTime"]) . "' data-timestamp='" . $post["deleteTime"] . "'>" . relativeTime($post["deleteTime"], true) . "</span>", memberLink($post["deleteMemberId"], $post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
 /**
  * Return a formatted last action array for the "viewingConversation" type.
  *
  * @param array $data An array of data associated with the last action.
  * @return array 0 => last action description, 1 => URL
  */
 public static function lastActionViewingConversation($data)
 {
     if (empty($data["conversationId"])) {
         return array(sprintf(T("Viewing %s"), T("a private conversation")));
     }
     return array(sprintf(T("Viewing: %s"), $data["title"]), URL(conversationURL($data["conversationId"], $data["title"])));
 }
 /**
  * Returns a formatted email subject+body for the "replyToStarred" activity type.
  *
  * @see mentionEmail() for parameter and return information.
  */
 public static function postEmail($item, $member)
 {
     return array(sprintf(T("email.replyToStarred.subject"), sanitizeHTML($item["data"]["title"])), sprintf(T("email.replyToStarred.body"), name($item["fromMemberName"]), sanitizeHTML($item["data"]["title"]), URL(conversationURL($item["data"]["conversationId"], $item["data"]["title"]) . "/unread", true)));
 }
 /**
  * 投稿単位(post)の出力用編集メソッド
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 protected function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     // title: SWCユーザ名を表示するように設定対応
     // purl: 追加。SNSボタンリンク用に投稿単位の絶対urlを設定
     // likeCnt: 追加。いいねボタンのカウント数設定
     // mainPostFlg: 追加。テーマのメイン投稿(最初の投稿)フラグ
     $formatted = array("id" => "p" . $post["postId"], "conversationId" => $post["conversationId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteMemberId"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteMemberId"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteMemberId"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "purl" => URL(postURL($post["postId"]), TRUE), "likeCnt" => $post["likeCnt"], "mainPostFlg" => $post["mainPostFlg"], "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     // いいね済みフラグ
     $formatted["liked"] = $post["likeActivityId"] ? 1 : "";
     //	$date = smartTime($post["time"], true);
     $date = SwcUtils::getStrfTime($post["time"], T("date.short"));
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . strftime(T("date.full"), $post["time"]) . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteMemberId"]) {
         // Add the user's online status / last action next to their name.
         //		if (empty($post["preferences"]["hideOnline"])) {
         //			$lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
         //			if ($lastAction[0]) $lastAction[0] = " (".sanitizeHTML($lastAction[0]).")";
         //			if ($lastAction) array_unshift($formatted["info"], "<".(!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span")." class='online' title='".T("Online")."{$lastAction[0]}'><i class='icon-circle'></i></".(!empty($lastAction[1]) ? "a" : "span").">");
         //		}
         // Show the user's group type.
         //		$formatted["info"][] = "<span class='group'>".memberGroup($post["account"], $post["groups"])."</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . strftime(T("date.full"), $post["editTime"]) . "'>" . relativeTime($post["editTime"], true) . "</span>", name($post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . strftime(T("date.full"), $post["deleteTime"]) . "'>" . relativeTime($post["deleteTime"], true) . "</span>", name($post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
 /**
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 protected function formatPostForTemplate($post, $conversation)
 {
     $canEdit = $this->canEditPost($post, $conversation);
     $avatar = avatar($post["memberId"], $post["avatarFormat"]);
     // Construct the post array for use in the post view (conversation/post).
     $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteMemberId"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteMemberId"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteMemberId"] ? $this->displayPost($post["content"]) : false, "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     // If the post was within the last 24 hours, show a relative time (eg. 2 hours ago.)
     if (time() - $post["time"] < 24 * 60 * 60) {
         $date = relativeTime($post["time"], true);
     } else {
         $date = date("M j", $post["time"]);
     }
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . date(T("date.full"), $post["time"]) . "'>" . (!empty($conversation["searching"]) ? T("Context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteMemberId"]) {
         // Add the user's online status / last action next to their name.
         $lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
         if ($lastAction[0]) {
             $lastAction[0] = " (" . sanitizeHTML($lastAction[0]) . ")";
         }
         if ($lastAction) {
             array_unshift($formatted["info"], "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . "{$lastAction[0]}'>" . T("Online") . "</" . (!empty($lastAction[1]) ? "a" : "span") . ">");
         }
         // Show the user's group type.
         $formatted["info"][] = "<span class='group'>" . memberGroup($post["account"], $post["groups"]) . "</span>";
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . date(T("date.full"), $post["editTime"]) . "'>" . relativeTime($post["editTime"], true) . "</span>", $post["editMemberName"]) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'>" . T("Quote") . "</a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'>" . T("Edit") . "</a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'>" . T("Delete") . "</a>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . date(T("date.full"), $post["deleteTime"]) . "'>" . relativeTime($post["deleteTime"], true) . "</span>", $post["deleteMemberName"]) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'>" . T("Restore") . "</a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
Exemple #14
0
 public static function postMemberEmail($item, $member)
 {
     $content = ET::formatter()->init($item["data"]["content"])->basic(true)->format()->get();
     return array(sprintf(T("email.postMember.subject"), name($item["fromMemberName"], false)), sprintf(T("email.postMember.body"), name($item["fromMemberName"]), sanitizeHTML($item["data"]["title"]), $content, URL(conversationURL($item["data"]["conversationId"], $item["data"]["title"]) . "/unread", true)));
 }