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


PHP ET::writeConfig方法代码示例

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


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

示例1: settings

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

示例2: writeColors

 /**
  * 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);
 }
开发者ID:ZerGabriel,项目名称:Doragon-Skin,代码行数:19,代码来源:skin.php

示例3: checkForUpdates

 /**
  * Check for updates to the esoTalk software. If there's a new version, and this is the first time we've heard
  * of it, create a notifcation for the current user.
  *
  * @return void
  */
 public function checkForUpdates()
 {
     // Save the last update check time so we won't do it again for a while.
     ET::writeConfig(array("esoTalk.admin.lastUpdateCheckTime" => time()));
     // If the latest version is different to what it was last time we checked...
     $info = C("esoTalk.admin.lastUpdateCheckInfo", array("version" => ESOTALK_VERSION));
     if ($package = ET::checkForUpdates() and $package["version"] != $info["version"]) {
         // Create a notification.
         ET::activityModel()->create("updateAvailable", ET::$session->userId, null, $package);
         // Write the latest checked version to the config file.
         ET::writeConfig(array("esoTalk.admin.lastUpdateCheckInfo" => $package));
     }
 }
开发者ID:m-mori,项目名称:forum,代码行数:19,代码来源:ETUpgradeModel.class.php

示例4: action_index

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

示例5: action_index

 /**
  * 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");
 }
开发者ID:m-mori,项目名称:forum,代码行数:20,代码来源:ETDashboardAdminController.class.php

示例6: settings

 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");
 }
开发者ID:jpearman,项目名称:Signature,代码行数:19,代码来源:plugin.php

示例7: settings

 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");
 }
开发者ID:m-mori,项目名称:forum,代码行数:19,代码来源:plugin.php

示例8: settings

 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");
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:42,代码来源:plugin.php

示例9: index

 /**
  * Show and process the settings form.
  *
  * @return void
  */
 public function index()
 {
     // Make an array of languages for the default forum language select.
     $languages = array();
     foreach (ET::getLanguages() as $v) {
         $languages[$v] = ET::$languageInfo[$v]["name"];
     }
     // Get a list of member groups.
     $groups = ET::groupModel()->getAll();
     // Set up the form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/settings");
     // Set the default values for the forum inputs.
     $form->setValue("forumTitle", C("esoTalk.forumTitle"));
     $form->setValue("language", C("esoTalk.language"));
     $form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
     $form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
     $form->setValue("registrationOpen", C("esoTalk.registration.open"));
     $form->setValue("memberListVisibleToGuests", C("esoTalk.members.visibleToGuests"));
     $form->setValue("requireAdminApproval", C("esoTalk.registration.requireAdminApproval"));
     $form->setValue("requireEmailConfirmation", C("esoTalk.registration.requireEmailConfirmation"));
     // If the save button was clicked...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array("esoTalk.forumTitle" => $form->getValue("forumTitle"), "esoTalk.language" => $form->getValue("language"), "esoTalk.forumLogo" => $form->getValue("forumHeader") == "image" ? $this->uploadHeaderImage($form) : false, "esoTalk.defaultRoute" => $form->getValue("defaultRoute"), "esoTalk.registration.open" => $form->getValue("registrationOpen"), "esoTalk.registration.requireEmailConfirmation" => $form->getValue("requireEmailConfirmation"), "esoTalk.members.visibleToGuests" => $form->getValue("memberListVisibleToGuests"));
         // Make sure a forum title is present.
         if (!strlen($config["esoTalk.forumTitle"])) {
             $form->error("forumTitle", T("message.empty"));
         }
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $this->message(T("message.changesSaved"), "success");
             $this->redirect(URL("admin/settings"));
         }
     }
     $this->data("form", $form);
     $this->data("languages", $languages);
     $this->data("groups", $groups);
     $this->title = T("Forum Settings");
     $this->render("admin/settings");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:46,代码来源:ETSettingsAdminController.class.php

