WordPress.org

Plugin Directory

Changeset 410848


Ignore:
Timestamp:
07/16/11 22:25:15 (3 years ago)
Author:
pross
Message:

Lots...
Better fopen detection.
New listdir function, catches hidden folders.
Updated timthumb versions.

Location:
theme-check/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • theme-check/trunk/checkbase.php

    r371810 r410848  
    148148} 
    149149 
    150 function listdir( $start_dir='.' ) { 
     150function listdir( $dir ) { 
     151    $files = array(); 
     152    $dir_iterator = new RecursiveDirectoryIterator( $dir ); 
     153    $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); 
     154     
     155    foreach ($iterator as $file) { 
     156        array_push( $files, $file->getPathname() ); 
     157    } 
     158    return $files; 
     159} 
     160 
     161function old_listdir( $start_dir='.' ) { 
    151162    $files = array(); 
    152163    if ( is_dir( $start_dir ) ) { 
  • theme-check/trunk/checks/directories.php

    r336084 r410848  
    2323            if ( strpos( $name, '.git' ) !== false || strpos( $name, '.svn' ) !== false ) $found = true; 
    2424        } 
    25  
     25         
    2626        if ($found) { 
    2727            $this->error[] = "<span class='tc-lead tc-required'>REQUIRED</span>: " . __( 'Please remove any extraneous directories like .git or .svn from the ZIP file before uploading it.', 'themecheck' ); 
  • theme-check/trunk/checks/filenames.php

    r386527 r410848  
    2424                'project.xml' => __( 'NetBeans Project File', 'themecheck' ), 
    2525                '\.kpf' => __( 'Komodo Project File', 'themecheck' ), 
    26                 '^\..*' => __( 'Hidden File', 'themecheck' ), 
     26                '^\.+[a-zA-Z0-9]' => __( 'Hidden Files or Folders', 'themecheck' ), 
    2727                'php.ini' => __( 'PHP server settings file', 'themecheck' ), 
    2828                'dwsync.xml' => __( 'Dreamweaver project file', 'themecheck' ), 
  • theme-check/trunk/checks/malware.php

    r371327 r410848  
    77 
    88        $checks = array( 
    9             '/[^a-z0-9](?<!_)(file_get_contents|curl_exec|curl_init|readfile|fopen|fsockopen|pfsockopen|fclose|fread|fwrite|file_put_contents)\(/' => __( 'possible file operations', 'themecheck' ), 
     9            '/[^a-z0-9](?<!_)(file_get_contents|curl_exec|curl_init|readfile|fopen|fsockopen|pfsockopen|fclose|fread|fwrite|file_put_contents)\s?\(/' => __( 'possible file operations', 'themecheck' ), 
    1010            ); 
    1111 
     
    1313            foreach ( $checks as $key => $check ) { 
    1414                checkcount(); 
    15                 if ( preg_match( $key, $phpfile, $matches ) ) { 
     15 
     16                if ( preg_match_all( $key, $phpfile, $matches ) ) { 
    1617                    $filename = tc_filename( $php_key ); 
    17                     $error = ltrim( $matches[1], '(' ); 
    18                     $error = rtrim( $error, '(' ); 
    19                     $grep = tc_grep( $error, $php_key ); 
    20                     $this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: <strong>{$error}</strong> was found in the file <strong>{$filename}</strong> {$check}.{$grep}"; 
    21                     $ret = false; 
    22                 } 
     18 
     19                        foreach ($matches[1] as $match ) { 
     20                            $error = ltrim( $match, '(' ); 
     21                            $error = rtrim( $error, '(' ); 
     22                            $grep = tc_grep( $error, $php_key ); 
     23                            $this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: <strong>{$error}</strong> was found in the file <strong>{$filename}</strong> {$check}.{$grep}"; 
     24                            $ret = false; 
     25                        } 
     26                }  
    2327            } 
    2428        } 
  • theme-check/trunk/checks/timthumb.php

    r390421 r410848  
    55    function check( $php_files, $css_files, $other_files ) { 
    66        $ret = true; 
    7  
     7         
     8        $latest = '1.30'; // set to latest timthumb http://code.google.com/p/timthumb/source/browse/trunk/timthumb.php  
     9         
    810        foreach ( $php_files as $name => $content ) { 
    911        checkcount(); 
    10             if ( strpos( $content, 'cleanSource($src);' ) !== false ) { 
     12            if ( strpos( $content, 'TimThumb version' ) !== false ) { 
    1113            preg_match( "/define\s\('VERSION',\s'([0-9]\.[0-9]+)'\)/", $content, $matches ); 
    1214            $version = $matches[1]; 
    1315            $filename = tc_filename( $name ); 
    1416 
    15             if ( $version < 1.28 ) { //set to latest timthumb http://code.google.com/p/timthumb/source/browse/trunk/timthumb.php 
    16                 $this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: TimThumb detected in file <strong>{$filename}</strong>. Version <strong>{$version}</strong> is out of date!"; 
     17            if ( $version < $latest ) {  
     18                $this->error[] = "<span class='tc-lead tc-warning'>WARNING</span>: TimThumb detected in file <strong>{$filename}</strong>. Version <strong>{$version}</strong> is out of date! Latest version of TimThumb is <strong>{$latest}</strong>"; 
    1719                $ret = false; 
    1820            } else { 
Note: See TracChangeset for help on using the changeset viewer.