コード例 #1
0
ファイル: security.php プロジェクト: Almazys/SPF
function localSecurityChecks($folder)
{
    global $successful_Check;
    foreach (glob($folder . "*") as $element) {
        $res = checkPermission($element);
        $successful_Check = $res ? $successful_Check : false;
        if (is_dir($element)) {
            localSecurityChecks($element . "/");
        }
    }
}
コード例 #2
0
ファイル: init.php プロジェクト: Almazys/SPF
 */
if (isset($GLOBALS['config']['DEBUG']['enabled']) && $GLOBALS['config']['DEBUG']['enabled'] == true) {
    Debug::build();
}
/**
 * Security checks
 * Keep in mind it just does a BASIC check on world-permission on files/folders under DOCUMENT_ROOT ; and a quick check on php.ini
 */
if ($GLOBALS['config']['security']['skipLocalChecks'] === false) {
    //Setup
    CoreController::startCapturing();
    $successful_Check = true;
    /**
     * php.ini config
     */
    echo "<u>Checking php.ini file ...</u><br />";
    php_iniChecks();
    echo "******************<br />";
    /**
     * File rights
     */
    echo "<u>Checking file permissions ...</u><br />";
    localSecurityChecks(ROOT_DIR);
    // Can be found in FUNCTIONS_DIR . security.php
    //Cleaning
    $output = CoreController::stopCapturing();
    if ($GLOBALS["successful_Check"] === false) {
        Site::error(Site::app_error, "Some misconfiguration were detected. <br />Please fix them in order to run this framework safely", $output);
    }
    unset($successful_Check, $checks);
}