static function purgeZcache() { p::updateAppId(); $a = $CONFIG['i18n.lang_list'][$_SERVER['PATCHWORK_LANG']]; $a = implode($a, explode('__', $_SERVER['PATCHWORK_BASE'], 2)); $a = preg_replace("'\\?.*\$'", '', $a); $a = preg_replace("'^https?://[^/]*'i", '', $a); $a = dirname($a . ' '); if (1 === strlen($a)) { $a = ''; } setcookie('v$', p::$appId, $_SERVER['REQUEST_TIME'] + $CONFIG['maxage'], $a . '/'); p::touch(''); for ($i = 0; $i < 16; ++$i) { for ($j = 0; $j < 16; ++$j) { $dir = PATCHWORK_ZCACHE . dechex($i) . '/' . dechex($j) . '/'; if (file_exists($dir)) { $h = opendir($dir); while (false !== ($file = readdir($h))) { '.' !== $file && '..' !== $file && unlink($dir . $file); } closedir($h); } } } }
static function scriptAlert() { p::setMaxage(0); if (p::$catchMeta) { p::$metaInfo[1] = array('private'); } if ('-' === strtr(self::$requestMode, '-tpax', '#----')) { $a = ''; $cache = p::getContextualCachePath('agentArgs/' . p::$agentClass, 'txt'); if (file_exists($cache)) { $h = fopen($cache, 'r+b'); if (!($a = fread($h, 1))) { rewind($h); fwrite($h, $a = '1'); p::touch('public/templates/js'); p::updateAppId(); } fclose($h); } throw new e\PrivateResource($a); } user_error('Potential JavaScript-Hijacking. Stopping !'); p::disable(true); }
static function syncCache($file, $depth) { if (0 === strpos($file, 'public/')) { p::touch('public'); p::updateAppId(); } else { if (0 === strpos($file, 'class/Patchwork/')) { self::resetCache(); } else { if (0 === strpos($file, 'class/')) { $file = p\Superloader::file2cache(substr($file, 6), $depth); @unlink($file); } } p\Debugger::purgeZcache(); } }