/**
  * Get a list of the most recent posts on the esoTalk blog. Also check for updates to the esoTalk software
  * and return the update notification area.
  *
  * @return void
  */
 public function news()
 {
     // Check for updates and add the update notification view to the response.
     ET::upgradeModel()->checkForUpdates();
     $this->json("updateNotification", $this->getViewContents("admin/updateNotification"));
     // Now fetch the latest posts from the esoTalk blog.
     // Thanks to Brian for this code.
     // (http://stackoverflow.com/questions/250679/best-way-to-parse-rss-atom-feeds-with-php/251102#251102)
     $xmlSource = file_get_contents("http://esotalk.org/blog/index.php/feed/");
     $x = simplexml_load_string($xmlSource);
     $posts = array();
     // Go through each item in the RSS channel...
     foreach ($x->channel->item as $item) {
         $post = array("date" => (string) $item->pubDate, "ts" => strtotime($item->pubDate), "link" => (string) $item->link, "title" => (string) $item->title, "text" => (string) $item->description);
         // Create summary as a shortened body and remove all tags.
         $summary = strip_tags($post["text"]);
         $maxLen = 200;
         if (strlen($summary) > $maxLen) {
             $summary = substr($summary, 0, $maxLen) . "...";
         }
         $post["summary"] = $summary;
         $posts[] = $post;
     }
     // Render the news view.
     $this->data("posts", $posts);
     $this->render("admin/news");
 }
 /**
  * Toggle the user's subscription to a channel.
  *
  * @param int $channelId The ID of the channel to toggle subscription to.
  * @return void
  */
 public function action_subscribe($channelId = "")
 {
     if (!ET::$session->user or !$this->validateToken()) {
         return;
     }
     // If we don't have permission to view this channel, don't proceed.
     if (!ET::channelModel()->hasPermission((int) $channelId, "view")) {
         return;
     }
     // Work out if we're already unsubscribed or not, and switch to the opposite of that.
     $channel = ET::SQL()->select("unsubscribed, lft, rgt")->from("channel c")->from("member_channel mc", "mc.channelId = c.channelId AND mc.memberId = :userId", "left")->bind(":userId", ET::$session->userId)->where("c.channelId", (int) $channelId)->exec()->firstRow();
     // Get all the child channels of this channel.
     $rows = ET::SQL()->select("channelId")->from("channel")->where("lft >= :lft")->bind(":lft", $channel["lft"])->where("rgt <= :rgt")->bind(":rgt", $channel["rgt"])->exec()->allRows();
     $channelIds = array();
     foreach ($rows as $row) {
         $channelIds[] = $row["channelId"];
     }
     // Write to the database.
     ET::channelModel()->setStatus($channelIds, ET::$session->userId, array("unsubscribed" => !$channel["unsubscribed"]));
     // Normally, redirect back to the channel list.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL("channels"));
     }
     // Otherwise, set a JSON var.
     $this->json("unsubscribed", !$channel["unsubscribed"]);
     $this->render();
 }
 /**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'><i class='icon-dashboard'></i> " . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'><i class='icon-cog'></i> " . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'><i class='icon-eye-open'></i> " . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'><i class='icon-tags'></i> " . T("Channels") . "</a>");
     $this->defaultMenu->add("members", "<a href='" . URL("members") . "'><i class='icon-group'></i> " . T("Members") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'><i class='icon-puzzle-piece'></i> " . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     // If new registrations require admin approval, add the 'unapproved' admin page with a count.
     if (C("esoTalk.registration.requireConfirmation") == "approval") {
         $count = ET::SQL()->select("COUNT(1)")->from("member")->where("confirmed", 0)->exec()->result();
         $this->menu->add("unapproved", "<a href='" . URL("admin/unapproved") . "'><i class='icon-lock'></i> " . T("Unapproved") . " <span class='badge'>" . $count . "</span></a>");
     }
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->pushNavigation("admin", "administration", URL($this->selfURL));
     }
     $this->addJSFile("core/js/admin.js");
     $this->addCSSFile("core/skin/admin.css");
     $this->trigger("initAdmin", array($this->menu, $this->defaultMenu));
 }
예제 #4
0
파일: plugin.php 프로젝트: nowaym/esoTalk
 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("server", C("plugin.SMTP.server"));
     $form->setValue("username", C("plugin.SMTP.username"));
     $form->setValue("password", C("plugin.SMTP.password"));
     $form->setValue("port", C("plugin.SMTP.port"));
     $form->setValue("auth", C("plugin.SMTP.auth"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.SMTP.server"] = $form->getValue("server");
         $config["plugin.SMTP.username"] = $form->getValue("username");
         $config["plugin.SMTP.password"] = $form->getValue("password");
         $config["plugin.SMTP.port"] = $form->getValue("port");
         $config["plugin.SMTP.auth"] = $form->getValue("auth");
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("smtpSettingsForm", $form);
     return $this->getView("settings");
 }
 public function action_index($orderBy = false, $start = 0)
 {
     if (!$this->allowed("esoTalk.members.visibleToGuests")) {
         return;
     }
     //If admin has disabled reputatoin points, break
     if (!C("plugin.Reputation.showReputationPublic")) {
         return;
     }
     $model = ET::getInstance("reputationModel");
     $members = $model->getReputationMembers();
     //Get rank of current member and get nearby members if rank is greater than 10
     $rank = $model->getRankOfCurrentMember(ET::$session->userId, $members);
     //Three parameters for getNearbyReputationMembers is number of members to be shown, offset, members array
     if ($rank > 10) {
         $nearbyMembers = $model->getNearbyReputationMembers(10, $rank - 5, $members);
     }
     //Get top 10 reputation members
     $topMembers = $model->getTopReputationMembers(10, $members);
     //Pass data to view
     $this->data("topMembers", $topMembers);
     $this->data("nearbyMembers", $nearbyMembers);
     $this->data("rank", $rank);
     $this->render("reputation");
 }
 public function insertAttachments($attachments, $keys)
 {
     $inserts = array();
     foreach ($attachments as $id => $attachment) {
         $inserts[] = array_merge(array($id, $attachment["name"], $attachment["secret"]), array_values($keys));
     }
     ET::SQL()->insert("attachment")->setMultiple(array_merge(array("attachmentId", "filename", "secret"), array_keys($keys)), $inserts)->exec();
 }
예제 #7
0
function errorHandler($code, $message, $file, $line)
{
    // Make sure this error code is included in error_reporting.
    if ((error_reporting() & $code) != $code) {
        return false;
    }
    ET::fatalError(new ErrorException($message, $code, 1, $file, $line));
}
 /**
  * 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"));
 }
예제 #9
0
 public function validateSlug($slug)
 {
     if (!strlen($slug)) {
         return "empty";
     }
     if (ET::SQL()->select("COUNT(pageId)")->from("page")->where("slug=:slug")->bind(":slug", $slug)->exec()->result() > 0) {
         return "channelSlugTaken";
     }
 }
예제 #10
0
 function setistaatust(&$conversation, $memberId, $unfinished)
 {
     $unfinished = (bool) $unfinished;
     $model = ET::conversationModel();
     $model->setStatus($conversation["conversationId"], $memberId, array("unfinished" => $unfinished));
     #conversationModel
     $model->addOrRemoveLabel($conversation, "unfinished", $unfinished);
     #conversationModel
     $conversation["unfinished"] = $unfinished;
 }
예제 #11
0
 public function memberController_about($sender, $member = "")
 {
     if (!($member = $sender->profile($member, "about"))) {
         return;
     }
     $about = @$member["preferences"]["about"];
     $about = ET::formatter()->init($about)->format()->get();
     $sender->data("about", $about);
     $sender->renderProfile($this->getView("about"));
 }
 /**
  * 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"));
 }
예제 #13
0
 /**
  * Write the skin's color configuration and CSS.
  * 
  * @param string $primary The primary color.
  * @return void
  */
 protected function writeColors($primary)
 {
     ET::writeConfig(array("skin.Doragon.primaryColor" => $primary));
     $rgb = colorUnpack($primary, true);
     $hsl = rgb2hsl($rgb);
     $primary = colorPack(hsl2rgb($hsl), true);
     $hsl[1] = max(0, $hsl[1] - 0.3);
     $secondary = colorPack(hsl2rgb(array(2 => 0.6) + $hsl), true);
     $tertiary = colorPack(hsl2rgb(array(2 => 0.92) + $hsl), true);
     $css = file_get_contents($this->resource("colors.css"));
     $css = str_replace(array("{primary}", "{secondary}", "{tertiary}"), array($primary, $secondary, $tertiary), $css);
     file_put_contents(PATH_CONFIG . "/colors.css", $css);
 }