示例10: settings

 public function settings($sender)
 {
     // Set up the settings form. Set some default values for the first time.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins/settings/Reputation");
     $form->setValue("showReputationPublic", C("plugin.Reputation.showReputationPublic", "0"));
     $form->setValue("conversationStartRP", C("plugin.Reputation.conversationStartRP", "10"));
     $form->setValue("getReplyRP", C("plugin.Reputation.getReplyRP", "5"));
     $form->setValue("viewsRP", C("plugin.Reputation.viewsRP", "0"));
     $form->setValue("likesRP", C("plugin.Reputation.likesRP", "5"));
     $form->setValue("replyRP", C("plugin.Reputation.replyRP", "5"));
     $form->setValue("newReputationUpdate", C("plugin.Reputation.newReputationUpdate", "0"));
     // If the form was submitted...
     if ($form->validPostBack("reputationSave")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.Reputation.showReputationPublic"] = $form->getValue("showReputationPublic");
         $config["plugin.Reputation.conversationStartRP"] = $form->getValue("conversationStartRP");
         $config["plugin.Reputation.getReplyRP"] = $form->getValue("getReplyRP");
         $config["plugin.Reputation.replyRP"] = $form->getValue("replyRP");
         $config["plugin.Reputation.viewsRP"] = $form->getValue("viewsRP");
         $config["plugin.Reputation.likesRP"] = $form->getValue("likesRP");
         $config["plugin.Reputation.newReputationUpdate"] = $form->getValue("newReputationUpdate");
         // Update reputatoin ponits in databse according to new formula
         if (C("plugin.Reputation.newReputationUpdate") == 1) {
             $this->updateNewReputation(C("plugin.Reputation.replyRP"), C("plugin.Reputation.conversationStartRP"), C("plugin.Reputation.viewsRP"), C("plugin.Reputation.likesRP"), C("plugin.Reputation.getReplyRP"));
             $config["plugin.Reputation.newReputationUpdate"] = 0;
         }
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success autoDismiss");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("reputationSettingsForm", $form);
     return $this->view("settings");
 }
开发者ID:ZerGabriel,项目名称:Reputation,代码行数:38,代码来源:plugin.php

示例11: settings

 /**
  * 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");
 }
开发者ID:ZerGabriel,项目名称:MenuLinks,代码行数:26,代码来源:plugin.php

示例12: settings

 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");
 }
开发者ID:jgknight,项目名称:reCAPTCHA,代码行数:24,代码来源:plugin.php

示例13: action_uninstall

 /**
  * Uninstall a plugin by calling its uninstall function and removing its directory.
  *
  * @param string $plugin The name of the plugin.
  * @return void
  */
 public function action_uninstall($plugin = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Get the plugin.
     $plugins = $this->getPlugins();
     if (!$plugin or !array_key_exists($plugin, $plugins)) {
         return;
     }
     $enabledPlugins = C("esoTalk.enabledPlugins");
     // If the plugin is currently enabled, take it out of the loaded plugins array.
     $k = array_search($plugin, $enabledPlugins);
     if ($k !== false) {
         unset($enabledPlugins[$k]);
         // Call the plugin's disable function.
         ET::$plugins[$plugin]->disable();
         ET::writeConfig(array("esoTalk.enabledPlugins" => $enabledPlugins));
     }
     // Set up an instance of the plugin so we can call its uninstall function.
     if (file_exists($file = PATH_PLUGINS . "/" . sanitizeFileName($plugin) . "/plugin.php")) {
         include_once $file;
     }
     $className = "ETPlugin_{$plugin}";
     if (class_exists($className)) {
         $pluginObject = new $className();
         $pluginObject->uninstall();
     }
     // Attempt to remove the directory. If we couldn't, show a "not writable" message.
     if (!is_writable($file = PATH_PLUGINS) or !is_writable($file = PATH_PLUGINS . "/{$plugin}") or !rrmdir($file)) {
         $this->message(sprintf(T("message.notWritable"), $file), "warning");
     } else {
         $this->message(T("message.pluginUninstalled"), "success");
     }
     $this->redirect(URL("admin/plugins"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:42,代码来源:ETPluginsAdminController.class.php

示例14: C

}
//***** 6. INITIALIZE SESSION AND DATABASE, AND CACHE
// Initialize the cache.
$cacheClass = C("esoTalk.cache");
ET::$cache = ETFactory::make($cacheClass ? $cacheClass : "cache");
// Connect to the database.
ET::$database = ETFactory::make("database");
ET::$database->init(C("esoTalk.database.host"), C("esoTalk.database.user"), C("esoTalk.database.password"), C("esoTalk.database.dbName"), C("esoTalk.database.prefix"), C("esoTalk.database.connectionOptions"), C("esoTalk.database.port"));
// Initialize the session.
ET::$session = ETFactory::make("session");
// Check if any plugins need upgrading by comparing the versions in ET::$pluginInfo with the versions in
// ET::$config.
foreach (ET::$plugins as $k => $v) {
    if (C("{$k}.version") != ET::$pluginInfo[$k]["version"]) {
        if ($v->setup(C("{$k}.version"))) {
            ET::writeConfig(array("{$k}.version" => ET::$pluginInfo[$k]["version"]));
        }
    }
}
//***** 7. PARSE REQUEST
// If $_GET["p"] was explicitly specified, use that.
if (!empty($_GET["p"])) {
    $request = $_GET["p"];
    unset($_GET["p"]);
} elseif (C("esoTalk.urls.friendly") and isset($_SERVER["REQUEST_URI"])) {
    // Remove the base path from the request URI.
    $request = preg_replace("|^" . preg_quote(ET::$webPath) . "(/index\\.php)?|", "", $_SERVER["REQUEST_URI"]);
    // If there is a querystring, remove it.
    $selfURL = $request;
    if (($pos = strpos($request, "?")) !== false) {
        $request = substr_replace($request, "", $pos);
开发者ID:19eighties,项目名称:esoTalk,代码行数:31,代码来源:bootstrap.php

示例15: upgrade

 /**
  * Perform an upgrade to ensure that the database is up-to-date.
  *
  * @param string $currentVersion The version we are upgrading from.
  * @return void
  */
 public function upgrade($currentVersion = "")
 {
     // 1.0.0g5:
     // - Drop the cookie table
     // - Write config to enable persistence cookies. These are disabled by
     //   default in g5 because otherwise the ETSession class will encounter
     //   a fatal error (rememberToken column doesn't exist) before reaching
     //   the upgrade script.
     if (version_compare($currentVersion, "1.0.0g5", "<")) {
         ET::$database->structure()->table("cookie")->drop();
         ET::writeConfig(array("esoTalk.enablePersistenceCookies" => true));
     }
     // 1.0.0g4:
     // - Rename the 'confirmedEmail' column on the members table to 'confirmed'
     // - Rename the 'muted' column on the member_conversation table to 'ignored'
     if (version_compare($currentVersion, "1.0.0g4", "<")) {
         ET::$database->structure()->table("member")->renameColumn("confirmedEmail", "confirmed");
         ET::$database->structure()->table("member_conversation")->renameColumn("muted", "ignored");
     }
     // Make sure the application's table structure is up-to-date.
     $this->structure(false);
     // Perform any custom upgrade procedures, from $currentVersion to ESOTALK_VERSION, here.
     // 1.0.0g3:
     /// - Re-calculate all conversation post counts due to a bug which could get them un-synced
     if (version_compare($currentVersion, "1.0.0g3", "<")) {
         ET::SQL()->update("conversation c")->set("countPosts", "(" . ET::SQL()->select("COUNT(*)")->from("post p")->where("p.conversationId=c.conversationId") . ")", false)->exec();
     }
 }
开发者ID:davchezt,项目名称:fireside,代码行数:34,代码来源:ETUpgradeModel.class.php


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