$checkDirs = array('work/', 'work/config/', 'work/log/', 'work/backup/'); $isWritable = array(); if (1 == $config['safe_mode']) { $tpl->assign_block_vars('SAFE_MODE_ON', array()); } $i = 0; foreach ($checkDirs as $dir) { clearstatcache(); if (!is_dir($dir)) { @mkdir($dir); } clearstatcache(); $check = file_exists($dir); $isWritable[$i] = File::isWritable($dir, 0777); $tpl->assign_vars(array('LANGUAGE' => $config['language'], 'ICON_OK' => $icon['ok'])); $tpl->assign_block_vars('DIR', array('NAME' => $config['paths']['root'] . $dir, 'CHMOD' => File::getChmod($dir), 'ICON_EXISTS' => $check === true ? $icon['ok'] : $icon['not_ok'] . ' ' . $check, 'ICON_IS_WRITABLE' => $isWritable[$i] ? $icon['ok'] : $icon['not_ok'])); $i++; } if (in_array(false, $isWritable)) { $tpl->pparse('show'); // something is wrong with the dirs -> show info } else { $phase = 2; // everything ok -> continue with db-param-input } } // Step 3: database parameters if ($phase == 2) { $tpl = new MSDTemplate(); $tpl->set_filenames(array('show' => 'tpl/install/db_parameter.tpl')); // default values