예제 #14
0
 /**
  * Triggers an event, returning an array of return values from event handlers.
  *
  * Two events will actually be triggered: one prefixed with the name of this class,
  * one not. For example, if an instance of ETPluggable calls $this->trigger("eventName"),
  * both "ETPluggable_eventName" and "eventName" events will be triggered.
  *
  * The event handlers are called with $this as the first argument, and optionally any extra
  * $parameters. The return values from each handler are collected and then returned in an array.
  *
  * @param string $event The name of the event.
  * @param array $parameters An array of extra parameters to pass to the event handlers.
  */
 public function trigger($event, $parameters = array())
 {
     // Add the instance of this class to the parameters.
     array_unshift($parameters, $this);
     $return = array();
     // If we have a class name to use, trigger an event with that as the prefix.
     if ($this->className) {
         $return = ET::trigger($this->className . "_" . $event, $parameters);
     }
     // Trigger the event globally.
     $return = array_merge($return, ET::trigger($event, $parameters));
     return $return;
 }
 /**
  * Perform the upgrade process.
  *
  * @return void
  */
 public function action_index()
 {
     try {
         // Run the upgrade process.
         ET::upgradeModel()->upgrade(C("esoTalk.version"));
         // Update the version and serial in the config file.
         ET::writeConfig(array("esoTalk.version" => ESOTALK_VERSION));
         // Show a success message and redirect.
         $this->message(T("message.upgradeSuccessful"), "success");
         $this->redirect(URL(""));
     } catch (Exception $e) {
         $this->fatalError($e->getMessage());
     }
 }
