Exemple #1
0
function lfDispStep0($objPage)
{
    global $objWebParam;
    global $objDBParam;
    // hiddenに入力値を保持
    $objPage->arrHidden = $objWebParam->getHashArray();
    // hiddenに入力値を保持
    $objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
    $objPage->arrHidden['db_skip'] = $_POST['db_skip'];
    $objPage->arrHidden['agreement'] = $_POST['agreement'];
    $objPage->tpl_mainpage = 'step0.tpl';
    $objPage->tpl_mode = 'step0';
    // プログラムで書込みされるファイル・ディレクトリ
    $arrWriteFile = array(".." . HTML2DATA_DIR . "install.php", "../user_data", "../cp", "../upload", ".." . HTML2DATA_DIR . "cache/", ".." . HTML2DATA_DIR . "class/", ".." . HTML2DATA_DIR . "Smarty/", ".." . HTML2DATA_DIR . "logs/", ".." . HTML2DATA_DIR . "downloads/", ".." . HTML2DATA_DIR . "upload/");
    $mess = "";
    $err_file = false;
    foreach ($arrWriteFile as $val) {
        // listdirsの保持データを初期化
        initdirs();
        if (is_dir($val)) {
            $arrDirs = listdirs($val);
        } else {
            $arrDirs = array($val);
        }
        foreach ($arrDirs as $path) {
            if (file_exists($path)) {
                $mode = lfGetFileMode($path);
                $real_path = realpath($path);
                // ディレクトリの場合
                if (is_dir($path)) {
                    if (!is_writable($path)) {
                        $mess .= ">> ×:{$real_path}({$mode}) <br>ユーザ書込み権限(777, 707等)を付与して下さい。<br>";
                        $err_file = true;
                    } else {
                        GC_Utils_Ex::gfPrintLog("WRITABLE:" . $path, INSTALL_LOG);
                    }
                } else {
                    if (!is_writable($path)) {
                        $mess .= ">> ×:{$real_path}({$mode}) <br>ユーザ書込み権限(666, 606等)を付与して下さい。<br>";
                        $err_file = true;
                    } else {
                        GC_Utils_Ex::gfPrintLog("WRITABLE:" . $path, INSTALL_LOG);
                    }
                }
            } else {
                $mess .= ">> ×:{$path} が見つかりません。<br>";
                $err_file = true;
            }
        }
    }
    // 権限エラー等が発生していない場合
    if (!$err_file) {
        umask(0);
        $path = "../upload/temp_template";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = "../upload/save_image";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = "../upload/temp_image";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = "../upload/graph_image";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = "../upload/mobile_image";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = "../upload/csv";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = ".." . HTML2DATA_DIR . "downloads/module";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = ".." . HTML2DATA_DIR . "downloads/update";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = ".." . HTML2DATA_DIR . "upload/csv";
        if (!file_exists($path)) {
            mkdir($path);
        }
        $mess .= ">> ○:アクセス権限は正常です。<br>";
    }
    $objPage->mess = $mess;
    $objPage->err_file = $err_file;
    return $objPage;
}
function lfDispStep0($objPage)
{
    global $objWebParam;
    global $objDBParam;
    // hiddenに入力値を保持
    $objPage->arrHidden = $objWebParam->getHashArray();
    // hiddenに入力値を保持
    $objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray());
    $objPage->arrHidden['db_skip'] = $_POST['db_skip'];
    $objPage->arrHidden['agreement'] = $_POST['agreement'];
    $objPage->tpl_mainpage = 'step0.tpl';
    // プログラムで書込みされるファイル・ディレクトリ
    $arrWriteFile = array(USER_REALDIR, HTML_REALDIR . 'upload/', DATA_REALDIR . 'cache/', DATA_REALDIR . 'class/', DATA_REALDIR . 'Smarty/', DATA_REALDIR . 'logs/', DATA_REALDIR . 'downloads/', DATA_REALDIR . 'upload/', HTML_REALDIR, DATA_REALDIR . 'config/');
    $mess = '';
    $hasErr = false;
    foreach ($arrWriteFile as $val) {
        // listdirsの保持データを初期化
        initdirs();
        if (is_dir($val) and $val != HTML_REALDIR) {
            $arrDirs = listdirs($val);
        } else {
            $arrDirs = array($val);
        }
        foreach ($arrDirs as $path) {
            if (file_exists($path)) {
                $filemode = lfGetFileMode($path);
                $real_path = realpath($path);
                // ディレクトリの場合
                if (is_dir($path)) {
                    if (!is_writable($path)) {
                        $mess .= ">> ×:{$real_path}({$filemode}) \nユーザ書込み権限(777, 707等)を付与して下さい。\n";
                        $hasErr = true;
                    } else {
                        GC_Utils_Ex::gfPrintLog('WRITABLE:' . $path, INSTALL_LOG);
                    }
                } else {
                    if (!is_writable($path)) {
                        $mess .= ">> ×:{$real_path}({$filemode}) \nユーザ書込み権限(666, 606等)を付与して下さい。\n";
                        $hasErr = true;
                    } else {
                        GC_Utils_Ex::gfPrintLog('WRITABLE:' . $path, INSTALL_LOG);
                    }
                }
            } else {
                $mess .= ">> ×:{$path} が見つかりません。\n";
                $hasErr = true;
            }
        }
    }
    if (ini_get('safe_mode')) {
        $mess .= ">> ×:PHPのセーフモードが有効になっています。\n";
        $hasErr = true;
    }
    if (get_magic_quotes_gpc()) {
        $mess .= ">> ×:PHPの設定ディレクティブ「magic_quotes_gpc」が有効になっています。\n";
        $hasErr = true;
    }
    // 問題点を検出している場合
    if ($hasErr) {
        $objPage->tpl_mode = 'return_step0';
    } else {
        $objPage->tpl_mode = 'step0';
        umask(0);
        $path = HTML_REALDIR . 'upload/temp_template';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = HTML_REALDIR . 'upload/save_image';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = HTML_REALDIR . 'upload/temp_image';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = HTML_REALDIR . 'upload/graph_image';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = HTML_REALDIR . 'upload/mobile_image';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = DATA_REALDIR . 'downloads/module';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = DATA_REALDIR . 'downloads/update';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $path = DATA_REALDIR . 'upload/csv';
        if (!file_exists($path)) {
            mkdir($path);
        }
        $mess .= '>> ○:アクセス権限は正常です。';
    }
    $objPage->mess = $mess;
    $objPage->hasErr = $hasErr;
    return $objPage;
}