Automatically redirect to logout page if session seems to be expired
[infodrom/hallinta] / theme.php
index ba9f86f..7a6be93 100644 (file)
--- a/theme.php
+++ b/theme.php
@@ -4,15 +4,15 @@ require_once('lib/general.php');
 
 $theme = $_SESSION['sys']['theme'];
 
-$sql = sprintf("SELECT sys_theme_keys.name,value FROM sys_theme_values " .
-              "JOIN sys_theme_keys ON key = sys_theme_keys.id WHERE theme = %d",
+$sql = sprintf("SELECT sys_theme_items.name,value FROM sys_theme_values " .
+              "JOIN sys_theme_items ON item = sys_theme_items.id WHERE theme = %d",
               $theme);
-$sth = pg_query($sql);
+$sth = $db->query($sql);
 
 if ($sth === false) exit;
 
 $styles = array();
-while ($row = pg_fetch_assoc($sth)) {
+while ($row = $sth->fetch()) {
   switch ($row['name']) {
   case 'box-background':
     $styles['div.ricoContent']['background-color'] = $row['value'];
@@ -52,6 +52,11 @@ while ($row = pg_fetch_assoc($sth)) {
   case 'details-background':
     $styles['div.box#details']['background-color'] = $row['value'];
     break;
+  case 'form-elem-background':
+    $styles['#form_edit input:focus']['background-color'] = $row['value'];
+    $styles['#form_edit select:focus']['background-color'] = $row['value'];
+    $styles['#form_edit textarea:focus']['background-color'] = $row['value'];
+    break;
   }
 }