예제 #16
0
 /**
  * 複数タグ文字列で検索
  * @param type $keys
  * @return type
  */
 public function getTagsIds($keys)
 {
     if (is_array($keys) && count($keys)) {
         // タグID,タグテキストの配列を取得
         $result = ET::SQL()->select("distinct tagsId")->from("tags")->where("tagText IN (:keys)")->bind(":keys", $keys)->exec()->allRows();
         $ids = array();
         if (count($result)) {
             foreach ($result as $r) {
                 $ids[] = $r["tagsId"];
             }
         }
         return $ids;
     }
 }
 /**
  * Show the administrator dashboard view.
  *
  * @return void
  */
 public function action_index()
 {
     $this->title = T("Dashboard");
     // Work out a UNIX timestamp of one week ago.
     $oneWeekAgo = time() - 60 * 60 * 24 * 7;
     // Create an array of statistics to show on the dashboard.
     $statistics = array("<a href='" . URL("members") . "'>" . T("Members") . "</a>" => number_format(ET::SQL()->select("COUNT(*)")->from("member")->exec()->result()), T("Conversations") => number_format(ET::SQL()->select("COUNT(*)")->from("conversation")->exec()->result()), T("Posts") => number_format(ET::SQL()->select("COUNT(*)")->from("post")->exec()->result()), T("New members in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("member")->where(":time<joinTime")->bind(":time", $oneWeekAgo)->exec()->result()), T("New conversations in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("conversation")->where(":time<startTime")->bind(":time", $oneWeekAgo)->exec()->result()), T("New posts in the past week") => number_format(ET::SQL()->select("COUNT(*)")->from("post")->where(":time<time")->bind(":time", $oneWeekAgo)->exec()->result()));
     // Determine if we should show the welcome sheet.
     if (!C("esoTalk.admin.welcomeShown")) {
         $this->data("showWelcomeSheet", true);
         ET::writeConfig(array("esoTalk.admin.welcomeShown" => true));
     }
     $this->data("statistics", $statistics);
     $this->render("admin/dashboard");
 }
예제 #18
0
파일: plugin.php 프로젝트: ZerGabriel/Pages
 public function handler_init($sender)
 {
     ET::$controller->addCSSFile($this->resource("pages.css"), true);
     $model = ET::getInstance("pagesModel");
     $pages = $model->get();
     if ($pages) {
         foreach ($pages as $page) {
             if (ET::$session->userId) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             } elseif ($page['hideFromGuests'] == 0) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             }
         }
     }
 }
