smtp setting add encryption

This commit is contained in:
xiaomlove
2022-01-28 02:50:30 +08:00
parent 27ba9aec74
commit 8d6d9d8c15
18 changed files with 93 additions and 51 deletions
+1 -1
View File
@@ -5,9 +5,9 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "admin",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^0.2.6",
"axios": "^0.21.1", "axios": "^0.21.1",
"element-plus": "^1.3.0-beta.5", "element-plus": "^1.3.0-beta.5",
"vue": "^3.0.5", "vue": "^3.0.5",
+1
View File
@@ -7,6 +7,7 @@
"serve": "vite preview --mode preview" "serve": "vite preview --mode preview"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^0.2.6",
"axios": "^0.21.1", "axios": "^0.21.1",
"element-plus": "^1.3.0-beta.5", "element-plus": "^1.3.0-beta.5",
"vue": "^3.0.5", "vue": "^3.0.5",
+7 -7
View File
@@ -17,15 +17,15 @@
:default-active='state.currentPath' :default-active='state.currentPath'
> >
<el-menu-item index="/"><i class="el-icon-odometer" />Dashboard</el-menu-item> <el-menu-item index="/"><i class="el-icon-odometer" />Dashboard</el-menu-item>
<el-submenu index="2"> <el-sub-menu index="2">
<template #title> <template #title>
<span>User</span> <span>User</span>
</template> </template>
<el-menu-item-group> <el-menu-item-group>
<el-menu-item index="/user"><i class="el-icon-user" />User list</el-menu-item> <el-menu-item index="/user"><i class="el-icon-user" />User list</el-menu-item>
</el-menu-item-group> </el-menu-item-group>
</el-submenu> </el-sub-menu>
<el-submenu index="3"> <el-sub-menu index="3">
<template #title> <template #title>
<span>System</span> <span>System</span>
</template> </template>
@@ -44,7 +44,7 @@
<el-menu-item-group> <el-menu-item-group>
<el-menu-item index="/setting"><i class="el-icon-menu" />Setting</el-menu-item> <el-menu-item index="/setting"><i class="el-icon-menu" />Setting</el-menu-item>
</el-menu-item-group> </el-menu-item-group>
</el-submenu> </el-sub-menu>
</el-menu> </el-menu>
</el-aside> </el-aside>
<el-container class="content"> <el-container class="content">
@@ -186,14 +186,14 @@ body {
.el-menu { .el-menu {
border-right: none!important; border-right: none!important;
} }
.el-submenu { .el-sub-menu {
border-top: 1px solid hsla(0, 0%, 100%, .05); border-top: 1px solid hsla(0, 0%, 100%, .05);
border-bottom: 1px solid rgba(0, 0, 0, .2); border-bottom: 1px solid rgba(0, 0, 0, .2);
} }
.el-submenu:first-child { .el-sub-menu:first-child {
border-top: none; border-top: none;
} }
.el-submenu [class^="el-icon-"] { .el-sub-menu [class^="el-icon-"] {
vertical-align: -1px!important; vertical-align: -1px!important;
} }
a { a {
+7 -1
View File
@@ -4,4 +4,10 @@ import ElementPlus from 'element-plus'
import router from './router/index' import router from './router/index'
import 'element-plus/theme-chalk/index.css' import 'element-plus/theme-chalk/index.css'
import './styles/common.scss' import './styles/common.scss'
createApp(App).use(ElementPlus).use(router).mount('#app') import * as ElIcons from '@element-plus/icons-vue'
const app = createApp(App)
for (const name in ElIcons) {
app.component(name, ElIcons[name])
}
app.use(ElementPlus).use(router).mount('#app')
+1 -1
View File
@@ -6,7 +6,7 @@
</div> </div>
<div class="right"> <div class="right">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button> <el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div> </div>
</div> </div>
</template> </template>
+12 -4
View File
@@ -6,7 +6,7 @@
</div> </div>
<div class="right"> <div class="right">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button> <el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div> </div>
</div> </div>
</template> </template>
@@ -33,11 +33,19 @@
<el-table-column <el-table-column
prop="image_large" prop="image_large"
label="Large image" label="Large image"
></el-table-column> >
<template #default="scope">
<el-image :src="scope.row.image_large" style="max-height: 200px" />
</template>
</el-table-column>
<el-table-column <el-table-column
prop="image_small" prop="image_small"
label="Small image" label="Small image"
></el-table-column> >
<template #default="scope">
<el-image :src="scope.row.image_small" style="max-height: 200px" />
</template>
</el-table-column>
<el-table-column <el-table-column
prop="get_type_text" prop="get_type_text"
@@ -56,7 +64,7 @@
<el-table-column <el-table-column
label="Action" label="Action"
width="100" width=""
> >
<template #default="scope"> <template #default="scope">
<a style="cursor: pointer; margin-right: 10px" @click="handleEdit(scope.row.id)">Edit</a> <a style="cursor: pointer; margin-right: 10px" @click="handleEdit(scope.row.id)">Edit</a>
+7 -4
View File
@@ -19,10 +19,10 @@
<td></td> <td></td>
<td colspan="7"> <td colspan="7">
<div class="other-actions"> <div class="other-actions">
<el-button type="primary" size="mini" @click="handleGetModComment">Mod comment</el-button> <el-button type="primary" size="default" @click="handleGetModComment">Mod comment</el-button>
<el-button type="primary" size="mini" @click="handleResetPassword">Reset password</el-button> <el-button type="primary" size="default" @click="handleResetPassword">Reset password</el-button>
<el-button type="primary" size="mini" @click="handleAssignExam">Assign exam</el-button> <el-button type="primary" size="default" @click="handleAssignExam">Assign exam</el-button>
<el-button type="primary" size="mini" @click="handleGrantMedal">Grant medal</el-button> <el-button type="primary" size="default" @click="handleGrantMedal">Grant medal</el-button>
</div> </div>
</td> </td>
</tr> </tr>
@@ -179,6 +179,9 @@
prop="image_large" prop="image_large"
label="Image" label="Image"
> >
<template #default="scope">
<el-image :src="scope.row.image_large" style="max-height: 200px" />
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
+7 -2
View File
@@ -1,8 +1,13 @@
<template> <template>
<el-card> <el-card>
<template #header> <template #header>
<div class="header"> <div class="nexus-table-header">
<el-button type="primary" size="small" icon="el-icon-plus" @click="handleAdd">Add</el-button> <div class="left">
</div>
<div class="right">
<el-button type="primary" size="small" icon="Plus" @click="handleAdd">Add</el-button>
</div>
</div> </div>
</template> </template>
<el-table <el-table
-7
View File
@@ -379,12 +379,5 @@ class TorrentRepository extends BaseRepository
} }
public function getStickyStatus($torrent)
{
if (!$torrent instanceof Torrent) {
$torrent = Torrent::query()->findOrFail((int)$torrent, ['id', 'pos_state']);
}
}
} }
+2 -2
View File
@@ -22,7 +22,7 @@
] ]
}, },
"require": { "require": {
"php": "^7.3|^8.0", "php": "^8.0",
"ext-gd": "*", "ext-gd": "*",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
@@ -35,7 +35,7 @@
"geoip2/geoip2": "~2.0", "geoip2/geoip2": "~2.0",
"guzzlehttp/guzzle": "~6.0", "guzzlehttp/guzzle": "~6.0",
"hashids/hashids": "^4.1", "hashids/hashids": "^4.1",
"imdbphp/imdbphp": "^6.4", "imdbphp/imdbphp": "^7.0",
"laravel-lang/lang": "~7.0", "laravel-lang/lang": "~7.0",
"laravel/framework": "^8.12", "laravel/framework": "^8.12",
"laravel/sanctum": "^2.10", "laravel/sanctum": "^2.10",
Generated
+17 -9
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "536588e03f43a227f60cd6666dbb4e3f", "content-hash": "4893668aed1fe063d932fc9d9e5ea4d5",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@@ -1740,22 +1740,30 @@
}, },
{ {
"name": "imdbphp/imdbphp", "name": "imdbphp/imdbphp",
"version": "v6.5.1", "version": "v7.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/tboothman/imdbphp.git", "url": "https://github.com/tboothman/imdbphp.git",
"reference": "4a88ceeabadf1c7b4924dd321fb89bc642b58bee" "reference": "8bd3b62344add278959c297a56f0cffd2796e12f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/tboothman/imdbphp/zipball/4a88ceeabadf1c7b4924dd321fb89bc642b58bee", "url": "https://api.github.com/repos/tboothman/imdbphp/zipball/8bd3b62344add278959c297a56f0cffd2796e12f",
"reference": "4a88ceeabadf1c7b4924dd321fb89bc642b58bee", "reference": "8bd3b62344add278959c297a56f0cffd2796e12f",
"shasum": "" "shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*",
"ext-simplexml": "*",
"php": ">=5.6", "php": ">=5.6",
"psr/log": "~1.0", "psr/log": "~1.0",
"psr/simple-cache": "^1.0" "psr/simple-cache": "^1.0"
@@ -1779,9 +1787,9 @@
"description": "Library for retrieving film and tv information from IMDb", "description": "Library for retrieving film and tv information from IMDb",
"support": { "support": {
"issues": "https://github.com/tboothman/imdbphp/issues", "issues": "https://github.com/tboothman/imdbphp/issues",
"source": "https://github.com/tboothman/imdbphp/tree/v6.5.1" "source": "https://github.com/tboothman/imdbphp/tree/v7.2.0"
}, },
"time": "2021-05-30T00:19:11+00:00" "time": "2021-07-15T12:15:21+00:00"
}, },
{ {
"name": "laravel-lang/lang", "name": "laravel-lang/lang",
@@ -9439,5 +9447,5 @@
"ext-bcmath": "*" "ext-bcmath": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.1.0" "plugin-api-version": "2.2.0"
} }
+5 -1
View File
@@ -1421,7 +1421,11 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
$setting = get_setting('smtp'); $setting = get_setting('smtp');
// Create the Transport // Create the Transport
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $setting['smtpport'] == 465 ? 'ssl' : null)) $encryption = null;
if (isset($setting['encryption']) && in_array($setting['encryption'], ['ssl', 'tls'])) {
$encryption = $setting['encryption'];
}
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $encryption))
->setUsername($setting['accountname']) ->setUsername($setting['accountname'])
->setPassword($setting['accountpassword']) ->setPassword($setting['accountpassword'])
; ;
+1
View File
@@ -557,6 +557,7 @@ $lang_settings = array
'text_setting_for_external_type' => "外部类型设定", 'text_setting_for_external_type' => "外部类型设定",
'row_outgoing_mail_address' => "SMTP地址", 'row_outgoing_mail_address' => "SMTP地址",
'row_outgoing_mail_port' => "SMTP端口", 'row_outgoing_mail_port' => "SMTP端口",
'row_outgoing_mail_encryption' => "SMTP加密方式",
'text_outgoing_mail_address_note' => "<b>提示:</b> smtp.yourisp.com", 'text_outgoing_mail_address_note' => "<b>提示:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>提示:</b> 25", 'text_outgoing_mail_port_note' => "<b>提示:</b> 25",
'row_smtp_account_name' => "用户名", 'row_smtp_account_name' => "用户名",
+1
View File
@@ -557,6 +557,7 @@ $lang_settings = array
'text_setting_for_external_type' => "外部類別設定", 'text_setting_for_external_type' => "外部類別設定",
'row_outgoing_mail_address' => "SMTP位址", 'row_outgoing_mail_address' => "SMTP位址",
'row_outgoing_mail_port' => "SMTP通訊埠", 'row_outgoing_mail_port' => "SMTP通訊埠",
'row_outgoing_mail_encryption' => "SMTP加密方式",
'text_outgoing_mail_address_note' => "<b>輔助說明:</b> smtp.yourisp.com", 'text_outgoing_mail_address_note' => "<b>輔助說明:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>輔助說明:</b> 25", 'text_outgoing_mail_port_note' => "<b>輔助說明:</b> 25",
'row_smtp_account_name' => "用戶名", 'row_smtp_account_name' => "用戶名",
+1
View File
@@ -556,6 +556,7 @@ $lang_settings = array
'text_setting_for_external_type' => "Settings for External type", 'text_setting_for_external_type' => "Settings for External type",
'row_outgoing_mail_address' => "Outgoing mail (SMTP) address", 'row_outgoing_mail_address' => "Outgoing mail (SMTP) address",
'row_outgoing_mail_port' => "Outgoing mail (SMTP) port", 'row_outgoing_mail_port' => "Outgoing mail (SMTP) port",
'row_outgoing_mail_encryption' => "Outgoing mail (SMTP) encryption",
'text_outgoing_mail_address_note' => "<b>hint:</b> smtp.yourisp.com", 'text_outgoing_mail_address_note' => "<b>hint:</b> smtp.yourisp.com",
'text_outgoing_mail_port_note' => "<b>hint:</b> 25", 'text_outgoing_mail_port_note' => "<b>hint:</b> 25",
'row_smtp_account_name' => "Account Name", 'row_smtp_account_name' => "Account Name",
+13 -9
View File
@@ -104,15 +104,19 @@ $trackerReportAuthKey = $torrentRep->getTrackerReportAuthKey($id, $CURUSER['id']
$dict = \Rhilip\Bencode\Bencode::load($fn); $dict = \Rhilip\Bencode\Bencode::load($fn);
$dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey"; $dict['announce'] = $ssl_torrent . $base_announce_url . "?authkey=$trackerReportAuthKey";
if (count($announce_urls) > 1) { /**
foreach ($announce_urls as $announce_url) { * does not support multi-tracker
/** d['announce-list'] = [[ tracker1, tracker2, tracker3 ]] */ *
$dict['announce-list'][0][] = $ssl_torrent . $announce_url . "?authkey=$trackerReportAuthKey"; * @see https://github.com/xiaomlove/nexusphp/issues/26
*/
/** d['announce-list'] = [ [tracker1], [backup1], [backup2] ] */ //if (count($announce_urls) > 1) {
//$dict['announce-list'][] = [$ssl_torrent . $announce_url . "?passkey=" . $CURUSER['passkey']]; // foreach ($announce_urls as $announce_url) {
} // /** d['announce-list'] = [[ tracker1, tracker2, tracker3 ]] */
} // $dict['announce-list'][0][] = $ssl_torrent . $announce_url . "?authkey=$trackerReportAuthKey";
// /** d['announce-list'] = [ [tracker1], [backup1], [backup2] ] */
// //$dict['announce-list'][] = [$ssl_torrent . $announce_url . "?passkey=" . $CURUSER['passkey']];
// }
//}
//$dict = bdec_file($fn, $max_torrent_size); //$dict = bdec_file($fn, $max_torrent_size);
//$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]"; //$dict['value']['announce']['value'] = $ssl_torrent . $base_announce_url . "?passkey=$CURUSER[passkey]";
+5 -2
View File
@@ -112,14 +112,17 @@ function bonusarray($option = 0){
$results[] = $bonus; $results[] = $bonus;
//Buy medal //Buy medal
$medals = \App\Models\Medal::query()->get(); $medals = \App\Models\Medal::query()->where('get_type', \App\Models\Medal::GET_TYPE_EXCHANGE)->get();
foreach ($medals as $medal) { foreach ($medals as $medal) {
$results[] = [ $results[] = [
'points' => $medal->price, 'points' => $medal->price,
'art' => 'buy_medal', 'art' => 'buy_medal',
'menge' => 0, 'menge' => 0,
'name' => $medal->name, 'name' => $medal->name,
'description' => sprintf('<span>%s</span><input type="hidden" name="medal_id" value="%s">', $medal->description, $medal->id), 'description' => sprintf(
'<div style="display: flex;align-items: center"><div style="padding: 10px">%s</div><div><img src="%s" style="max-height: 120px"/></div></div><input type="hidden" name="medal_id" value="%s">',
$medal->description, $medal->image_large, $medal->id
),
'medal_id' => $medal->id, 'medal_id' => $medal->id,
]; ];
} }
+5 -1
View File
@@ -166,7 +166,7 @@ elseif ($action == 'savesettings_smtp') // save smtp
if (isset($smtptype) && $smtptype == 'advanced') { if (isset($smtptype) && $smtptype == 'advanced') {
$validConfig = array_merge($validConfig, array('smtp_host','smtp_port','smtp_from')); $validConfig = array_merge($validConfig, array('smtp_host','smtp_port','smtp_from'));
} elseif ($smtptype == 'external') { } elseif ($smtptype == 'external') {
$validConfig = array_merge($validConfig, array('smtpaddress','smtpport','accountname','accountpassword')); $validConfig = array_merge($validConfig, array('smtpaddress','smtpport', 'encryption', 'accountname','accountpassword'));
} }
GetVar($validConfig); GetVar($validConfig);
@@ -306,6 +306,10 @@ elseif ($action == 'smtpsettings') // stmp settings
print("<tr><td colspan=2 align=center><b>".$lang_settings['text_setting_for_external_type']."</b></td></tr>"); print("<tr><td colspan=2 align=center><b>".$lang_settings['text_setting_for_external_type']."</b></td></tr>");
tr($lang_settings['row_outgoing_mail_address'], "<input type=text name=smtpaddress style=\"width: 300px\" ".(!empty($SMTP['smtpaddress']) ? "value=\"".$SMTP['smtpaddress']."\"" : "")."> ".$lang_settings['text_outgoing_mail_address_note'], 1); tr($lang_settings['row_outgoing_mail_address'], "<input type=text name=smtpaddress style=\"width: 300px\" ".(!empty($SMTP['smtpaddress']) ? "value=\"".$SMTP['smtpaddress']."\"" : "")."> ".$lang_settings['text_outgoing_mail_address_note'], 1);
tr($lang_settings['row_outgoing_mail_port'], "<input type=text name=smtpport style=\"width: 300px\" ".(!empty($SMTP['smtpport']) ? "value=\"".$SMTP['smtpport']."\"" : "")."> ".$lang_settings['text_outgoing_mail_port_note'], 1); tr($lang_settings['row_outgoing_mail_port'], "<input type=text name=smtpport style=\"width: 300px\" ".(!empty($SMTP['smtpport']) ? "value=\"".$SMTP['smtpport']."\"" : "")."> ".$lang_settings['text_outgoing_mail_port_note'], 1);
$encryptionRadio = '<label><input type="radio" name="encryption" value="" ' . (empty($SMTP['encryption']) ? " checked" : "") . ' />none</label>';
$encryptionRadio .= '<label><input type="radio" name="encryption" value="tls"' . ($SMTP['encryption'] == "tls" ? " checked" : "") . '/>tls</label>';
$encryptionRadio .= '<label><input type="radio" name="encryption" value="ssl"' . ($SMTP['encryption'] == "ssl" ? " checked" : "") . '/>ssl</label>';
tr($lang_settings['row_outgoing_mail_encryption'], $encryptionRadio, 1);
tr($lang_settings['row_smtp_account_name'], "<input type=text name=accountname style=\"width: 300px\" ".(!empty($SMTP['accountname']) ? "value=\"".$SMTP['accountname']."\"" : "")."> ".$lang_settings['text_smtp_account_name_note'], 1); tr($lang_settings['row_smtp_account_name'], "<input type=text name=accountname style=\"width: 300px\" ".(!empty($SMTP['accountname']) ? "value=\"".$SMTP['accountname']."\"" : "")."> ".$lang_settings['text_smtp_account_name_note'], 1);
tr($lang_settings['row_smtp_account_password'], "<input type=password name=accountpassword style=\"width: 300px\" ".(!empty($SMTP['accountpassword']) ? "value=\"".$SMTP['accountpassword']."\"" : "")."> ".$lang_settings['text_smtp_account_password_note'], 1); tr($lang_settings['row_smtp_account_password'], "<input type=password name=accountpassword style=\"width: 300px\" ".(!empty($SMTP['accountpassword']) ? "value=\"".$SMTP['accountpassword']."\"" : "")."> ".$lang_settings['text_smtp_account_password_note'], 1);
print("</tbody><tbody>"); print("</tbody><tbody>");