コード例 #1
0
ファイル: schools_manipulate.php プロジェクト: NemOry/Skoolyf
        $log = new Log($session->user_id, $clientip, "WEB", "UPDATED SCHOOL: " . $_POST['id']);
        $log->create();
    } else {
        if ($_POST['oper'] == 'del') {
            $log = new Log($session->user_id, $clientip, "WEB", "DELETED SCHOOL: " . $_POST['id']);
            $log->create();
            $school = School::get_by_id($_POST['id']);
            $folder_path = "../../public/schools/" . $school->id;
            if (file_exists($folder_path) && $folder_path != "../../public/schools/") {
                rrmdir($folder_path);
            }
            //===================SECTION=============================//
            SectionUser::delete_all_by_schoolid($school->id);
            Section::delete_all_by_schoolid($school->id);
            //===================BATCH=============================//
            BatchUser::delete_all_by_schoolid($school->id);
            Batch::delete_all_by_schoolid($school->id);
            //===================SCHOOL=============================//
            SchoolUser::delete_all_by_schoolid($school->id);
            $school->delete();
        }
    }
}
function rrmdir($dir)
{
    foreach (glob($dir . '/*') as $file) {
        if (is_dir($file)) {
            rrmdir($file);
        } else {
            unlink($file);
        }