]> source.dussan.org Git - nextcloud-server.git/commitdiff
make it possible to override every image and logo with a new version from within...
authorFrank Karlitschek <karlitschek@kde.org>
Tue, 14 Feb 2012 15:32:38 +0000 (16:32 +0100)
committerFrank Karlitschek <karlitschek@kde.org>
Tue, 14 Feb 2012 15:32:38 +0000 (16:32 +0100)
lib/helper.php

index 4d1219d78d44e04bbe88b7365406cbd5d27b6447..6d3df6d97e7108064e876aada412134269ad15d3 100644 (file)
@@ -75,18 +75,25 @@ class OC_Helper {
         *
         * Returns the path to the image.
         */
-       public static function imagePath( $app, $image ){
-               // Check if the app is in the app folder
-               if( file_exists( OC::$SERVERROOT."/apps/$app/img/$image" )){
-                       return OC::$WEBROOT."/apps/$app/img/$image";
-               }
-               elseif( !empty( $app )){
-                       return OC::$WEBROOT."/$app/img/$image";
-               }
-               else{
-                       return OC::$WEBROOT."/core/img/$image";
-               }
-       }
+        public static function imagePath( $app, $image ){
+                // Read the selected theme from the config file
+                $theme=OC_Config::getValue( "theme" );
+
+                // Check if the app is in the app folder
+                if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )){
+                        return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image";
+                }elseif( file_exists( OC::$SERVERROOT."/apps/$app/img/$image" )){
+                        return OC::$WEBROOT."/apps/$app/img/$image";
+                }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )){
+                        return OC::$WEBROOT."/themes/$theme/$app/img/$image";
+                }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )){
+                        return OC::$WEBROOT."/$app/img/$image";
+                }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/core/img/$image" )){
+                        return OC::$WEBROOT."/themes/$theme/core/img/$image";
+                }else{
+                        return OC::$WEBROOT."/core/img/$image";
+                }
+        }
 
        /**
         * @brief get path to icon of file type