uiconfig.php
changeset 78 08f8a72b1f7b
parent 71 8663af0e27c7
--- a/uiconfig.php	Fri Jun 12 13:49:22 2009 -0400
+++ b/uiconfig.php	Fri Jun 12 13:50:13 2009 -0400
@@ -90,6 +90,7 @@
       {
         $auth_data = array();
         $auth_changed = true;
+        $use_auth = false;
       } 
     }
     if ( isset($_POST['users_add']) )
@@ -188,6 +189,36 @@
     }
   }
   
+  $message = false;
+  
+  // Rebuild options
+  $pathinfo = @substr(@substr($_SERVER['REQUEST_URI'], 1), @strpos(@substr($_SERVER['REQUEST_URI'], 1), '/')+1);
+  switch($pathinfo)
+  {
+    case 'rebuild/artwork':
+      global $amarok_home;
+      $artwork_dir = "$amarok_home/albumcovers";
+      
+      if ( $dp = opendir($artwork_dir) )
+      {
+        while ( $dh = @readdir($dp) )
+        {
+          if ( preg_match('/^collage_[0-9]+\.(?:map|png)$/', $dh) )
+          {
+            unlink("$artwork_dir/$dh");
+          }
+        }
+        closedir($dp);
+      }
+      
+      $message = 'Successfully cleared album art cache';
+      break;
+    case 'rebuild/playlist':
+      rebuild_playlist(true);
+      $message = 'Successfully rebuilt playlist cache';
+      break;
+  }
+  
   global $theme;
   $iphone = ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
        strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
@@ -196,12 +227,13 @@
        && !isset($_GET['f'])
        );
   $theme_id = ( $iphone ) ? 'iphone' : $theme;
+  
   $smarty = load_theme($theme_id);
-  
   $smarty->assign('theme', $theme_id);
   $smarty->assign('greyhound_version', GREY_VERSION);
   $smarty->assign('tried', $tried);
   $smarty->assign('success', $success);
+  $smarty->assign('message', $message);
   $smarty->assign('needpass', $needpass);
   $smarty->assign('use_auth', $use_auth);
   $smarty->assign('public', $GLOBALS['public']);