예제 #1
0
파일: check.php 프로젝트: rair/yacs
        } 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";
        }
    }
    // ensure enough execution time
    //		Safe::set_time_limit(30);
    // list of updated scripts
    $context['text'] .= '<p>' . i18n::s('Checking scripts...') . BR . "\n";
    Scripts::walk_files_at($context['path_to_root'], 'check_file');
} else {
    // splash message
    $context['text'] .= '<p>' . i18n::s('Click on the button below to check running scripts on your server.') . "</p>\n";
    // propose to update the server
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . Skin::build_submit_button(i18n::s('Yes, I want to check scripts on this server')) . '<input type="hidden" name="action" value="confirmed" />' . '</p></form>' . "\n";
}
// render the skin
render_skin();
예제 #2
0
파일: scripts.php 프로젝트: rair/yacs
 /**
  * walk all files below a certain path
  *
  * @param string the absolute path to scan
  * @param function the function to call back with the file found
  *
  * @see scripts/check.php
  */
 public static function walk_files_at($path, $call_back = NULL)
 {
     global $context, $script_count;
     // sanity check
     $path = rtrim($path, '/');
     // list all files at this level
     $directories = array();
     if ($handle = Safe::opendir($path)) {
         // list all nodes
         while (($node = Safe::readdir($handle)) !== FALSE) {
             // special directory names
             if ($node == '.' || $node == '..') {
                 continue;
             }
             // process special nodes
             if ($node[0] == '.') {
                 continue;
             }
             // make a real name
             $target = $path . '/' . $node;
             // scan a sub directory
             if (is_dir($target)) {
                 $directories[] = $target;
             } elseif (is_readable($target)) {
                 $call_back($target);
             }
         }
         Safe::closedir($handle);
     }
     // walk sub-directories as well
     foreach ($directories as $directory) {
         Scripts::walk_files_at($directory, $call_back);
     }
 }