예제 #19
0
파일: plugin.php 프로젝트: m-mori/forum
 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"]))));
 }
 public function getReputationMembers()
 {
     $result = ET::SQL()->select("username")->select("memberId")->select("reputationPoints")->from("member")->orderBy("reputationPoints DESC")->exec()->allRows();
     //Assign ranks to all members based on reputation points
     $rank = 1;
     foreach ($result as $k => $v) {
         $results[$k]["rank"] = $rank;
         $results[$k]["avatar"] = avatar($v, "thumb");
         $results[$k]["username"] = $result[$k]["username"];
         $results[$k]["memberId"] = $result[$k]["memberId"];
         $results[$k]["reputationPoints"] = $result[$k]["reputationPoints"];
         $rank++;
     }
     return $results;
 }
예제 #21
0
파일: plugin.php 프로젝트: ZerGabriel/Likes
 public function handler_postModel_getPostsAfter($sender, &$posts)
 {
     $postsById = array();
     foreach ($posts as &$post) {
         $postsById[$post["postId"]] =& $post;
         $post["likes"] = array();
     }
     if (!count($postsById)) {
         return;
     }
     $result = ET::SQL()->select("postId, m.memberId, m.email, username, avatarFormat")->from("like l")->from("member m", "m.memberId=l.memberId", "left")->where("postId IN (:ids)")->bind(":ids", array_keys($postsById))->exec();
     while ($row = $result->nextRow()) {
         $postsById[$row["postId"]]["likes"][$row["memberId"]] = array("memberId" => $row["memberId"], "username" => $row["username"], "email" => $row["email"], "avatarFormat" => $row["avatarFormat"]);
     }
 }
 /**
  * Uninstall a language by removing its directory.
  *
  * @param string $language The name of the language.
  * @return void
  */
 public function uninstall($language = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Make sure the language exists.
     $languages = ET::getLanguages();
     if (!$language or !in_array($language, $languages)) {
         return;
     }
     // Attempt to remove the directory. If we couldn't, show a "not writable" message.
     if (!is_writable($file = PATH_LANGUAGES) or !is_writable($file = PATH_LANGUAGES . "/{$language}") or !rrmdir($file)) {
         $this->message(sprintf(T("message.notWritable"), $file), "warning");
     } else {
         $this->message(T("message.languageUninstalled"), "success");
     }
     $this->redirect(URL("admin/languages"));
 }
예제 #23
0
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/Signature");
     // Set the values for the sitemap options.
     $form->setValue("characters", C("plugin.Signature.characters", "150"));
     // If the form was submitted...
     if ($form->validPostBack()) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.Signature.characters"] = $form->getValue("characters");
         // Write the config file.
         ET::writeConfig($config);
         $sender->redirect(URL("admin/plugins"));
     }
     $sender->data("SignatureSettingsForm", $form);
     return $this->view("settings");
 }
예제 #24
0
파일: plugin.php 프로젝트: m-mori/forum
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/GoogleAnalytics");
     $form->setValue("trackingId", C("GoogleAnalytics.trackingId"));
     // If the form was submitted...
     if ($form->validPostBack()) {
         // Construct an array of config options to write.
         $config = array();
         $config["GoogleAnalytics.trackingId"] = $form->getValue("trackingId");
         // Write the config file.
         ET::writeConfig($config);
         $sender->message(T("message.changesSaved"), "success autoDismiss");
         $sender->redirect(URL("admin/plugins"));
     }
     $sender->data("googleAnalyticsSettingsForm", $form);
     return $this->view("settings");
 }
 /**
  * Upload a header image.
  *
  * @return void
  */
 protected function uploadHeaderImage($form)
 {
     $uploader = ET::uploader();
     try {
         // Validate and get the uploaded file from this field.
         $file = $uploader->getUploadedFile("forumHeaderImage");
         // Save it as an image, restricting it to a maximum size.
         $logo = $uploader->saveAsImage($file, PATH_UPLOADS . "/logo", 500, 85, "max");
         $logo = str_replace(PATH_UPLOADS, "uploads", $logo);
         // Delete the old logo (if we didn't just overwrite it.)
         if ($logo != C("esoTalk.forumLogo")) {
             @unlink(C("esoTalk.forumLogo"));
         }
         return $logo;
     } catch (Exception $e) {
         // If something went wrong up there, add the error message to the form.
         $form->error("forumHeaderImage", $e->getMessage());
     }
 }
