コード例 #1
0
 public function config_path()
 {
     global $LANG;
     if (empty($_SESSION['val']['path_protected'])) {
         $_SESSION['val']['path_protected'] = PH7_ROOT_PUBLIC . '_protected' . PH7_DS;
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['path_protected'])) {
         $_SESSION['val']['path_protected'] = check_ext_start(check_ext_end(trim($_POST['path_protected'])));
         if (is_dir($_SESSION['val']['path_protected'])) {
             if (is_readable($_SESSION['val']['path_protected'])) {
                 $sConstantContent = file_get_contents(PH7_ROOT_INSTALL . 'data/configs/constants.php');
                 $sConstantContent = str_replace('%path_protected%', addslashes($_SESSION['val']['path_protected']), $sConstantContent);
                 if (!@file_put_contents(PH7_ROOT_PUBLIC . '_constants.php', $sConstantContent)) {
                     $aErrors[] = $LANG['no_public_writable'];
                 } else {
                     $_SESSION['step2'] = 1;
                     unset($_SESSION['val']);
                     redirect(PH7_URL_SLUG_INSTALL . 'config_system');
                 }
             } else {
                 $aErrors[] = $LANG['no_protected_readable'];
             }
         } else {
             $aErrors[] = $LANG['no_protected_exist'];
         }
     }
     $this->oView->assign('sept_number', 2);
     $this->oView->assign('errors', @$aErrors);
     unset($aErrors);
     $this->oView->display('config_path.tpl');
 }
コード例 #2
0
ファイル: misc.php プロジェクト: nsrau/pH7-Social-Dating-CMS
/**
 * Check valid directory.
 *
 * @param string $sDir
 * @return boolean
 */
function is_directory($sDir)
{
    $sPathProtected = check_ext_start(check_ext_end(trim($sDir)));
    if (is_dir($sPathProtected)) {
        if (is_readable($sPathProtected)) {
            return true;
        }
    }
    return false;
}