Skip to content

Commit

Permalink
English v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Netrvin committed Jun 20, 2019
1 parent a586793 commit 183aa5d
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 83 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# CFPMP
Cloudflare Partner Management Panel

打开config.php,根据里面的注释进行设置后即可使用
Open config.php and edit it

## 功能
* CNAME接入
## Functions
* CNAME
* reCAPTCHA
* 设置回源地址为IP(基于sslip.io)(默认关闭此功能)
* Set original address as IP(Based on sslip.io)(Close by default)

可用示例:[https://cf.yuzu.im/](https://cf.yuzu.im/)
Demo: [https://cf.yuzu.im/](https://cf.yuzu.im/)
6 changes: 3 additions & 3 deletions add_domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function msg($s){
}

if (empty($_POST["domain"])){
msg("域名不能为空");
msg("Domain name mustn't be empty.");
}

$r=$cloudflare->zone_set($_POST["domain"],$_POST["domain"],"www:".$_POST["domain"]);

if ($r["result"]=="success"){
msg("添加成功");
msg("Success");
}else{
msg("添加失败:".$r["msg"]);
msg("Error: ".$r["msg"]);
}
8 changes: 4 additions & 4 deletions auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ function msg($s){
{
if (!($cloudflare->reCAPTCHA($_POST["g-recaptcha-response"])))
{
msg("请完成验证码");
msg("Please complete the captcha.");
}
}else{
msg("请完成验证码");
msg("Please complete the captcha.");
}
}

Expand All @@ -30,8 +30,8 @@ function msg($s){
$_SESSION["email"]=$r["response"]["cloudflare_email"];
header("Location: domains.php");
}else{
msg("登陆 / 注册失败:".$r["msg"]);
msg("Failed to sign in/up: ".$r["msg"]);
}
}else{
msg("用户名和密码不能为空");
msg("Username and password mustn't be empty.");
}
6 changes: 3 additions & 3 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Cloudflare Partners host key
define("HOST_KEY","");

// 站点名称
// Site name
define("SITE_NAME","");

// reCAPTCHA配置
// reCAPTCHA
define("Enable_reCAPTCHA",false);
define("reCAPTCHA_Site","");
define("reCAPTCHA_Secret","");

//A记录解析(基于sslip.io)
//A Record (Based on sslip.io)
define("Enable_A_Record",false);
6 changes: 3 additions & 3 deletions delete_domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function msg($s){
}

if (empty($_POST["domain"])){
msg("域名不能为空");
msg("Domain name mustn't be empty.");
}

$r=$cloudflare->zone_delete($_POST["domain"]);

if ($r["result"]=="success"){
msg("删除成功");
msg("Deleted successfully.");
}else{
msg("删除失败:".$r["msg"]);
msg("Failed to delete: ".$r["msg"]);
}
36 changes: 18 additions & 18 deletions domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
<a href="./">Cloudflare Partners :
<?=SITE_NAME?>
</a> >
<span>域名管理</span>
<span>Domains Management</span>
<br />
<br />
</div>
<div style="float:right">
<?=$_SESSION["email"]?>.
<a href="./">登出</a>
<a href="./">Sign out</a>
</div>
</div>


<div class="mdui-card mdui-shadow-5">
<div class="mdui-card-content">
<div class="mdui-container mdui-typo">
<button mdui-dialog="{target: '#add_domain'}" style="display:inline" class="mdui-btn mdui-ripple mdui-shadow-4">添加域名</button>
<button mdui-dialog="{target: '#add_domain'}" style="display:inline" class="mdui-btn mdui-ripple mdui-shadow-4">Add domain</button>

<?php if (($r["result"]=="success")&&(!empty($r["response"]["hosted_zones"]))): ?>
<br />
Expand All @@ -43,7 +43,7 @@
<table class="mdui-table">
<thead>
<tr>
<th>域名</th>
<th>Domain</th>
<th class="mdui-table-col-numeric"></th>
<th class="mdui-table-col-numeric"></th>
</tr>
Expand All @@ -54,8 +54,8 @@
$output.='
<tr>
<td>'.$value.'</td>
<td><a href="manage_domain.php?domain='.$value.'">管理</a></td>
<td><a href="" onclick="javascript:delete_domain(\''.$value.'\');return false;">删除</a></td>
<td><a href="manage_domain.php?domain='.$value.'">Manage</a></td>
<td><a href="" onclick="javascript:delete_domain(\''.$value.'\');return false;">Delete</a></td>
</tr>
';
}
Expand All @@ -66,11 +66,11 @@
</div>

<?php elseif ($r["result"]=="error"): ?>
<p>查询失败:
<p>Failed to fetch domains:
<?=$r["msg"];?>

<?php else: ?>
<p>无域名,赶紧添加一个吧!</p>
<p>No domains.</p>
<?php endif; ?>

</div>
Expand All @@ -82,33 +82,33 @@
</div>

<div class="mdui-dialog" id="add_domain">
<div class="mdui-dialog-title">添加域名</div>
<div class="mdui-dialog-title">Add domain</div>
<form method="post" action="add_domain.php" autocomplete="off">
<div class="mdui-dialog-content">
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">域名</label>
<label class="mdui-textfield-label">Domain</label>
<input class="mdui-textfield-input" name="domain" required />
</div>
</div>
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-close>关闭</button>
<input type="submit" class="mdui-btn mdui-ripple" value="添加" />
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-close>Close</button>
<input type="submit" class="mdui-btn mdui-ripple" value="Add" />
</div>
</form>
</div>

