当前位置: 首页>>代码示例>>PHP>>正文


PHP ET::memberModel方法代码示例

本文整理汇总了PHP中ET::memberModel方法的典型用法代码示例。如果您正苦于以下问题:PHP ET::memberModel方法的具体用法?PHP ET::memberModel怎么用?PHP ET::memberModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ET的用法示例。


在下文中一共展示了ET::memberModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 /**
  * Perform a fresh installation of the esoTalk database. Create the table structure and insert default data.
  *
  * @param array $info An array of information gathered from the installation form.
  * @return void
  */
 public function install($info)
 {
     // Create the table structure.
     $this->structure(true);
     // Create the administrator member.
     $member = array("username" => $info["adminUser"], "email" => $info["adminEmail"], "password" => $info["adminPass"], "account" => "Administrator", "confirmed" => true);
     ET::memberModel()->create($member);
     // Set the session's userId and user information variables to the administrator, so that all entities
     // created below will be created by the administrator user.
     ET::$session->userId = 1;
     ET::$session->user = ET::memberModel()->getById(1);
     // Create the moderator group.
     ET::groupModel()->create(array("name" => "Moderator", "canSuspend" => true));
     // Create the General Discussion channel.
     $id = ET::channelModel()->create(array("title" => "General Discussion", "slug" => slug("General Discussion")));
     ET::channelModel()->setPermissions($id, array(GROUP_ID_GUEST => array("view" => true), GROUP_ID_MEMBER => array("view" => true, "reply" => true, "start" => true), 1 => array("view" => true, "reply" => true, "start" => true, "moderate" => true)));
     // Create the Staff Only channel.
     $id = ET::channelModel()->create(array("title" => "Staff Only", "slug" => slug("Staff Only")));
     ET::channelModel()->setPermissions($id, array(1 => array("view" => true, "reply" => true, "start" => true, "moderate" => true)));
     // Set the flood control config setting to zero so that we can create two conversations in a row.
     ET::$config["esoTalk.conversation.timeBetweenPosts"] = 0;
     // Create a welcome conversation.
     ET::conversationModel()->create(array("title" => "Welcome to " . $info["forumTitle"] . "!", "content" => "[b]Welcome to " . $info["forumTitle"] . "![/b]\n\n" . $info["forumTitle"] . " is powered by [url=http://esotalk.org]esoTalk[/url], the simple, fast, free web-forum.\n\nFeel free to edit or delete this conversation. Otherwise, it's time to get posting!\n\nAnyway, good luck, and we hope you enjoy using esoTalk.", "channelId" => 1));
     // Create a helpful private conversation with the administrator.
     ET::conversationModel()->create(array("title" => "Pssst! Want a few tips?", "content" => "Hey {$info["adminUser"]}, congrats on getting esoTalk installed!\n\nCool! Your forum is now good-to-go, but you might want to customize it with your own logo, design, and settings—so here's how.\n\n[h]Changing the Logo[/h]\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/settings]Forum Settings[/url] section of your administration panel.\n2. Select 'Show an image in the header' for the 'Forum header' setting.\n3. Find and select the image file you wish to use.\n4. Click 'Save Changes'. The logo will automatically be resized so it fits nicely in the header.\n\n[h]Changing the Appearance[/h]\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/appearance]Appearance[/url] section of your administration panel.\n2. Choose colors for the header, page background, or select a background image. (More skins will be available soon.)\n3. Click 'Save Changes', and your forum's appearance will be updated!\n\n[h]Managing Channels[/h]\n\n'Channels' are a way to categorize conversations in your forum. You can create as many or as few channels as you like, nest them, and give them custom permissions.\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/channels]Channels[/url] section of your administration panel.\n2. Click 'Create Channel' and fill out a title, description, and select permissions to add a new channel.\n3. Drag and drop channels to rearrange and nest them.\n\n[h]Getting Help[/h]\n\nIf you need help, come and give us a yell at the [url=http://esotalk.org/forum]esoTalk Support Forum[/url]. Don't worry—we don't bite!", "channelId" => 1), array(array("type" => "member", "id" => 1)));
     // All done!
 }
