* @return void
*/
function index() {
+
+ // file/dir check
+ $error = array();
+ $permissions = array(
+ array(
+ 'path' => APP.'config',
+ 'type' => 'dir',
+ ),
+ array(
+ 'path' => TMP,
+ 'type' => 'dir',
+ ),
+ array(
+ 'path' => WWW_ROOT. 'media',
+ 'type' => 'dir',
+ ),
+ );
+
+ // check file_exists
+ if (!file_exists(APP.'config'.DS.'database.php.install') || !is_readable(APP.'config'.DS.'database.php.install')) {
+ $error['nofile'][] = APP.'config'.DS.'database.php.install';
+ } else {
+ $permissions[] = array(
+ 'path' => APP.'config'.DS.'database.php.install',
+ 'type' => 'file',
+ );
+ }
+
+ // check permission
+ foreach ($permissions as $k => $v) {
+ $allowed = array();
+ if ($v['type'] == 'dir') {
+ $allowed = array('0777', '0707');
+ } elseif ($v['type'] == 'file') {
+ $allowed = array('0777', '0707', '0666', '0606');
+ }
+
+ if (!in_array(substr(sprintf('%o', fileperms($v['path'])), -4), $allowed)) {
+ $error['permission'][] = $v['path'];
+ }
+ }
+ $this->set('error', $error);
+
$this->pageTitle = __('Installation: Welcome', true);
}
/**
<div class="install index">
<h2><?php echo $this->pageTitle; ?></h2>
+<?php if (!empty($error)): ?>
+
+<?php echo $html->div('message', 'ERROR') ?>
+<?php if (isset($error['nofile'])): ?>
+<?php __('Set below Files.'); ?>
+<?php
+ foreach($error['nofile'] as $v) {
+ echo $html->div('error-message', $v);
+ }
+ ?>
+ <?php endif; ?>
+<?php if(isset($error['permission'])): ?>
+<?php __('Check Permission of them.'); ?>
+<?php
+ foreach($error['permission'] as $v) {
+ echo $html->div('error-message', $v);
+ }
+ ?>
+<br>
+<br>
+<?php echo $html->link(__('Reload', true), Router::url('/', true)); ?>
+<?php endif; ?>
+<?php else: ?>
<p><?php echo $html->link('Click here to begin installation', array('action' => 'database')); ?></p>
+<?php endif; ?>
</div>