Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
L
Liman MYS - Çekirdek
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
liman
Liman MYS - Çekirdek
Commits
3e03914c
Kaydet (Commit)
3e03914c
authored
Kas 20, 2020
tarafından
mertcelen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Better handling for deleted objects.
üst
36422a1d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
29 deletions
+49
-29
MainController.php
app/Http/Controllers/CronMail/MainController.php
+49
-29
No files found.
app/Http/Controllers/CronMail/MainController.php
Dosyayı görüntüle @
3e03914c
...
...
@@ -15,21 +15,21 @@ class MainController extends Controller
public
function
getMailTags
()
{
$path
=
"/liman/extensions/"
.
strtolower
(
extension
()
->
name
)
.
"/db.json"
;
if
(
!
is_file
(
$path
))
{
return
respond
(
"Bu eklentinin bir veritabanı yok!"
,
201
);
if
(
!
is_file
(
$path
))
{
return
respond
(
"Bu eklentinin bir veritabanı yok!"
,
201
);
}
$file
=
file_get_contents
(
$path
);
$json
=
json_decode
(
$file
,
true
);
$json
=
json_decode
(
$file
,
true
);
if
(
json_last_error
()
!=
JSON_ERROR_NONE
)
{
return
respond
(
"Eklenti veritabanı okunamıyor."
,
201
);
if
(
json_last_error
()
!=
JSON_ERROR_NONE
)
{
return
respond
(
"Eklenti veritabanı okunamıyor."
,
201
);
}
if
(
array_key_exists
(
"mail_tags"
,
$json
))
{
if
(
array_key_exists
(
"mail_tags"
,
$json
))
{
return
respond
(
$json
[
"mail_tags"
]);
}
else
{
}
else
{
return
respond
([]);
}
}
...
...
@@ -38,10 +38,10 @@ class MainController extends Controller
{
$obj
=
new
CronMail
(
request
()
->
all
());
$obj
->
last
=
0
;
if
(
$obj
->
save
()){
if
(
$obj
->
save
())
{
return
respond
(
"Mail ayarı başarıyla eklendi"
);
}
else
{
return
respond
(
"Mail ayarı eklenemedi!"
,
201
);
}
else
{
return
respond
(
"Mail ayarı eklenemedi!"
,
201
);
}
}
...
...
@@ -49,34 +49,35 @@ class MainController extends Controller
{
$obj
=
CronMail
::
find
(
request
(
"cron_id"
));
if
(
$obj
==
null
)
{
if
(
$obj
==
null
)
{
return
respond
(
"Bu mail ayarı bulunamadı!"
);
}
if
(
$obj
->
delete
()){
if
(
$obj
->
delete
())
{
return
respond
(
"Mail ayarı başarıyla silindi"
);
}
else
{
return
respond
(
"Mail ayarı silinemedi!"
,
201
);
}
else
{
return
respond
(
"Mail ayarı silinemedi!"
,
201
);
}
}
private
$tagTexts
=
[];
private
function
getTagText
(
$key
,
$extension_name
){
if
(
!
array_key_exists
(
$extension_name
,
$this
->
tagTexts
)){
$file
=
file_get_contents
(
"/liman/extensions/"
.
strtolower
(
$extension_name
)
.
"/db.json"
);
$json
=
json_decode
(
$file
,
true
);
if
(
json_last_error
()
!=
JSON_ERROR_NONE
){
private
function
getTagText
(
$key
,
$extension_name
)
{
if
(
!
array_key_exists
(
$extension_name
,
$this
->
tagTexts
))
{
$file
=
file_get_contents
(
"/liman/extensions/"
.
strtolower
(
$extension_name
)
.
"/db.json"
);
$json
=
json_decode
(
$file
,
true
);
if
(
json_last_error
()
!=
JSON_ERROR_NONE
)
{
return
$key
;
}
$this
->
tagTexts
[
$extension_name
]
=
$json
;
}
if
(
!
array_key_exists
(
"mail_tags"
,
$this
->
tagTexts
[
$extension_name
]))
{
if
(
!
array_key_exists
(
"mail_tags"
,
$this
->
tagTexts
[
$extension_name
]))
{
return
$key
;
}
foreach
(
$this
->
tagTexts
[
$extension_name
][
"mail_tags"
]
as
$obj
)
{
if
(
$obj
[
"tag"
]
==
$key
)
{
foreach
(
$this
->
tagTexts
[
$extension_name
][
"mail_tags"
]
as
$obj
)
{
if
(
$obj
[
"tag"
]
==
$key
)
{
return
$obj
[
"description"
];
}
}
...
...
@@ -85,15 +86,34 @@ class MainController extends Controller
public
function
getCronMail
()
{
$mails
=
CronMail
::
all
()
->
map
(
function
(
$obj
)
{
$mails
=
CronMail
::
all
()
->
map
(
function
(
$obj
)
{
$ext
=
Extension
::
find
(
$obj
->
extension_id
);
$obj
->
extension_name
=
$ext
->
display_name
;
$obj
->
username
=
User
::
find
(
$obj
->
user_id
)
->
name
;
$obj
->
server_name
=
Server
::
find
(
$obj
->
server_id
)
->
name
;
$obj
->
tag_string
=
$this
->
getTagText
(
$obj
->
target
,
$ext
->
name
);
if
(
$ext
)
{
$obj
->
extension_name
=
$ext
->
display_name
;
$obj
->
tag_string
=
$this
->
getTagText
(
$obj
->
target
,
$ext
->
name
);
}
else
{
$obj
->
extension_name
=
"Bu eklenti silinmiş!"
;
$obj
->
tag_string
=
"Bu eklenti silinmiş!"
;
}
$srv
=
Server
::
find
(
$obj
->
server_id
);
if
(
$srv
)
{
$obj
->
server_name
=
$srv
->
name
;
}
else
{
$obj
->
server_name
=
"Bu sunucu silinmiş!"
;
}
$usr
=
User
::
find
(
$obj
->
user_id
);
if
(
$usr
)
{
$obj
->
username
=
$usr
->
name
;
}
else
{
$obj
->
username
=
"Bu kullanıcı silinmiş!"
;
}
return
$obj
;
});
return
view
(
"settings.mail"
,[
return
view
(
"settings.mail"
,
[
"cronMails"
=>
$mails
]);
}
...
...
@@ -102,7 +122,7 @@ class MainController extends Controller
{
$obj
=
CronMail
::
find
(
request
(
"cron_id"
));
if
(
$obj
==
null
)
{
if
(
$obj
==
null
)
{
return
respond
(
"Bu mail ayarı bulunamadı!"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment