function check_file($node) { global $context; global $footprints; $key = substr($node, strlen($context['path_to_root'])); // no extension to check if (strpos($key, '.') === FALSE) { } elseif (!strncmp($node, 'scripts/staging', 16)) { } elseif (!strcmp($key, 'footprints.php')) { } elseif (!strncmp(substr($key, -9), 'index.php', 9) && ($content = Safe::file_get_contents($node)) && !strcmp($content, Safe::mkdir_index_content())) { } elseif (!strncmp($key, 'temporary/cache_i18n_locale_', 28)) { } elseif (!strncmp(substr($key, -4), '.php', 4)) { // one of the parameter files created by yacs if (preg_match('/parameters\\/(agents|control|feeds|files|hooks|letters|root|scripts|services|skins|users|virtual_.+)\\.include\\.php$/i', $key)) { } elseif (isset($footprints[$key])) { $expected = $footprints[$key]; $actual = Scripts::hash($node); if ($expected[0] != $actual[0] || $expected[1] != $actual[1]) { $context['text'] .= sprintf(i18n::s('ERROR: File %s is missing or corrupted.'), $key) . BR . "\n"; } } else { $context['text'] .= sprintf(i18n::s('File %s is not part of Yacs.'), $key) . BR . "\n"; } // not a safe file } elseif (!preg_match('/\\.(bak|bat|css|done|dtd|fdb|flv|gif|ico|jpeg|jpg|js|jsmin|htc|htm|html|mo|off|on|pdf|png|po|pot|reg|sh|sql|swf|tgz|txt|xml|zip)$/i', $key)) { $context['text'] .= sprintf(i18n::s('File %s is not part of Yacs.'), $key) . BR . "\n"; } }
/** * create a directory * * @param string path name * @param int mode * @return TRUE on success, FALSE on failure */ public static function mkdir($path_name, $mode = 0) { global $context; // use default mask if (!$mode) { $mode = $context['directory_mask']; } // maybe path already exists if (is_dir($path_name)) { return TRUE; } // if a file has the same name if (file_exists($path_name)) { return FALSE; } // ensure call is allowed if (is_callable('mkdir') && mkdir($path_name, $mode)) { // create an index file to avoid browsing --direct call of file_put_contents because of absolute path if (is_callable('file_put_contents')) { file_put_contents($path_name . '/index.php', Safe::mkdir_index_content()); } // mkdir has been successful return TRUE; } // tough luck return FALSE; }