function restoreVersion($app, $tmpl_file, $version_id) { db::table('templates_versions'); db::where('version_id', $version_id); $row = db::assoc(); $rows = db::rows(); $code = stripslashes($row['version_code']); $file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file; header("Content-Type: text/plain; charset=UTF-8"); files::write($file, $code); if ($rows != 0) { self::deleteVersion($version_id); } router::delQs('restore'); headers::selfQs(); }