@@ -57,8 +57,8 @@ public function __construct(\Slim\Container $container)
5757 $ this ->conf = $ container ->get ('conf ' );
5858
5959 //$this->view = $container->get('view');
60- $ this -> plugin_manager = $ container -> get ( ' plugin_manager ' );
61- $ this ->appLangFiles = $ container ->get ('appLangFiles ' );
60+
61+ $ this ->appLangFiles = $ container ->get ('appLangFiles ' );
6262
6363 $ this ->appName = $ container ->get ('settings ' )['appName ' ];
6464 $ this ->appVersion = $ container ->get ('settings ' )['appVersion ' ];
@@ -729,49 +729,37 @@ public function getRequestVars($subject = '')
729729
730730 public function icon ($ icon )
731731 {
732- if (is_string ($ icon )) {
733- $ path = "/assets/images/themes/ {$ this ->conf ['theme ' ]}/ {$ icon }" ;
734- if (file_exists (\BASE_PATH .$ path .'.png ' )) {
735- return SUBFOLDER .$ path .'.png ' ;
736- }
737-
738- if (file_exists (\BASE_PATH .$ path .'.gif ' )) {
739- return SUBFOLDER .$ path .'.gif ' ;
740- }
741-
742- if (file_exists (\BASE_PATH .$ path .'.ico ' )) {
743- return SUBFOLDER .$ path .'.ico ' ;
744- }
732+ if (!is_string ($ icon )) {
733+ return '' ;
734+ }
735+ $ theme = $ this ->conf ['theme ' ];
736+ $ path = 'assets/images/themes ' ;
737+ $ default_icon = sprintf ('%s/%s/default/DisconnectedServer.png ' , SUBFOLDER , $ path );
738+ if (is_readable (sprintf ('%s/%s/%s/%s.png ' , \BASE_PATH , $ path , $ theme , $ icon ))) {
739+ return sprintf ('%s/%s/%s/%s.png ' , \SUBFOLDER , $ path , $ theme , $ icon );
740+ }
745741
746- $ path = "/assets/images/themes/default/ {$ icon }" ;
747- if (file_exists (\BASE_PATH .$ path .'.png ' )) {
748- return SUBFOLDER .$ path .'.png ' ;
749- }
742+ if (is_readable (sprintf ('%s/%s/%s/%s.gif ' , \BASE_PATH , $ path , $ theme , $ icon ))) {
743+ return sprintf ('%s/%s/%s/%s.gif ' , \SUBFOLDER , $ path , $ theme , $ icon );
744+ }
750745
751- if (file_exists ( \BASE_PATH . $ path. ' .gif ' )) {
752- return SUBFOLDER . $ path . ' .gif ' ;
753- }
746+ if (is_readable ( sprintf ( ' %s/%s/%s/%s.ico ' , \BASE_PATH , $ path, $ theme , $ icon ) )) {
747+ return sprintf ( ' %s/%s/%s/%s.ico ' , \ SUBFOLDER , $ path , $ theme , $ icon ) ;
748+ }
754749
755- if (file_exists (\BASE_PATH .$ path .'.ico ' )) {
756- return SUBFOLDER .$ path .'.ico ' ;
757- }
758- } else {
759- // Icon from plugins
760- $ path = "/plugins/ {$ icon [0 ]}/images/ {$ icon [1 ]}" ;
761- if (file_exists (\BASE_PATH .$ path .'.png ' )) {
762- return SUBFOLDER .$ path .'.png ' ;
763- }
750+ if (is_readable (sprintf ('%s/%s/default/%s.png ' , \BASE_PATH , $ path , $ icon ))) {
751+ return sprintf ('%s/%s/default/%s.png ' , \SUBFOLDER , $ path , $ icon );
752+ }
764753
765- if (file_exists (\ BASE_PATH . $ path . ' .gif ' )) {
766- return SUBFOLDER . $ path . ' .gif ' ;
767- }
754+ if (is_readable ( sprintf ( ' %s/%s/default/%s .gif ', \ BASE_PATH , $ path , $ icon ) )) {
755+ return sprintf ( ' %s/%s/default/%s .gif ', \ SUBFOLDER , $ path , $ icon ) ;
756+ }
768757
769- if (file_exists (\BASE_PATH .$ path .'.ico ' )) {
770- return SUBFOLDER .$ path .'.ico ' ;
771- }
758+ if (is_readable (sprintf ('%s/%s/default/%s.ico ' , \BASE_PATH , $ path , $ icon ))) {
759+ return sprintf ('%s/%s/default/%s.ico ' , \SUBFOLDER , $ path , $ icon );
772760 }
773761
774- return '' ;
762+ return $ default_icon ;
775763 }
776764
777765 /**
0 commit comments