예제 #26
0
 public function settings($sender)
 {
     // Expand the filters array into a string that will go in the textarea.
     $filters = C("plugin.WordFilter.filters", array());
     $filterText = "";
     foreach ($filters as $word => $replacement) {
         $filterText .= $word . ($replacement ? "|{$replacement}" : "") . "\n";
     }
     $filterText = trim($filterText);
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("filters", $filterText);
     // If the form was submitted...
     if ($form->validPostBack("wordFilterSave")) {
         // Create an array of word filters from the contents of the textarea.
         // Each line is a new element in the array; keys and values are separated by a | character.
         $filters = array();
         $lines = explode("\n", strtr($form->getValue("filters"), array("\r\n" => "\n", "\r" => "\n")));
         foreach ($lines as $line) {
             if (!$line) {
                 continue;
             }
             $parts = explode("|", $line, 2);
             if (!$parts[0]) {
                 continue;
             }
             $filters[$parts[0]] = @$parts[1];
         }
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.WordFilter.filters"] = $filters;
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("wordFilterSettingsForm", $form);
     return $this->getView("settings");
 }
 /**
  * Toggle the user's subscription to a channel.
  *
  * @param int $channelId The ID of the channel to toggle subscription to.
  * @return void
  */
 public function subscribe($channelId = "")
 {
     if (!ET::$session->user or !$this->validateToken()) {
         return;
     }
     // If we don't have permission to view this channel, don't proceed.
     if (!ET::channelModel()->hasPermission((int) $channelId, "view")) {
         return;
     }
     // Work out if we're already unsubscribed or not, and switch to the opposite of that.
     $unsubscribed = !ET::SQL()->select("unsubscribed")->from("member_channel")->where("memberId", ET::$session->userId)->where("channelId", (int) $channelId)->exec()->result();
     // Write to the database.
     ET::channelModel()->setStatus($channelId, ET::$session->userId, array("unsubscribed" => $unsubscribed));
     // Normally, redirect back to the channel list.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL("channels"));
     }
     // Otherwise, set a JSON var.
     $this->json("unsubscribed", $unsubscribed);
     $this->render();
 }
예제 #28
0
 /**
  * Setting form on admin panel
  */
 public function settings($sender)
 {
     $form = ETFactory::make('form');
     $form->action = URL('admin/plugins');
     $form->setValue('linksBottomMenu', $this->c['linksBottomMenu']);
     $form->setValue('linksTopMenu', $this->c['linksTopMenu']);
     $form->setValue('beforeBody', $this->c['beforeBody']);
     $form->setValue('headSection', $this->c['headSection']);
     if ($form->validPostBack("MenuLinksSave")) {
         $config = array();
         $config['plugin.MenuLinks.linksBottomMenu'] = $form->getValue('linksBottomMenu');
         $config['plugin.MenuLinks.linksTopMenu'] = $form->getValue('linksTopMenu');
         $config['plugin.MenuLinks.beforeBody'] = $form->getValue('beforeBody');
         $config['plugin.MenuLinks.headSection'] = $form->getValue('headSection');
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success autoDismiss");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("MenuLinks", $form);
     return $this->getView("settings");
 }
예제 #29
0
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/reCAPTCHA");
     $form->setValue("secretkey", C("plugin.reCAPTCHA.secretkey"));
     $form->setValue("sitekey", C("plugin.reCAPTCHA.sitekey"));
     $form->setValue("language", C("plugin.reCAPTCHA.language"));
     $form->setValue("language", C("plugin.reCAPTCHA.language", "en"));
     // If the form was submitted...
     if ($form->validPostBack()) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.reCAPTCHA.secretkey"] = $form->getValue("secretkey");
         $config["plugin.reCAPTCHA.sitekey"] = $form->getValue("sitekey");
         $config["plugin.reCAPTCHA.language"] = $form->getValue("language");
         // Write the config file.
         ET::writeConfig($config);
         $sender->message(T("message.changesSaved"), "success autoDismiss");
         $sender->redirect(URL("admin/plugins"));
     }
     $sender->data("reCAPTCHASettingsForm", $form);
     return $this->view("settings");
 }
예제 #30
0
 protected function fulltextQuery($search)
 {
     return ET::SQL()->from("attachment")->where("filename LIKE :search")->bind(":search", "%" . $search . "%");
 }