diff --git a/index.php b/index.php index 918b5455..bf7de87d 100644 --- a/index.php +++ b/index.php @@ -4,36 +4,36 @@ // FIRST: read in the configuration $config = fopen(CONFIG, 'r'); $data = fread($config, filesize(CONFIG)); -$data = json_decode($data); +$data = json_decode($data, true); if (!$data) die('JSON syntax error in "'.CONFIG.'"'); -if ($data->rotate === 'left') { +if ($data['rotate'] === 'left') { $rotate = '-webkit-transform: rotate(-90deg);'; } -elseif ($data->rotate === 'right') { +elseif ($data['rotate'] === 'right') { $rotate = '-webkit-transform: rotate(90deg);'; -} elseif ($data->rotate === 'flip') { +} elseif ($data['rotate'] === 'flip') { $rotate = '-webkit-transform: rotate(180deg);'; } else { $rotate = FALSE; } -$width = (isset($data->width) ? $data->width . 'px' : '100%'); +$width = (isset($data['width']) ? $data['width'] . 'px' : '100%'); function render($module) { $argstr = array(); - $args = $module->args; - $args->width = $module->width; + $args = isset($module['args']) ? $module['args'] : array(); + $args['width'] = $module['width']; foreach($args as $key => $val) { $argstr[] = "$key=" . urlencode($val); } $argstr = "'" . implode("&", $argstr) . "'"; - $style = "width: {$module->width}px;"; - if ($module->height) $style .= " height: {$module->height}px"; - echo "
\n"; - echo "\t\n\n"; + $style = "width: {$module['width']}px;"; + if (isset($module['height'])) $style .= " height: {$module['height']}px"; + echo "
\n"; + echo "\t\n\n"; } ?> @@ -42,7 +42,7 @@ function render($module) { - <?php echo (isset($data->title) ? $data->title : 'statuspanic generic status board') ?> + <?php echo (isset($data['title']) ? $data['title'] : 'statuspanic generic status board') ?> @@ -60,9 +60,9 @@ function render($module) {
modules as $module) + foreach($data['modules'] as $module) render($module); ?>
- \ No newline at end of file +