开发者ID:davchezt,项目名称:fireside,代码行数:33,代码来源:ETUpgradeModel.class.php

示例2: setup

 public function setup($oldVersion = "")
 {
     // For the Profiles plugin, we need two tables.
     // The first, profile_field, stores information about the custom profile fields that
     // the administrator has defined.
     $structure = ET::$database->structure();
     $structure->table("profile_field")->column("fieldId", "int(11) unsigned", false)->column("name", "varchar(31)", false)->column("description", "varchar(255)")->column("type", "enum('text','textarea','select','radios','checkboxes','member')", "text")->column("options", "text")->column("showOnPosts", "tinyint(1)", 0)->column("hideFromGuests", "tinyint(1)", 0)->column("searchable", "tinyint(1)", 0)->column("position", "int(11)", 0)->key("fieldId", "primary")->exec(false);
     // The second, profile_data, stores the actual values of these fields that users
     // have entered in their profiles.
     $structure->table("profile_data")->column("memberId", "int(11) unsigned", false)->column("fieldId", "int(11) unsigned", false)->column("data", "text")->key(array("memberId", "fieldId"), "primary")->exec(false);
     // If this is the first installation of the Profiles plugin (e.g. on a fresh
     // esoTalk installation,) set up some default fields for the administrator.
     if (!$oldVersion) {
         $this->createDefaultFields();
     } elseif (version_compare($oldVersion, "1.0.0g4", "<")) {
         $this->createDefaultFields();
         $model = ET::getInstance("profileFieldModel");
         $result = ET::SQL()->select("memberId, preferences")->from("member")->exec();
         while ($row = $result->nextRow()) {
             ET::memberModel()->expand($row);
             if (!empty($row["preferences"]["about"])) {
                 $model->setData($row["memberId"], 1, $row["preferences"]["about"]);
             }
             if (!empty($row["preferences"]["location"])) {
                 $model->setData($row["memberId"], 2, $row["preferences"]["location"]);
             }
         }
     }
     return true;
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:30,代码来源:plugin.php

示例3: action_denyAll

 /**
  * Deny all members.
  *
  * @return void
  */
 public function action_denyAll()
 {
     if (!$this->validateToken()) {
         return;
     }
     ET::memberModel()->delete(array("confirmed" => 0));
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:davchezt,项目名称:fireside,代码行数:14,代码来源:ETUnapprovedAdminController.class.php

示例4: action_deny

 /**
  * Deny a member; delete their account.
  *
  * @param int $memberId The ID of the member to deny.
  * @return void
  */
 public function action_deny($memberId)
 {
     // Get this member's details. If it doesn't exist or is already approved, show an error.
     if (!($member = ET::memberModel()->getById((int) $memberId)) or $member["confirmed"]) {
         $this->redirect(URL("admin/unapproved"));
         return;
     }
     ET::memberModel()->deleteById($memberId);
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:17,代码来源:ETUnapprovedAdminController.class.php

示例5: handler_conversationController_formatPostForTemplate

 public function handler_conversationController_formatPostForTemplate($sender, &$formatted, $post, $conversation)
 {
     if ($post["deleteTime"]) {
         return;
     }
     if (!C("plugin.Reputation.showReputationPublic")) {
         return;
     }
     // Show reputation points next to username on every post
     $memberRepo = ET::memberModel()->getById($post["memberId"]);
     $postMemberReputation = "+ " . $memberRepo["reputationPoints"] . " RP";
     $postMemberReputation = "<a href='" . URL("reputation") . "' class = 'time' title='Reputation Points'>{$postMemberReputation}</a>";
     $formatted["info"][] = $postMemberReputation;
 }
开发者ID:ZerGabriel,项目名称:Reputation,代码行数:14,代码来源:plugin.php

示例6: handler_conversationModel_addReplyAfter

 public function handler_conversationModel_addReplyAfter($sender, $conversation, $postId, $content)
 {
     // Only continue if this is the first post.
     if ($conversation["countPosts"] > 1) {
         return;
     }
     // We get all members who have starred the post author and have no unread posts in the conversation.
     $sql = ET::SQL()->from("member_member mm2", "mm2.memberId2=:userId AND mm2.memberId1=m.memberId AND mm2.follow=1 AND mm2.memberId1!=:userId", "inner")->from("member_conversation co", "co.conversationId=:conversationId AND co.type='member' AND co.id=m.memberId", "left")->where("co.lastRead IS NULL OR co.lastRead>=:posts")->bind(":conversationId", $conversation["conversationId"])->bind(":posts", $conversation["countPosts"] - 1)->bind(":userId", ET::$session->userId);
     $members = ET::memberModel()->getWithSQL($sql);
     $data = array("conversationId" => $conversation["conversationId"], "postId" => $postId, "title" => $conversation["title"]);
     $emailData = array("content" => $content);
     foreach ($members as $member) {
         // Check if this member is allowed to view this conversation before sending them a notification.
         $sql = ET::SQL()->select("conversationId")->from("conversation c")->where("conversationId", $conversation["conversationId"]);
         ET::conversationModel()->addAllowedPredicate($sql, $member);
         if (!$sql->exec()->numRows()) {
             continue;
         }
         ET::activityModel()->create("postMember", $member, ET::$session->user, $data, $emailData);
     }
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:21,代码来源:plugin.php

示例7: array

// Copyright 2011 Toby Zerner, Simon Zerner
// This file is part of esoTalk. Please see the included license file for usage information.
if (!defined("IN_ESOTALK")) {
    exit;
}
/**
 * Shows a summary of the members allowed in a conversation.
 * For example: Toby, Administrators, and 2 others can view this conversation.
 *
 * @package esoTalk
 */
$conversation = $data["conversation"];
$names = array();
$avatars = array();
$model = ET::memberModel();
// Go through the list of members/groups allowed and construct an array of formatted names.
foreach ($conversation["membersAllowedSummary"] as $member) {
    // If this entity is a member, add their name as a link to their profile. Also add an avatar to be
    // displayed at the start of the list.
    if ($member["type"] == "member") {
        $names[] = "<span class='name'>" . memberLink($member["id"], $member["name"]) . "</span>";
        if (count($avatars) < 3) {
            $avatars[] = avatar($member + array("memberId" => $member["id"]), "thumb");
        }
    } else {
        $names[] = "<span class='name'>" . groupLink($member["name"]) . "</span>";
    }
}
// If there are specific names, output the list!
if (count($names)) {
开发者ID:davchezt,项目名称:fireside,代码行数:30,代码来源:membersAllowedSummary.php

示例8: password

 /**
  * Show the settings page with the change password or email pane.
  *
  * @return void
  */
 public function password()
 {
     $member = $this->profile("password");
     // Construct the form.
     $form = ETFactory::make("form");
     $form->action = URL("settings/password");
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         $update = array();
         // Are we setting a new password?
         if ($password = $form->getValue("password")) {
             // Do the passwords entered match?
             if ($password != $form->getValue("confirm")) {
                 $form->error("confirm", T("message.passwordsDontMatch"));
             } else {
                 $update["password"] = $password;
             }
         }
         // Are we setting a new email?
         if ($email = $form->getValue("email")) {
             $update["email"] = $email;
         }
         // Did they enter the correct "current password"?
         if (!ET::memberModel()->checkPassword($form->getValue("currentPassword"), ET::$session->user["password"])) {
             $form->error("currentPassword", T("message.incorrectPassword"));
         }
         // If no preliminary errors occurred, and we have stuff to update, we can go ahead and call the model.
         if (!$form->errorCount() and count($update)) {
             // Update the stuff we need to with the model.
             $model = ET::memberModel();
             $model->updateById(ET::$session->userId, $update);
             // If the model encountered errors, pass them along to the form.
             if ($model->errorCount()) {
                 $form->errors($model->errors());
             } else {
                 $this->message(T("message.changesSaved"), "success");
                 $this->redirect(URL("settings"));
             }
         }
     }
     $this->data("form", $form);
     $this->renderProfile("settings/password");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:48,代码来源:ETSettingsController.class.php

示例9: login

 /**
  * Log in the member with the specified username and password, and optionally set a persistent login cookie.
  *
  * @param string $username The username.
  * @param string $password The password.
  * @param bool $remember Whether or not to set a persistent login cookie.
  * @return bool true on success, false on failure.
  */
 public function login($name, $password, $remember = false)
 {
     // Get the member with this username or email.
     $sql = ET::SQL()->where("m.username=:username OR m.email=:email")->bind(":username", $name)->bind(":email", $name);
     $member = reset(ET::memberModel()->getWithSQL($sql));
     // Check that the password is correct.
     if (!$member or !ET::memberModel()->checkPassword($password, $member["password"])) {
         $this->error("password", "incorrectLogin");
         return false;
     }
     // Process the login.
     $return = $this->processLogin($member);
     // Set a persistent login "remember me" cookie?
     // We use this implementation: http://jaspan.com/improved_persistent_login_cookie_best_practice
     if ($return === true and $remember) {
         // Generate a new series identifier, and a token.
         $series = md5(generateRandomString(32));
         $token = $this->createPersistentToken($this->userId, $series);
         // Set the cookie.
         $this->setCookie("persistent", $this->userId . $series . $token, time() + C("esoTalk.cookie.expire"));
     }
     return $return;
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:31,代码来源:ETSession.class.php

示例10: avatar

<?php 
echo avatar($member);
?>

<div id='memberInfo'>

<h1 id='memberName'><?php 
echo name($member["username"]);
?>
</h1>

<?php 
// Online indicator.
if (empty($member["preferences"]["hideOnline"])) {
    $lastAction = ET::memberModel()->getLastActionInfo($member["lastActionTime"], $member["lastActionDetail"]);
    if ($lastAction) {
        echo "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . ($lastAction[0] ? " (" . sanitizeHTML($lastAction[0]) . ")" : "") . "'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">";
    }
}
?>

<?php 
// Output the email if the viewer is an admin.
if (ET::$session->isAdmin()) {
    ?>
<p class='subText'><?php 
    echo sanitizeHTML($member["email"]);
    ?>
</p><?php 
}
开发者ID:19eighties,项目名称:esoTalk,代码行数:30,代码来源:profile.php

示例11: formatPostForTemplate

 /**
  * 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;
 }
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:65,代码来源:ETConversationController.class.php

示例12: login

 /**
  * Log in the member with the specified username and password, and optionally set a persistent login cookie.
  *
  * @param string $username The username.
  * @param string $password The password.
  * @param bool $remember Whether or not to set a persistent login cookie.
  * @return bool true on success, false on failure.
  */
 public function login($name, $password, $remember = false)
 {
     $return = $this->trigger("login", array($name, $password, $remember));
     if (count($return)) {
         return reset($return);
     }
     // Get the member with this username or email.
     $sql = ET::SQL()->where("m.username=:username OR m.email=:email")->bind(":username", $name)->bind(":email", $name);
     $member = reset(ET::memberModel()->getWithSQL($sql));
     // Check that the password is correct.
     if (!$member or !ET::memberModel()->checkPassword($password, $member["password"])) {
         $this->error("password", "incorrectLogin");
         return false;
     }
     // Process the login.
     $return = $this->processLogin($member);
     // Set a persistent login "remember me" cookie?
     if ($return === true and $remember) {
         $this->setRememberCookie($this->userId);
     }
     return $return;
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:30,代码来源:ETSession.class.php

示例13: formatPostForTemplate

 /**
  * 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;
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:59,代码来源:ETConversationController.class.php

示例14: index

 /**
  * Display a list of conversations, optionally filtered by channel(s) and a search string.
  *
  * @return void
  */
 function index($channelSlug = false)
 {
     // Add the default gambits to the gambit cloud: gambit text => css class to apply.
     $gambits = array(T("gambit.active last ? hours") => "gambit-activeLastHours", T("gambit.active last ? days") => "gambit-activeLastDays", T("gambit.active today") => "gambit-activeToday", T("gambit.author:") . T("gambit.member") => "gambit-author", T("gambit.contributor:") . T("gambit.member") => "gambit-contributor", T("gambit.dead") => "gambit-dead", T("gambit.has replies") => "gambit-hasReplies", T("gambit.has >10 replies") => "gambit-replies", T("gambit.locked") => "gambit-locked", T("gambit.more results") => "gambit-more", T("gambit.order by newest") => "gambit-orderByNewest", T("gambit.order by replies") => "gambit-orderByReplies", T("gambit.random") => "gambit-random", T("gambit.reverse") => "gambit-reverse", T("gambit.sticky") => "gambit-sticky");
     // Add some more personal gambits if there is a user logged in.
     if (ET::$session->user) {
         $gambits += array(T("gambit.contributor:") . T("gambit.myself") => "gambit-contributorMyself", T("gambit.author:") . T("gambit.myself") => "gambit-authorMyself", T("gambit.draft") => "gambit-draft", T("gambit.muted") => "gambit-muted", T("gambit.private") => "gambit-private", T("gambit.starred") => "gambit-starred", T("gambit.unread") => "gambit-unread");
     }
     list($channelInfo, $currentChannels, $channelIds, $includeDescendants) = $this->getSelectedChannels($channelSlug);
     // Now we need to construct some arrays to determine which channel "tabs" to show in the view.
     // $channels is a list of channels with the same parent as the current selected channel(s).
     // $path is a breadcrumb trail to the depth of the currently selected channel(s).
     $channels = array();
     $path = array();
     // Work out what channel we will use as the "parent" channel. This will be the last item in $path,
     // and its children will be in $channels.
     $curChannel = false;
     // If channels have been selected, use the first of them.
     if (count($currentChannels)) {
         $curChannel = $channelInfo[$currentChannels[0]];
     }
     // If the currently selected channel has no children, or if we're not including descendants, use
     // its parent as the parent channel.
     if ($curChannel and $curChannel["lft"] >= $curChannel["rgt"] - 1 or !$includeDescendants) {
         $curChannel = @$channelInfo[$curChannel["parentId"]];
     }
     // If no channel is selected, make a faux parent channel.
     if (!$curChannel) {
         $curChannel = array("lft" => 0, "rgt" => PHP_INT_MAX, "depth" => -1);
     }
     // Now, finally, go through all the channels and add ancestors of the "parent" channel to the $path,
     // and direct children to the list of $channels. Make sure we don't include any channels which
     // the user has unsubscribed to.
     foreach ($channelInfo as $channel) {
         if ($channel["lft"] > $curChannel["lft"] and $channel["rgt"] < $curChannel["rgt"] and $channel["depth"] == $curChannel["depth"] + 1 and empty($channel["unsubscribed"])) {
             $channels[] = $channel;
         } elseif ($channel["lft"] <= $curChannel["lft"] and $channel["rgt"] >= $curChannel["rgt"]) {
             $path[] = $channel;
         }
     }
     // Store the currently selected channel in the session, so that it can be automatically selected
     // if "New conversation" is clicked.
     if (!empty($currentChannels)) {
         ET::$session->store("channelId", $currentChannels[0]);
     }
     // Get the search string request value.
     $searchString = R("search");
     // Last, but definitely not least... perform the search!
     $search = ET::searchModel();
     $conversationIDs = $search->getConversationIDs($channelIds, $searchString, count($currentChannels));
     $results = $search->getResults($conversationIDs);
     // Were there any errors? Show them as messages.
     if ($search->errorCount()) {
         $this->messages($search->errors(), "warning dismissable");
     } else {
         $words = array();
         foreach ($search->fulltext as $term) {
             if (preg_match_all('/"(.+?)"/', $term, $matches)) {
                 $words[] = $matches[1];
                 $term = preg_replace('/".+?"/', '', $term);
             }
             $words = array_unique(array_merge($words, explode(" ", $term)));
         }
         ET::$session->store("highlight", $words);
     }
     // Pass on a bunch of data to the view.
     $this->data("results", $results);
     $this->data("showViewMoreLink", $search->areMoreResults());
     $this->data("channelPath", $path);
     $this->data("channelTabs", $channels);
     $this->data("currentChannels", $currentChannels);
     $this->data("channelInfo", $channelInfo);
     $this->data("channelSlug", $channelSlug ? $channelSlug : "all");
     $this->data("searchString", $searchString);
     $this->data("fulltextString", implode(" ", $search->fulltext));
     $this->data("gambits", $gambits);
     // If we're loading the page in full...
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         // Update the user's last action.
         ET::memberModel()->updateLastAction("search");
         // Construct a canonical URL and add to the breadcrumb stack.
         $slugs = array();
         foreach ($currentChannels as $channel) {
             $slugs[] = $channelInfo[$channel]["slug"];
         }
         $url = "conversations/" . urlencode(($k = implode(" ", $slugs)) ? $k : "all") . ($searchString ? "?search=" . urlencode($searchString) : "");
         $this->pushNavigation("conversations", "search", URL($url));
         $this->canonicalURL = URL($url, true);
         // Add a link to the RSS feed in the bar.
         $this->addToMenu("meta", "feed", "<a href='" . URL(str_replace("conversations/", "conversations/index.atom/", $url)) . "' id='feed'>" . T("Feed") . "</a>");
         // Construct a list of keywords to use in the meta tags.
         $keywords = array();
         foreach ($channelInfo as $c) {
             if ($c["depth"] == 0) {
                 $keywords[] = strtolower($c["title"]);
//.........这里部分代码省略.........
开发者ID:revskill,项目名称:esoTalk,代码行数:101,代码来源:ETConversationsController.class.php

示例15: privateAddNotification

 /**
  * Send private conversation invitation notifications to a list of members. A notification will only
  * be sent if this is the first time a member has been added to the conversation, to prevent intentional
  * email spamming.
  *
  * @param array $conversation The conversation to that we're sending out notifications for.
  * @param array $memberIds A list of member IDs to send the notifications to.
  * @param bool $notifyAll If set to true, all members will be notified regardless of if they have been
  * 		added to this conversation before.
  * @return void
  */
 protected function privateAddNotification($conversation, $memberIds, $notifyAll = false, $content = null)
 {
     $memberIds = (array) $memberIds;
     // Remove the currently logged in user from the list of member IDs.
     if (($k = array_search(ET::$session->userId, $memberIds)) !== false) {
         unset($memberIds[$k]);
     }
     if (!count($memberIds)) {
         return;
     }
     // Get the member details for this list of member IDs.
     $sql = ET::SQL()->from("member_conversation s", "s.conversationId=:conversationId AND s.type='member' AND s.id=m.memberId", "left")->bind(":conversationId", $conversation["conversationId"])->where("m.memberId IN (:memberIds)")->bind(":memberIds", $memberIds);
     // Only get members where the member_conversation row doesn't exist (implying that this is the first time
     // they've been added to the conversation.)
     if (!$notifyAll) {
         $sql->where("s.id IS NULL");
     }
     $members = ET::memberModel()->getWithSQL($sql);
     $data = array("conversationId" => $conversation["conversationId"], "title" => $conversation["title"]);
     $emailData = array("content" => $content);
     // Create the "privateAdd" activity which will send out a notification and an email if appropriate.
     // Also get IDs of members who would like to automatically follow this conversation.
     $followIds = array();
     foreach ($members as $member) {
         ET::activityModel()->create("privateAdd", $member, ET::$session->user, $data, $emailData);
         if (!empty($member["preferences"]["starPrivate"])) {
             $followIds[] = $member["memberId"];
         }
     }
     // Follow the conversation for the appropriate members.
     if (!empty($followIds)) {
         $this->setStatus($conversation["conversationId"], $followIds, array("starred" => true));
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:45,代码来源:ETConversationModel.class.php


注:本文中的ET::memberModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。