Skip to content

Commit

Permalink
add cdn config
Browse files Browse the repository at this point in the history
  • Loading branch information
skywalker512 committed Jul 11, 2018
1 parent 28c1a01 commit 8991fa9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions addons/languages/Chinese/definitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
$definitions["Forum Settings"] = "社区设置";
$definitions["Forum Statistics"] = "社区统计";
$definitions["Forum title"] = "社区标题";
$definitions["Cdn url"] = "CDN 地址";
$definitions["forumDescription"] = "一个简约而不简单,回归社区本质的论坛程序。";

$definitions["Give this group the 'moderate' permission on all existing channels"] = "给这个小组的所有成员'适当的'权限";
Expand Down
1 change: 1 addition & 0 deletions core/config.defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
$config["esoTalk.forumLogo"] = false; // Path to an image file to replace the title (don't make it too big or it'll stretch the header!)
$config["esoTalk.language"] = "Chinese";
$config["esoTalk.baseURL"] = "";
$config["esoTalk.cdnURL"] = "";
$config["esoTalk.resourceURL"] = ""; // URL used for all resources (CSS+JS+images, including those from plugins and skins.) If blank, the base URL will be used.
$config["esoTalk.rootAdmin"] = 1; // The member ID of the root administrator.
$config["esoTalk.emailFrom"] = ""; // The email address to send forum emails (notifications etc.) from.
Expand Down
1 change: 1 addition & 0 deletions core/controllers/ETInstallController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function action_install()
"esoTalk.database.prefix" => $info["tablePrefix"]."_",
"esoTalk.forumTitle" => $info["forumTitle"],
"esoTalk.baseURL" => $info["baseURL"],
"esoTalk.cdnURL" => $info["baseURL"],
"esoTalk.emailFrom" => "do_not_reply@{$_SERVER["HTTP_HOST"]}",
"esoTalk.cookie.name" => preg_replace(array("/\s+/", "/[^\w]/"), array("_", ""), $info["forumTitle"]),
"esoTalk.urls.friendly" => !empty($info["friendlyURLs"]),
Expand Down
2 changes: 2 additions & 0 deletions core/controllers/admin/ETSettingsAdminController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function action_index()

// Set the default values for the forum inputs.
$form->setValue("forumTitle", C("esoTalk.forumTitle"));
$form->setValue("cdnURL", C("esoTalk.cdnURL"));
$form->setValue("language", C("esoTalk.language"));
$form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
$form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
Expand Down Expand Up @@ -63,6 +64,7 @@ public function action_index()
// Construct an array of config options to write.
$config = array(
"esoTalk.forumTitle" => $form->getValue("forumTitle"),
"esoTalk.cdnURL" => $form->getValue("cdnURL"),
"esoTalk.language" => $form->getValue("language"),
"esoTalk.forumLogo" => $forumLogo,
"esoTalk.defaultRoute" => $form->getValue("defaultRoute"),
Expand Down
4 changes: 2 additions & 2 deletions core/lib/ETController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ public function head()

// For each of the files that we need to include in the page, add a <link> tag.
foreach ($files as $file)
$head .= "<link rel='stylesheet' href='".getResource($file)."?".@filemtime($file)."'>\n";
$head .= "<link rel='stylesheet' href='".C("esoTalk.cdnURL").getResource($file)."?".@filemtime($file)."'>\n";

}

Expand Down Expand Up @@ -845,7 +845,7 @@ public function head()

// For each of the files that we need to include in the page, add a <script> tag.
foreach ($files as $file)
$head .= "<script src='".getResource($file)."?".filemtime($file)."'></script>\n";
$head .= "<script src='".C("esoTalk.cdnURL").getResource($file)."?".filemtime($file)."'></script>\n";
}

// Finally, append the custom HTML string constructed via $this->addToHead().
Expand Down
9 changes: 9 additions & 0 deletions core/views/admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@

<li class='sep'></li>

<ul class='form'>

<li>
<label><?php echo T("Cdn url"); ?></label>
<?php echo $form->input("cdnURL", "text"); ?>
</li>

<li class='sep'></li>

<li>
<label><?php echo T("Default forum language"); ?></label>
<?php echo $form->select("language", $data["languages"]); ?>
Expand Down

0 comments on commit 8991fa9

Please sign in to comment.