~ubuntu-branches/ubuntu/hardy/gallery2/hardy-security

« back to all changes in this revision

Viewing changes to lib/tools/phpunit/CodeAuditTestCase.class

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2006-04-16 16:42:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060416164235-8uy0u4bfjdxpge2o
Tags: 2.1.1-1
* New upstream release (Closes: #362936)
  + Bugfixes for Postgres7 (Closes: #359000, #362152)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * $RCSfile: CodeAuditTestCase.class,v $
4
4
 *
5
5
 * Gallery - a web based photo album viewer and editor
6
 
 * Copyright (C) 2000-2005 Bharat Mediratta
 
6
 * Copyright (C) 2000-2006 Bharat Mediratta
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
9
9
 * it under the terms of the GNU General Public License as published by
20
20
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
21
21
 */
22
22
/**
23
 
 * @version $Revision: 1.6 $ $Date: 2005/08/23 03:48:56 $
 
23
 * @version $Revision: 1.8 $ $Date: 2006/01/10 04:38:41 $
24
24
 * @package GalleryCore
25
25
 * @subpackage PHPUnit
26
26
 * @author Bharat Mediratta <bharat@menalto.com>
46
46
        global $gallery;
47
47
 
48
48
        /* If the base gallery dir has a CVS dir, then we're all set */
49
 
        $platform = $gallery->getPlatform();
 
49
        $platform =& $gallery->getPlatform();
50
50
        if ($platform->file_exists($this->_baseDir . '/CVS/Entries')) {
51
51
            $this->_scanDir($this->_baseDir);
52
52
        }
64
64
        }
65
65
 
66
66
        global $gallery;
67
 
        $platform = $gallery->getPlatform();
68
 
 
69
 
        if ($dirPath == $this->_baseDir . '/lib') {
70
 
            return;
71
 
        }
 
67
        $platform =& $gallery->getPlatform();
72
68
 
73
69
        if (!file_exists($dirPath) || !is_dir($dirPath)) {
74
70
            /*
75
 
             * It appears that CVS doesn't tend its entries file very well so we get entries that
 
71
             * It appears that CVS doesn't tend its Entries file very well so we get entries that
76
72
             * no longer exist in the local workspace.  That's ok -- just ignore them.
77
73
             */
78
74
            return;
96
92
                    }
97
93
                } else {
98
94
                    if (preg_match('|^/(.*?)/(-?)|', $line, $matches)) {
99
 
                        // deleted files have a negative version number
 
95
                        /* deleted files have a negative version number */
100
96
                        if ($matches[2] != '-') {
101
97
                            $fileName = $matches[1];
102
98
                            if (preg_match('/\.(class|inc|php|tpl|po)$/', $fileName)) {
121
117
 
122
118
        if ($this->shouldCheckFile($fileName)) {
123
119
            $gallery->guaranteeTimeLimit(30);
124
 
            $platform = $gallery->getPlatform();
 
120
            $platform =& $gallery->getPlatform();
125
121
            $fd = $platform->fopen($fileName, 'r');
126
122
            $buf = $platform->fread($fd, $platform->filesize($fileName));
127
123
            $this->checkFile($fileName, $buf);
159
155
     * @access protected
160
156
     */
161
157
    function shouldCheckFile($fileName) {
162
 
        /* By default all files are checked */
 
158
        /*
 
159
         * By default we accept everything, with the exception that we only take
 
160
         * lib/tools/repository from the lib directory.
 
161
         */
 
162
        if (strpos($fileName, $this->_baseDir . '/lib/') === 0) {
 
163
            return strpos($fileName, $this->_baseDir . '/lib/tools/repository/') === 0;
 
164
        }
 
165
 
163
166
        return true;
164
167
    }
165
168
}