<div class="mdui-dialog" id="delete_domain">
<div class="mdui-dialog-title">删除域名</div>
<div class="mdui-dialog-title">Delete domain</div>
<form method="post" action="delete_domain.php" autocomplete="off">
<div class="mdui-dialog-content">
<input type="hidden" value="" name="domain" id="delete_domainname1" /> 你确定要删除域名
<input type="hidden" value="" name="domain" id="delete_domainname1" />Are you sure you want to delete domain
<strong>
<span id="delete_domainname2"></span>
</strong>吗?
</strong> ?
</div>
<div class="mdui-dialog-actions">
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-close>关闭</button>
<input type="submit" class="mdui-btn mdui-ripple" value="确定" />
<button type="button" class="mdui-btn mdui-ripple" mdui-dialog-close>Close</button>
<input type="submit" class="mdui-btn mdui-ripple" value="Confirm" />
</div>
</form>
</div>
Expand All @@ -122,7 +122,7 @@
?>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>关闭</button>
<button class="mdui-btn mdui-ripple" mdui-dialog-close>Close</button>
</div>
</div>

Expand Down
24 changes: 12 additions & 12 deletions edit_record.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ function msg($s){
}

if (empty($_POST["domain"])){
$_SESSION["msg"]="域名不能为空";
$_SESSION["msg"]="Domain name mustn't be empty.";
header("Location: domains.php");
exit(0);
}

if (empty($_POST["action"])){
msg("操作不存在");
msg("Unknown action.");
}

if (empty($_POST["record"])){
msg("记录不能为空");
msg("Record mustn't be empty.");
}

$re=$cloudflare->zone_lookup($_POST["domain"]);
if ($re["result"]!="success"){
msg("操作失败:".$re["msg"]);
msg("Error: ".$re["msg"]);
}
if ($re["response"]["zone_exists"]!=true){
msg("该域名未在Cloudflare接入");
msg("This domain isn't managed by Cloudflare.");
}
if ($re["response"]["zone_hosted"]!=true){
msg("该域名未在".SITE_NAME."接入");
msg("This domain isn't managed by ".SITE_NAME.".");
}

$r=$cloudflare->remove_zone_name($re["response"]["zone_name"],$re["response"]);
Expand All @@ -44,12 +44,12 @@ function msg($s){
$result=$cloudflare->update_record($r["zone_name"],$r["hosted_cnames"]);
if ($result["result"]=="success")
{
msg("删除成功");
msg("Deleted successfully.");
}else{
msg("删除失败:".$result["msg"]);
msg("Failed to delete: ".$result["msg"]);
}
}else{
msg("记录不存在");
msg("This record isn't existed.");
}
}elseif($_POST["action"]=="edit")
{
Expand All @@ -59,11 +59,11 @@ function msg($s){
$result=$cloudflare->update_record($r["zone_name"],$r["hosted_cnames"]);
if ($result["result"]=="success")
{
msg("更新成功");
msg("Updated successfully.");
}else{
msg("更新失败:".$result["msg"]);
msg("Failed to update: ".$result["msg"]);
}
}else{
msg("缺少参数");
msg("Missing parameters.");
}
}
4 changes: 2 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta itemprop="name" property="og:title" content="<?php echo SITE_NAME;?> - Cloudflare Partners" />
<meta name="description" itemprop="description" property="og:description" content="CNAME接入Cloudflare" />
<meta name="description" content="<?php echo SITE_NAME;?> - Cloudflare Partners, CNAME接入Cloudflare" />
<meta name="description" itemprop="description" property="og:description" content="Cloudflare Partner Management Panel" />
<meta name="description" content="<?php echo SITE_NAME;?> - Cloudflare Partners" />
<meta name="keywords" content="<?php echo SITE_NAME;?>,cloudflare,partner,partners,cname" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@0.4.0/dist/css/mdui.min.css" />
<script src="https://cdn.jsdelivr.net/npm/mdui@0.4.0/dist/js/mdui.min.js"></script>
Expand Down
10 changes: 5 additions & 5 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
<form method="post" action="auth.php">

<center>
<h2>登入
<h2>Sign in
<?php echo SITE_NAME; ?>
</h2>
</center>
<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">Cloudflare 邮箱</label>
<label class="mdui-textfield-label">Cloudflare Email</label>
<input class="mdui-textfield-input" name="email" type="email" />
</div>

<div class="mdui-textfield mdui-textfield-floating-label">
<label class="mdui-textfield-label">Cloudflare 密码</label>
<label class="mdui-textfield-label">Cloudflare Password</label>
<input class="mdui-textfield-input" name="password" type="password" />
</div>

Expand All @@ -46,7 +46,7 @@

<div class="mdui-row-xs-1">
<div class="mdui-col">
<input type="submit" class="mdui-btn mdui-btn-block mdui-btn-raised mdui-ripple" value="登录 / 注册" />
<input type="submit" class="mdui-btn mdui-btn-block mdui-btn-raised mdui-ripple" value="Sign in/up" />
</div>
</div>

Expand All @@ -64,7 +64,7 @@
<?php if (!empty($_SESSION["login_msg"])){echo $_SESSION["login_msg"];}?>
</div>
<div class="mdui-dialog-actions">
<button class="mdui-btn mdui-ripple" mdui-dialog-close>关闭</button>
<button class="mdui-btn mdui-ripple" mdui-dialog-close>Close</button>
</div>
</div>

Expand Down
Loading

0 comments on commit 183aa5d

Please sign in to comment.