websiteWebsite
codingteam CodingTeam
A free forge, lightweight and extensible.

 

Browse the code

Differences between 158 and 159 on /.
Number of edited files: 48 (4 added, 0 deleted and 44 modified)
Author: xbright
Log message: * Added DrawSVGChart and 3 charts for each projects
* Added a print.css
* Deleted like() in inc/classes/db.php, select() is now better
* Added documentation for inc/classes/session.php
* Added user management (change level) in administration
* Added a maximum file number in the cache
* Added full-support for OpenForge 0.1 (projects and users information retrieval)
* Added external search (based on OpenForge 0.1) (and internal search now working)
* Ignore some errors (ugly work-around!)
* Deleted a lot of license in the default list
* Popularity contest is now resetted each months
* Added projects.commit to handle all commits
* Edited post-commit.php (now using sql to store *all* commits)
* Now showing commits in the timeline and provide a RSS/ATOM feed
* Removed translation from project module
* Started to replace links with buttons to delete content on the forge (security reason)
* Fixed a bizarre bug in inc/modules/project/views/bug.php related to bugs sorting (and the fix is bizarre too)
* Fixed a bug in the news feed of a project
* Worked on the SVN browser (diffs, feed, new *FASTER* way to send commands...)
* Typo in account registering
* Removed sended mail with the password after registration (security reason)
* The i18n function now allow errors and can handle a decimal as a string if the given value is not decimal
* Edited the SQL schema
* Added openforge, cache-max-files, and need-validate modifications to the INSTALL
* Maybe one or two forgoten bug fixes
* Yes, I know, this is a really (too) *big* commit message
Date: 2008-09-05 12:30:11

Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
12 12

                                        
13 13
RewriteCond %{REQUEST_URI} !^/public/(.*)?$
14 14
RewriteCond %{REQUEST_URI} !^/inc/templates/([a-z-]+)\.css?$
  15
RewriteCond %{REQUEST_URI} !^/robots.txt?$
15 16
RewriteRule ^(.*)$ index.php [QSA,L]
16 17

                                        
17 18
php_flag magic_quotes_gpc Off
18 19

                                        

 

Old New Code
93 93

                                        
94 94
  INSERT INTO `config` (`group`, `field`, `value`, `text`) VALUES
95 95
  ('global', 'mailfrom', 'MyForgeName <mail@domain.net>', 'The FROM and REPLYTO headers of sended mail.'),
  96
  ('global', 'cache-max-files', '2000', 'The maximum files number for the cache.'),
96 97

                                        
97 98
  ('fenrir', 'xmlrpc-host', 'localhost', 'The host to contact the bot.'),
98 99
  ('fenrir', 'xmlrpc-port', '8000', 'The port to contact the bot.'),
106 107
  ('jabber', 'password', 'password', 'The password of the bot.'),
107 108
  ('jabber', 'nickname', 'nickname', 'The nickname of the bot.'),
108 109

                                        
109  
  ('projects', 'needvalidate', 'true', 'true or false if you want to validate all new projects.'),
  110
  ('openforge', 'esearch-active', 'true', 'true or false if you want to active external search.'),
  111
  ('openforge', 'esearch-servers', '', 'A list of external servers, separated by a ";".'),
  112

                                    
  113
  ('projects', 'need-validate', 'true', 'true or false if you want to validate all new projects.'),
110 114
  ('projects', 'allow-adding', 'true', 'true or false if you want to disable projects adding.'),
111 115
  ('projects', 'allow-donation', 'true', 'true or false if you want to disable projects donation.'),
112 116

                                        
113 117

                                        

 

Old New Code
9 9
 * http://codingteam.codingteam.net
10 10

                                        
11 11
SVN Browse:
12  
 * http://svn.codingteam.net/code/codingteam
13  
 * http://www.codingteam.net/project/codingteam/svn
  12
 * http://svn.codingteam.net/svn/codingteam
  13
 * http://www.codingteam.net/project/codingteam/browse
14 14

                                        
15 15
Depends:
16 16
 * apache                           http://www.apache.org (>= 2)
17 17

                                        

 

Old New Code
83 83
  `projectid` int(11) NOT NULL,
84 84
  `userid` int(11) NOT NULL,
85 85
  `role` enum('projectleader','graphicdesigner','developer','translater','packager','contributer') collate utf8_bin NOT NULL,
86  
  UNIQUE KEY `admin` (`projectid`,`userid`,`role`)
  86
  UNIQUE KEY `admin` (`projectid`,`userid`)
87 87
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
88 88

                                        
89 89
--
155 155
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
156 156

                                        
157 157
--
  158
-- projects_commits
  159
--
  160

                                    
  161
CREATE TABLE IF NOT EXISTS `projects_commits` (
  162
  `id` int(11) NOT NULL auto_increment,
  163
  `projectid` int(11) NOT NULL,
  164
  `prev_rev` int(11) NOT NULL,
  165
  `new_rev` int(11) NOT NULL,
  166
  `log` text collate utf8_bin NOT NULL,
  167
  `author` tinytext collate utf8_bin NOT NULL,
  168
  `datetime` datetime NOT NULL,
  169
  PRIMARY KEY  (`id`)
  170
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
  171

                                    
  172
--
158 173
-- projects_doc
159 174
--
160 175

                                        
291 306
  `version` varchar(15) COLLATE utf8_bin NOT NULL,
292 307
  `status` enum('planned','development','testing','alpha','beta','stable','abandonned') COLLATE utf8_bin NOT NULL,
293 308
  PRIMARY KEY (`id`),
294  
  UNIQUE KEY `version` (`projectid`,`version`,`status`)
  309
  UNIQUE KEY `version` (`projectid`,`version`)
295 310
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_bin;
296 311

                                        
297 312
--
378 393
  ADD CONSTRAINT `constr_projects_forum_postid` FOREIGN KEY (postid) REFERENCES projects_forum(id) ON DELETE CASCADE;
379 394

                                        
380 395
ALTER TABLE `projects_jabber`
381  
  ADD CONSTRAINT `constr_projects_projectid9` FOREIGN KEY (projectid) REFERENCES projects(id) ON DELETE CASCADE;
  396
  ADD CONSTRAINT `constr_projects_projectid9` FOREIGN KEY (projectid) REFERENCES projects(id) ON DELETE CASCADE;
  397

                                    
  398
ALTER TABLE `projects_commits`
  399
  ADD CONSTRAINT `constr_projects_projectid10` FOREIGN KEY (projectid) REFERENCES projects(id) ON DELETE CASCADE;
382 400

                                        

 

Old New Code
23 23
 * This file contains the Database class
24 24
 *
25 25
 * Connect to MySQL or PostgreSQL.
26  
 * Functions for insert, update, delete, select and select with LIKE rather than `=`.
  26
 * Functions for insert, update, delete, select.
27 27
 */
28 28

                                        
29 29

                                        
34 34
{
35 35
    private $type, $hostname, $database, $username, $password, $error;
36 36

                                        
37  
    function __construct($type, $hostname, $database, $username, $password, $error)
  37
    function __construct($type, $hostname, $database, $username, $password, $error=FALSE)
38 38
    {
39 39
        $this->error = $error;
40 40

                                        
54 54
                break;
55 55

                                        
56 56
                default:
57  
                    exit('Error: database type not supported, aborting.');
  57
                    exit('Error: database type not supported by CodingTeam, aborting.');
58 58
            }
59 59
        }
60 60
        catch (PDOException $e)
61 61
        {
62  
            $this->error->displayError('The link to the database could not be etablished.<br />'.$e->getMessage(), 2);
  62
            if ($error)
  63
                $this->error->displayError('The link to the database could not be etablished.<br />'.$e->getMessage(), 2);
63 64
        }
64 65
    }
65 66

                                        
71 72
     * @param $table
72 73
     *   The table in the database.
73 74
     * @param $where
74  
     *   An array like 'field' => 'value'.
  75
     *   An array like 'field' => 'value' (can be 'field => array('value', 'LIKE')).
75 76
     * @param $what (optional)
76 77
     *   The list of wished field's value.
77 78
     * @param $optional (optional)
78 79
     *   SQL syntax.
  80
     * @param $operator (optional)
  81
     *   A string for the SQL operator (AND or OR).
79 82
     * @return
80 83
     *   The fetched results.
81 84
     */
82  
    function select($_table, $where, $what='*', $optional='')
  85
    function select($_table, $where, $what='*', $optional='', $operator='AND')
83 86
    {
84 87
        // Trying to select data
85 88
        try
103 106
            if(is_array($where))
104 107
            {
105 108
                $sql1 .= 'WHERE ';
106  
                foreach($where as $key => $value)
107  
                {
108  
                    $sql2[] = '`'.$key.'`= '.$this->dbclass->quote($value);
109  
                    $paramArray[] = $value;
110  
                }
111  
            }
112 109

                                        
113  
            $rs = $this->dbclass->prepare($sql1.(count($paramArray) ? ' '.join(' AND ',$sql2) : '').' '.$optional);
114  

                                    
115  
            if($rs->execute($paramArray))
116  
                return $rs->fetchAll(PDO::FETCH_ASSOC);
117  
            $err = $rs->errorInfo();
118  
            $this->error->displayError('An error occured.<br />'.$err[2], 1);
119  
        }
120  
        catch (PDOException $e)
121  
        {
122  
            $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
123  
        }
124  
    }
125  

                                    
126  

                                    
127  
    /**
128  
     * Like
129  
     *
130  
     * Treatment for a SELECT request with LIKE rather than `=`.
131  
     * @param $table
132  
     *   The table in the database.
133  
     * @param $where
134  
     *   An array like 'field' => 'value'.
135  
     * @param $what (optional)
136  
     *   The list of wished field's value.
137  
     * @param $optional (optional)
138  
     *   SQL syntax.
139  
     * @param $operator (optional)
140  
     *   `AND` or `OR`.
141  
     * @return
142  
     *   The fetched results.
143  
     */
144  
    function like($table, $where, $what='*', $optional='', $operator='AND')
145  
    {
146  
        // Trying to select data
147  
        try
148  
        {
149  
            $sql1 = 'SELECT '.$what.' FROM '.$table.' ';
150  
            $sql2 = array();
151  
            $paramArray = array();
152  
            if(is_array($where))
153  
            {
154  
                $sql1 .= 'WHERE ';
155  
                foreach($where as $key => $value)
  110
                foreach ($where as $key => $value)
156 111
                {
157  
                    $sql2[] = ''.$key.' LIKE "%'.$value.'%"';
158  
                    $paramArray[] = $value;
  112
                    if (!is_array($value))
  113
                    {
  114
                        $sql2[] = '`'.$key.'` = '.$this->dbclass->quote($value);
  115
                        $paramArray[] = $value;
  116
                    }
  117
                    elseif ($value[1] == 'LIKE')
  118
                    {
  119
                        $sql2[] = '`'.$key.'` LIKE '.$this->dbclass->quote('%'.$value[0].'%');
  120
                        $paramArray[] = $value[0];
  121
                    }
159 122
                }
160 123
            }
161 124

                                        
162  
            print_r($sql1.(count($paramArray) ? ' '.join(' '.$operator.' ',$sql2) : '').' '.$optional);
  125
            $sqlline = $sql1.(count($paramArray) ? ' '.join(' '.$operator.' ',$sql2) : '').' '.$optional;
  126
            $rs = $this->dbclass->prepare($sqlline);
163 127

                                        
164  
            $rs = $this->dbclass->prepare($sql1.(count($paramArray) ? ' '.join(' '.$operator.' ',$sql2) : '').' '.$optional);
165 128
            if($rs->execute($paramArray))
166 129
                return $rs->fetchAll(PDO::FETCH_ASSOC);
  130

                                    
167 131
            $err = $rs->errorInfo();
168  
            $this->error->displayError('An error occured.<br />'.$err[2], 1);
  132
            if ($error)
  133
                $this->error->displayError('An error occured.<br />'.$err[2], 1);
169 134
        }
170 135
        catch (PDOException $e)
171 136
        {
172  
            $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
  137
            if ($error)
  138
                $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
173 139
        }
174 140
    }
175 141

                                        
203 169

                                        
204 170
            if($rs->execute(array_values($data)))
205 171
                return $this->dbclass->lastInsertId();
206  
            else {
  172
            else
  173
            {
207 174
                $err = $rs->errorInfo();
208  
                $this->error->displayError('An error occured.<br />'.$err[2], 1);
209  
                return FALSE;
  175

                                    
  176
                if ($error)
  177
                    $this->error->displayError('An error occured.<br />'.$err[2], 1);
210 178
            }
211 179

                                        
212 180
        }
213 181
        catch (PDOException $e)
214 182
        {
215  
            $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
  183
            if ($error)
  184
                $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
216 185
        }
217 186
    }
218 187

                                        
266 235
        }
267 236
        catch (PDOException $e)
268 237
        {
269  
            $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
  238
            if ($error)
  239
                $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
270 240
        }
271 241
    }
272 242

                                        
302 272
                return TRUE;
303 273
            
304 274
            $err = $rs->errorInfo();
305  
            $this->error->displayError('An error occured.<br />'.$err[2], 1);
  275
            if ($error)
  276
                $this->error->displayError('An error occured.<br />'.$err[2], 1);
306 277
        }
307 278
        catch (PDOException $e)
308 279
        {
309  
            $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
  280
            if ($error)
  281
                $this->error->displayError('The request could not be finalized.<br />'.$e->getMessage(), 1);
310 282
        }
311 283
    }
312 284

                                        
336 308
        return $postval;
337 309
    }
338 310
}
339  
?>
  311
?>
340 312

                                        

 

Old New Code
59 59
     */
60 60
    function displayError ($error, $status, $http='')
61 61
    {
  62
        // In this file, if an external server (for OpenForge extern search) is not
  63
        // online, we get an ugly warning, just ignore it (that's not bad, that's just
  64
        // a work-around: WARNING shouldn't be blocking, but our class make them so).
  65
        if ($error[0] == 2 && $error[2] == $this->basedir.'/inc/modules/search/views/default.php')
  66
            return FALSE;
  67

                                    
  68
        // I don't understand PDO. Sometimes it works, sometimes not. Without any good reason.
  69
        // But I don't want to annoy end-users with that. And I'm investigating this bug. But I
  70
        // just don't find another way to "fix" that. It's ugly, yes. You can slap me for that.
  71
        // Oh, slap me more! I like that!
  72
        if ($error[0] == 2 && $error[2] == $this->basedir.'/inc/classes/db.php')
  73
            return FALSE;
  74

                                    
62 75
        if (!empty($http))
63 76
            Header('HTTP/1.0 '.$http);
64 77

                                        
65 78

                                        

 

Old New Code
22 22
 * @file
23 23
 * This file contains the Session class
24 24
 *
25  
 * Init session, (auto) log-in, log-out and test status
  25
 * Init session, (auto) log-in, log-out and status-testing.
26 26
 */
27 27

                                        
28 28

                                        
39 39
        $this->error = $error;
40 40
    }
41 41

                                        
  42

                                    
  43
    /**
  44
     * Init
  45
     *
  46
     * Create the session for this user.
  47
     * @param $ip
  48
     *   The IP address of this user.
  49
     */
42 50
    function init($ip)
43 51
    {
44 52
        // Construct session
45 53
        session_start();
46 54
        $_SESSION['ip'] = $ip;
  55

                                    
47 56
        if (empty($_SESSION['alea']))
48 57
            $_SESSION['alea'] = rand(42, 1337);
  58

                                    
49 59
        if (empty($_SESSION['captcha']))
50 60
            $_SESSION['captcha'] = generateUniqueID(FALSE);
51 61

                                        
54 64
            $this->autologin();
55 65
    }
56 66

                                        
  67

                                    
  68
    /**
  69
     * Log out
  70
     *
  71
     * Log out a registered user and destroy his session.
  72
     */
57 73
    function logout()
58 74
    {
59 75
        // Destroy current session and cookie if exist
62 78
        if (isset($_COOKIE['ctcookieautoc']))
63 79
            $this->unsetcookie('ctcookieautoc');
64 80

                                        
  81
        // Go at the home page
65 82
        global $baseurl;
66 83
        Header('Location: '.$baseurl);
67 84
        exit();
68 85
    }
69  
    
  86

                                    
  87

                                    
  88
    /**
  89
     * Auto-login
  90
     *
  91
     * Log in a registered user with the cookie.
  92
     */
70 93
    function autologin()
71 94
    {
72 95
        if (isset($_COOKIE['ctcookieautoc']))
117 140
            }
118 141
        }
119 142
    }
120  
    
  143

                                    
  144

                                    
  145
    /**
  146
     * Unset cookie
  147
     *
  148
     * Delete a cookie.
  149
     * @param $cookie
  150
     *   The cookie to be deleted.
  151
     */
121 152
    function unsetcookie($cookie)
122 153
    {
123 154
        // Delete wrong cookie
124 155
        setcookie($cookie, '', 0, '/', '', 0);
125 156
    }
126  
    
  157

                                    
  158

                                    
  159
    /**
  160
     * Log in
  161
     *
  162
     * Log in a registered user with nickname and password.
  163
     * @param $nick
  164
     *   The nickname.
  165
     * @param $pass
  166
     *   The password.
  167
     * @param $autoconnect
  168
     *   TRUE if you want a cookie to be written.
  169
     */
127 170
    function login($nick, $pass, $autoconnect=0)
128 171
    {
129 172
        $hash = sha1($pass);
155 198
        else
156 199
            $this->error->displayError(i18n('Authentification error! Please verify your nickname (case-sensitive).'), 0);
157 200
    }
158  
    
  201

                                    
  202

                                    
  203
    /**
  204
     * Is logged?
  205
     *
  206
     * Return TRUE if a user is currently logged.
  207
     * @return
  208
     *   A boolean.
  209
     */
159 210
    function isLogged()
160 211
    {
161 212
        //Check if the user is logged
162 213

                                        

 

Old New Code
20 20

                                        
21 21
/**
22 22
 * @file
23  
 * Experimental SVG graphs
  23
 * This file contains a class that calls DrawSVGChart
24 24
 */
25 25

                                        
26 26

                                        
39 39
        $this->page = $page;
40 40
        $this->baseurl = $baseurl;
41 41

                                        
42  
        // Start XML output
43  
        Header('Content-Type: image/svg+xml; charset=utf-8');
  42
        $drawsvgchart = getClass('drawsvgchart');
44 43

                                        
45  
        // If this is a project
46 44
        if ($page[2] == 'project')
47 45
        {
48 46
            // Security test
60 58

                                        
61 59
            // Bugs
62 60
            if ($page[4] == 'bugs')
63  
                $this->generateProjectBugs();
  61
            {
  62
                $project_versions = getClass('project.versions', $this->database);
  63
                $project_bugs = getClass('project.bugs', $this->database);
64 64

                                        
65  
        }
66  
        else
67  
            exit('Error.');
68  
    }
  65
                $versions = $project_versions->getVersions($this->id);
  66
                $bugs_array = array();
  67
                $bugs_total = 0;
69 68

                                        
  69
                foreach ($versions as $version)
  70
                {
  71
                    $version = $version['version'];
  72
                    $bugs = $project_bugs->countReports($this->id, $version);
70 73

                                        
  74
                    $buga = $project_bugs->countReportsByStatus($this->id, 'unconfirmed', $version);
  75
                    $bugb = $project_bugs->countReportsByStatus($this->id, 'confirmed', $version);
  76
                    $bugc = $project_bugs->countReportsByStatus($this->id, 'working', $version);
  77
                    $bugd = $project_bugs->countReportsByStatus($this->id, 'needinformations', $version);
  78
                    $buge = $project_bugs->countReportsByStatus($this->id, 'needcontributors', $version);
  79
                    $bugf = $project_bugs->countReportsByStatus($this->id, 'needtests', $version);
  80
                    $bugs_open = $buga + $bugb + $bugc + $bugd + $buge + $bugf;
71 81

                                        
72  
    function generateProjectBugs()
73  
    {
74  
        $project_versions = getClass('project.versions', $this->database);
75  
        $project_bugs = getClass('project.bugs', $this->database);
  82
                    $bugs_array[0][$version] = $bugs;
  83
                    $bugs_array[1][$version] = $bugs_open;
  84
                }
76 85

                                        
77  
        $versions = $project_versions->getVersions($this->id);
78  
        $bugs_array = array();
79  
        $bugs_total = 0;
  86
                $legend = array(array('#5276A9', 'reported bugs'),
  87
                                array('#CD3333', 'open bugs'));
  88
                $link = $this->baseurl.'project/'.htmlspecialchars($this->dbname).'/bugs/version/{data}/forceclosed';
  89
                $svgchart = $drawsvgchart->createChart($bugs_array, $legend, $link);
80 90

                                        
81  
        foreach ($versions as $version)
82  
        {
83  
            $version = $version['version'];
84  
            $bugs = $project_bugs->countReports($this->id, $version);
85  
            // TEST VALUES
86  
            if ($version == 'trunk')
87  
                $bugs = 42;
88  
            elseif ($version == '0.42')
89  
                $bugs = 22;
90  
            elseif ($version == '0.9')
91  
                $bugs = 16;
92  
            elseif ($version == 'francoismarcel')
93  
                $bugs = 11;
94  
            elseif ($version == '0.1rc1_uvr-X86')
95  
                $bugs = 5;
96  
            elseif ($version == '1.0')
97  
                $bugs = 33;
98  
            elseif ($version == '1.5')
99  
                $bugs = 0;
100  
            else
101  
                $bugs = 0;
102  
            
  91
                if (!$drawsvgchart->has_errors())
  92
                {
  93
                    Header('Content-Type: image/svg+xml; charset=utf-8');
  94
                    echo $drawsvgchart->getXMLOutput();
  95
                }
  96
                else
  97
                    exit(i18n('Not enough values to proceed!'));
  98
            }
  99
            elseif ($page[4] == 'contributors')
  100
            {
  101
                $commits = getClass('projects.commits', $this->database);
  102
                $datas = $commits->getProjectContributors($this->id);
103 103

                                        
104  
            $bugs_total = $bugs_total + $bugs;
105  
            $bugs_array[$version] = $bugs;
106  
        }
  104
                $legend = array('#5276A9', 'commits');
  105
                $link = $this->baseurl.'users/show/{data}';
  106
                $svgchart = $drawsvgchart->createChart($datas, array($legend), $link);
107 107

                                        
108  
        $max_value = max($bugs_array);
109  
        $x = ($max_value / 100 * 110);
110  
        $final_value = (int)($x - ($x % 4));
  108
                if (!$drawsvgchart->has_errors())
  109
                {
  110
                    Header('Content-Type: image/svg+xml; charset=utf-8');
  111
                    echo $drawsvgchart->getXMLOutput();
  112
                }
  113
                else
  114
                    exit(i18n('Not enough values to proceed!'));
  115
            }
  116
            elseif ($page[4] == 'history')
  117
            {
  118
                $commits = getClass('projects.commits', $this->database);
  119
                $datas = $commits->getProjectHistory($this->id);
111 120

                                        
112  
        $scale[4] = $final_value * 4/4;
113  
        $scale[3] = $final_value * 3/4;
114  
        $scale[2] = $final_value * 2/4;
115  
        $scale[1] = $final_value * 1/4; 
  121
                $legend = array('#CD3333', 'commits');
  122
                $link = FALSE;
  123
                $svgchart = $drawsvgchart->createChart($datas, array($legend), $link, TRUE);
116 124

                                        
117  
        if ($scale[4] == 0)
118  
            exit('Error: not enough values to proceed.');
119  

                                    
120  
        echo '<?xml-stylesheet href="'.$this->baseurl.'inc/templates/svg-graphics.css" type="text/css"?>
121  
<svg
122  
    xmlns:svg="http://www.w3.org/2000/svg"
123  
    xmlns="http://www.w3.org/2000/svg"
124  
    xmlns:xlink="http://www.w3.org/1999/xlink"
125  
    version="1.0"
126  
    width="450"
127  
    height="250"
128  
    id="svg">
129  

                                    
130  
    <g class="static-background">
131  
        <path d="M 40, 14 L  55, 14" id="legendline"
132  
            stroke="#5276A9" stroke-width="2px"/>
133  
        <text x="57" y="17" text-anchor="start" id="reftext"
134  
            fill="#5276A9" font-size="11px" font-family="\'DejaVu sans\', Verdana, sans-serif">
135  
            '.i18n('bugs reported').'
136  
        </text>
137  

                                    
138  
        <path d="M 40, 25 L 55, 25" id="legendline"
139  
            stroke="#CD3333" stroke-width="2px" />
140  
        <text x="57" y="27" text-anchor="start" id="reftext"
141  
            fill="#CD3333" font-size="11px" font-family="\'DejaVu sans\', Verdana, sans-serif">
142  
            '.i18n('open bugs').'
143  
        </text>
144  

                                    
145  
        <path d="M 38, 33 L 430, 33" stroke="#CED0D5" stroke-witdh="1px"/>
146  
        <text x="34" y="36" text-anchor="end" class="refleft">'.$scale[4].'</text>
147  
        <path d="M 38, 83 L 430, 83" stroke="#EAEAEA" stroke-witdh="1px"/>
148  
        <text x="34" y="86" text-anchor="end" class="refleft">'.$scale[3].'</text>
149  
        <path d="M 38, 133 L 430, 133" stroke="#EAEAEA" stroke-witdh="1px"/>
150  
        <text x="34" y="136" text-anchor="end" class="refleft">'.$scale[2].'</text>
151  
        <path d="M 38,183 L 430,183" stroke="#EAEAEA" stroke-witdh="1px"/>
152  
        <text x="34" y="186" text-anchor="end" class="refleft">'.$scale[1].'</text>
153  

                                    
154  
        <text x="34" y="236" text-anchor="end" class="refleft">0</text>';
155  

                                    
156  
        $j = 50;
157  
        foreach ($bugs_array as $version => $bugs)
158  
        {
159  
            $i = 18 + $j;
160  
            echo '
161  

                                    
162  
        <path d="M  '.$i.',234 L  '.$i.',238" stroke="#596171" stroke-width="2px"/>
163  
        <text x="'.$i.'" y="248" text-anchor="middle" class="reftext">
164  
        <a xlink:href="'.$this->baseurl.'project/'.$this->dbname.'/bugs/version/'.$version.'/forceclosed" target="_blank">'.mb_substr($version, 0, 6).'</a></text>';
165  
            $j = $j + 50;
  125
                if (!$drawsvgchart->has_errors())
  126
                {
  127
                    Header('Content-Type: image/svg+xml; charset=utf-8');
  128
                    echo $drawsvgchart->getXMLOutput();
  129
                }
  130
                else
  131
                    exit(i18n('Not enough values to proceed!'));
  132
            }
166 133
        }
167  

                                    
168  
    echo '
169  
    </g>
170  

                                    
171  
    <defs>
172  
        <mask id="barmask">
173  
            <rect x="0" y="12" width="410" height="220" fill="#FFFFFF"/>
174  
        </mask>
175  
        <rect id="focusbar" width="14" height="211" y="34"
176  
            style="fill:black;opacity:0"/>
177  
        <path id="bubble" 
178  
            d="M 4.7871575,0.5 L 39.084404,0.5 C 41.459488,0.5 43.371561,2.73 43.371561,5.5 L 43.371561,25.49999 C 43.371561,27.07677 43.83887,41.00777 42.990767,40.95796 C 42.137828,40.90787 37.97451,30.49999 36.951406,30.49999 L 4.7871575,30.49999 C 2.412072,30.49999 0.5,28.26999 0.5,25.49999 L 0.5,5.5 C 0.5,2.73 2.412072,0.5 4.7871575,0.5 z"
179  
            fill="none" fill-opacity="0.9"
180  
            stroke="none" stroke-opacity="0.8" stroke-width="1px"/>
181  
    </defs>
182  

                                    
183  
    <g mask="url(#barmask)">
184  
        <defs>
185  
            <rect id="graphicbar" width="12" height="200" rx="2" ry="1"
186  
                fill="#6C84C0" fill-opacity="0.6"
187  
                stroke="#5276A9" stroke-width="1px"/>
188  

                                    
189  
            <rect style="fill:#8B2323"
190  
                id="rectpoint"
191  
                width="3"
192  
                height="3" />
193  
        </defs>';
194  

                                    
195  
        $x_base = 35;
196  
        $y_base = 20;
197  

                                    
198  
        $previous_openbugs = 286;
199  
        $previous_xposition = 33;
200  

                                    
201  
        $chart_defs = '';
202  
        foreach ($bugs_array as $version => $bugs)
203  
        {
204  
            $x = 27 + $x_base;
205  
            $y = 107 + $y_base;
206  

                                    
207  
            $buga = $project_bugs->countReportsByStatus($this->id, 'unconfirmed', $version);
208  
            $bugb = $project_bugs->countReportsByStatus($this->id, 'confirmed', $version);
209  
            $bugc = $project_bugs->countReportsByStatus($this->id, 'working', $version);
210  
            $bugd = $project_bugs->countReportsByStatus($this->id, 'needinformations', $version);
211  
            $buge = $project_bugs->countReportsByStatus($this->id, 'needcontributors', $version);
212  
            $bugf = $project_bugs->countReportsByStatus($this->id, 'needtests', $version);
213  
            $bugs_open = $buga + $bugb + $bugc + $bugd + $buge + $bugf;
214  
            // TEST VALUES
215  
            if ($version == 'trunk')
216  
                $bugs_open = 31;
217  
            elseif ($version == '0.42')
218  
                $bugs_open = 20;
219  
            elseif ($version == '0.9')
220  
                $bugs_open = 1;
221  
            elseif ($version == 'francoismarcel')
222  
                $bugs_open = 5;
223  
            elseif ($version == '0.1rc1_uvr-X86')
224  
                $bugs_open = 5;
225  
            elseif ($version == '1.0')
226  
                $bugs_open = 2;
227  
            elseif ($version == '1.5')
228  
                $bugs_open = 0;
229  
            else
230  
                $bugs_open = 0;
231  
            
232  

                                    
233  
            $openbugs = 233 - ceil($bugs_open / ($scale[4] / 100) * 2);
234  
            $top = 233 - ceil($bugs / ($scale[4] / 100) * 2);
235  

                                    
236  
            if ($x != (27 + 35))
237  
                $chart_defs .= 'L '.($x + 6).' '.$openbugs.'  ';
238  
            else
239  
                $chart_defs .= 'M '.($previous_xposition + 6).' '.$previous_openbugs.' L '.($x + 6).' '.$openbugs.'  ';
240  

                                    
241  
            echo '
242  

                                    
243  
        <g class="gbar">
244  
            <use xlink:href="#focusbar" x="'.$x.'"/>
245  
            <use xlink:href="#graphicbar" x="'.$x.'" y="'.$top.'"/>
246  
            <use xlink:href="#bubble" x="'.($x - 37).'" y="'.($top - 42).'"/>
247  
            <text class="bubbletext" fill="none" x="'.($x - 16).'" y="'.($top - 20).'">'.$bugs.'</text>
248  
        </g>';
249  

                                    
250  
            if ($openbugs != 286)
251  
            echo '
252  
        <g class="rectpoint">
253  
            <use xlink:href="#rectpoint" x="'.($x + 4).'" y="'.($openbugs - 1).'" />
254  
        </g>';
255  

                                    
256  
            $x_base = $x_base + 50;
257  
            $y_base = $y_base + 20;
258  
            $previous_openbugs = $openbugs;
259  
            $previous_xposition = $x;
260  
        }
261  

                                    
262  
    echo '
263  

                                    
264  
        <path d="'.$chart_defs.'" stroke="#CD3333" stroke-width="1px" fill="none" />
265  
    </g>
266  

                                    
267  
    <g class="static-foreground">
268  
        <path d="M 38,233 L 430,233" stroke="#2F4F77" stroke-width="2px"/>
269  
    </g>
270  
</svg>';
271 134
    }
272  

                                    
273 135
}
274 136
?>
275 137

                                        

 

Old New Code
50 50
            if (!empty($value) || $value == 0)
51 51
                $this->page[$key] = $value;
52 52

                                        
  53
        // Popularity contest
  54
        // Each projects have a popularity score and this score is resetted each months.
  55
        $cfg = getClass('config', $this->ct_db);
  56
        $timestamp = $cfg->get('projects', 'popularity-timestamp');
  57
        if (!$timestamp || ( $timestamp + (86400 * 30) ) < time())
  58
        {
  59
            // Reset popularity for each projects
  60
            $this->ct_db->update('projects', array('popularity' => 0), FALSE);
  61

                                    
  62
            // Reset contest
  63
            $cfg->update('projects', 'popularity-timestamp', time());
  64
            $cfg->update('projects', 'overall-popularity', 0);
  65
        }
  66

                                    
  67
        // Cache maximum
  68
        $this->cache_max_files = (int)$cfg->get('global', 'cache-max-files');
  69

                                    
53 70
        // Prepare
54 71
        switch ($this->page[1])
55 72
        {
80 97
    /**
81 98
     * Parse API
82 99
     *
83  
     * Print the XML outpult
  100
     * Print the XML output
84 101
     */
85 102
    function parseAPI ()
86 103
    {
90 107
        elseif ($this->page[2] == 'project') 
91 108
            $mod = $this->basedir.'/inc/modules/project/views/default.php';
92 109
        elseif ($this->page[2] == 'search') 
93  
            exit('Not implemented.');
  110
            $mod = $this->basedir.'/inc/modules/search/views/default.php';
94 111
        else
95 112
            exit('CodingTeam OpenForge API');
96 113

                                        
101 118
            $view_api = new View($this->ct_session, $this->ct_db, $this->page,
102 119
                                 $this->error, $this->langlist, $this->lang);
103 120
            $openforge_array = $view_api->showAPI();
104  

                                    
105  
            if (!is_array($openforge_array))
106  
                exit('CodingTeam OpenForge API');
107 121
        }
108 122
        else
109 123
            exit('CodingTeam OpenForge API');
110  

                                    
111  
        // Create the OpenForge document
112  
        Header("Content-Type: application/xml; charset=utf-8");
113  
        $xml = new DOMDocument('1.0', 'utf-8');
114  
        $openforge = $xml->createElement('openforge');
115  
        $xml->appendChild($openforge);
116  

                                    
117  
        // Append the forge info
118  
        $forge = $openforge->appendChild($xml->createElement('forge'));
119  
        $forge->appendChild($xml->createElement('name', 'CodingTeam'));
120  
        $forge->appendChild($xml->createElement('url', $this->baseurl));
121  
        $forge->appendChild($xml->createElement('version', file_get_contents($this->basedir.'/VERSION')));
122  
        $forge->appendChild($xml->createElement('apiversion', 0.1));
123  

                                    
124  
        // Append the results sended by the module
125  
        $project = $xml->createElement($this->page[2]);
126  

                                    
127  
        foreach ($openforge_array as $key => $value)
128  
        {
129  
            // If an array is returned, we generate attribute, childs and so many :)
130  
            if (is_array($value))
131  
            {
132  
                $xml_tag = $project->appendChild($xml->createElement($key, $value['label']));
133  

                                    
134  
                if (array_key_exists('attribute', $value))
135  
                    foreach ($value['attribute'] as $attrkey => $attrvalue)
136  
                        $xml_tag->setAttribute($attrkey, $attrvalue);
137  

                                    
138  
                if (array_key_exists('parent', $value))
139  
                    foreach ($value['parent'] as $childkey => $childvalue)
140  
                        $xml_tag->appendChild($xml->createElement(mb_substr($key, 0, -1), $childvalue));
141  
            }
142  
            else
143  
                $project->appendChild($xml->createElement($key, $value));
144  
        }
145  

                                    
146  
        $openforge->appendChild($project);
147  

                                    
148  
        // Show the result
149  
        $xml->formatOutput = true; 
150  
        echo $xml->saveXML();
151 124
    }
152 125

                                        
153 126

                                        
170 143

                                        
171 144
        // Cache Atom feed for 7 days max.
172 145
        $cachenamefile = $this->basedir.'/public/cache/atom/'.$this->lang.'-'.str_replace('/', '-', getURLbyTags($this->page));
  146

                                    
173 147
        if ( (file_exists($cachenamefile) && filemtime($cachenamefile) < time() - ( 3600 * 24 * 7 )) || !file_exists($cachenamefile) )
174 148
        {
175 149
            // Find the requested module view
255 229
            $xml->formatOutput = true; 
256 230
            $tpl_show = $xml->saveXML();
257 231

                                        
  232
            // Maximum files in cache
  233
            $cachedir_ = $this->basedir.'/public/cache/atom/';
  234
            $cachedir = opendir($cachedir_);
  235

                                    
  236
            $counter = 0;
  237
            $cache_files = array();
  238

                                    
  239
            // Count files in cache and create array
  240
            while($f = readdir($cachedir))
  241
                if (is_file($cachedir_.$f))
  242
                {
  243
                    $cache_files[filemtime($cachedir_.$f)] = $cachedir_.$f;
  244

                                    
  245
                    $counter ++;
  246
                }
  247
            closedir($cachedir);
  248
            ksort($cache_files);
  249

                                    
  250
            // If we need to delete the oldest file before save our new one
  251
            if ((count($cache_files) - 1) > ($this->cache_max_files / 2))
  252
                unlink(reset($cache_files));
  253

                                    
258 254
            // Write in the cache
259 255
            $filec = fopen($cachenamefile, 'w');
260 256
            fwrite($filec, $tpl_show);
358 354
            $xml->formatOutput = true; 
359 355
            $tpl_show = $xml->saveXML();
360 356

                                        
  357
            // Maximum files in cache
  358
            $cachedir_ = $this->basedir.'/public/cache/rss/';
  359
            $cachedir = opendir($cachedir_);
  360

                                    
  361
            $counter = 0;
  362
            $cache_files = array();
  363

                                    
  364
            // Count files in cache and create array
  365
            while($f = readdir($cachedir))
  366
                if (is_file($cachedir_.$f))
  367
                {
  368
                    $cache_files[filemtime($cachedir_.$f)] = $cachedir_.$f;
  369

                                    
  370
                    $counter ++;
  371
                }
  372
            closedir($cachedir);
  373
            ksort($cache_files);
  374

                                    
  375
            // If we need to delete the oldest file before save our new one
  376
            if ((count($cache_files) - 1) > ($this->cache_max_files / 2))
  377
                unlink(reset($cache_files));
  378

                                    
361 379
            // Write in the cache
362 380
            $filec = fopen($cachenamefile, 'w');
363 381
            fwrite($filec, $tpl_show);
389 407

                                        
390 408
        // If a > 0 the page cannot be stored in the cache
391 409
        $a = 0;
392  
        $nocache_keywords = array('register', 'logout', 'deleteadmin', 'password', 'delete', 'admin', 'new', 'add', 'edit', 'answer', 'search', 'join', 'vote');
  410
        $nocache_keywords = array('register', 'logout', 'deleteadmin', 'password', 'delete', 'admin',
  411
                                  'new', 'add', 'edit', 'answer', 'search', 'join', 'vote');
393 412
        foreach ($nocache_keywords as $key)
394 413
            if (in_array($key, $this->page))
395 414
                $a ++;
431 450
                else
432 451
                    $additional = '';
433 452

                                        
  453
                // Maximum files in cache
  454
                $cachedir_ = $this->basedir.'/public/cache/xhtml/';
  455
                $cachedir = opendir($cachedir_);
  456

                                    
  457
                $counter = 0;
  458
                $cache_files = array();
  459

                                    
  460
                // Count files in cache and create array
  461
                while($f = readdir($cachedir))
  462
                    if (is_file($cachedir_.$f))
  463
                    {
  464
                        $cache_files[filemtime($cachedir_.$f)] = $cachedir_.$f;
  465

                                    
  466
                        $counter ++;
  467
                    }
  468
                closedir($cachedir);
  469
                ksort($cache_files);
  470

                                    
  471
                // If we need to delete the oldest file before save our new one
  472
                if ((count($cache_files) - 1) > $this->cache_max_files)
  473
                    unlink(reset($cache_files));
  474

                                    
434 475
                // Save in cache
435 476
                file_put_contents($file, $additional.$view['content']);
436 477
                $content = $view['content'];
597 638
        $temp['link_tou'] = i18n('Terms of Use');
598 639
        $temp['link_admin'] = i18n('Administration');
599 640

                                        
600  
        // Generate the NotepadMenu
  641
        // Generate the menu
601 642
        $tabs = array();
602 643
        $modlist = array();
603 644
        $modulesdir = opendir($this->basedir.'/inc/modules/');
604 645

                                        

 

Old New Code
40 40

                                        
41 41

                                        
42 42
    /**
  43
     * Get users list
  44
     *
  45
     * @return
  46
     *
  47
     */
  48
    function getUsersList($where, $limit)
  49
    {
  50
        $req0 = $this->db->select('users', $where, 'id');
  51
        $req1 = $this->db->select('users', $where, '*', 'ORDER BY date DESC '.$limit);
  52

                                    
  53
        return array(count($req0), $req1);
  54
    }
  55

                                    
  56

                                    
  57
    /**
43 58
     * Get users number
44 59
     *
45 60
     * @return
46 61

                                        

 

Old New Code
28 28
 * this page: http://en.wikipedia.org/wiki/Comparison_of_free_software_licences
29 29
 */
30 30

                                        
31  
$licenses['afl'] = 'Academic Free License';
32 31
$licenses['al20'] = 'Apache License 2.0';
33  
$licenses['asl'] = 'Apache Software License';
34  
$licenses['apsl'] = 'Apple Public Source License';
35 32
$licenses['bsd'] = 'BSD License';
36  
$licenses['cpl'] = 'Common Public License';
37 33
$licenses['cecill'] = 'CeCILL';
38  
$licenses['efl2'] = 'Eiffel Forum License 2.0';
39  
$licenses['epl'] = 'Eclipse Public License';
  34
$licenses['cpl'] = 'Common Public License';
40 35
$licenses['gnuagpl'] = 'GNU Affero General Public License';
41 36
$licenses['gnugpl'] = 'GNU General Public License';
42 37
$licenses['gnulgpl'] = 'GNU Lesser General Public License';
43  
$licenses['ibmpl'] = 'IBM Public License';
44  
$licenses['iosl'] = 'Intel Open Source License';
45  
$licenses['mpl'] = 'Mozilla Public License (1.0, 1.1)';
46  
$licenses['npl'] = 'Netscape Public License (1.0, 1.1)';
47  
$licenses['osl'] = 'Open Software License';
48  
$licenses['phpl'] = 'PHP License';
49  
$licenses['pal'] = 'Perl Artistic License';
50  
$licenses['cnripl'] = 'Python License';
51  
$licenses['psfl'] = 'Python Software Foundation License';
52  
$licenses['sl'] = 'Sleepycat Software Product License';
53  
$licenses['sissl'] = 'Sun Industry Standards Source License';
54  
$licenses['spl'] = 'Sun Public License';
55  
$licenses['w3c'] = 'W3C Software License';
56  
$licenses['wxwll'] = 'wxWindows Library License';
57  
$licenses['zll'] = 'zlib/libpng';
58  
$licenses['zpl'] = 'Zope Public License';
  38
$licenses['mit'] = 'X11/MIT License';
59 39
?>
60 40

                                        

 

Old New Code
57 57
            elseif (is_string($value))
58 58
                $type = 's';
59 59

                                        
  60
            // Authorize errors
  61
            if (!strstr($str, '%('.$key.')d') && $type == 'd')
  62
                $type = 's';
  63

                                    
60 64
            // Replace
61 65
            $str = str_replace('%('.$key.')'.$type, $value, $str);
62 66
        }
63 67

                                        

 

Old New Code
61 61
            '.i18n('You are not logged in.').'<br />
62 62
            <a href="users/register">'.i18n('Register').'</a> -
63 63
            <a href="users/password">'.i18n('Password remember').'</a><br />
64  
            <input type="text" size="15" maxlength="255" name="nickname" />
65  
            &nbsp;&nbsp;<label><input type="checkbox" name="auto" checked="checked" />'.i18n('Automatic').'</label><br />
66  
            <input type="password" size="15" maxlength="255" name="password" />
  64
            <input type="text" size="15" maxlength="255" name="nickname" tabindex="1" />
  65
            &nbsp;&nbsp;<label><input type="checkbox" name="auto" checked="checked" tabindex="3" />'.i18n('Automatic').'</label><br />
  66
            <input type="password" size="15" maxlength="255" name="password" tabindex="2" />
67 67
            &nbsp;&nbsp;<input class="submit" type="submit" value="'.i18n('Log in').'" />
68 68
            </p>
69 69
            </form>';
70 70

                                        

 

Old New Code
31 31
        $this->in_array = array('projects' => i18n('Projects'),
32 32
                                'projects-bugs' => i18n('Bugs'),
33 33
                                'projects-doc' => i18n('Documentation'),
34  
                                'projects-downloads' => i18n('Downloads'),
35 34
                                'projects-forum' => i18n('Forum'),
36 35
                                'projects-news' => i18n('News'),
37  
                                'projects-screenshots' => i18n('Screenshots'),
38  
                                'projects-todo' => i18n('Todo list'),
39  
                                'notepad' => i18n('Notepad'),
40 36
                                'users' => i18n('Users')
41 37
                                );
42 38
    }
43 39

                                        

 

Old New Code
36 36

                                        
37 37
        // Meta tags
38 38
        $this->metatags = array('title'       => i18n('Index'),
39  
                                'feed'         => 'projects',
  39
                                'feed'        => 'projects',
40 40
                                'description' => '',
41 41
                                'keywords'    => ''
42 42
                               );
72 72
        <h4>'.i18n('Latest commits').'</h4>
73 73
        <ul>';
74 74

                                        
75  
        global $basedir;
76  
        global $baseurl;
77  
        if (is_file($basedir.'/public/svn/commits.log'))
  75
        $commits = getClass('projects.commits', $this->ct_db);
  76
        $commits_list = $commits->getLatests(FALSE, 4);
  77
        foreach ($commits_list as $commit)
78 78
        {
79  
            $file = fopen($basedir.'/public/svn/commits.log', 'r');
  79
            $this->project->load($commit['projectid']);
  80
            $project_name = htmlspecialchars($this->project->getName());
  81
            $project_dbname = htmlspecialchars($this->project->getDbname());
80 82

                                        
81  
            while (!feof($file))
82  
            {
83  
                $line = fgets($file, 1024);
84  
                $array = explode('/', $line);
  83
            $user_name = htmlspecialchars($commit['author']);
85 84

                                        
86  
                if (!empty($array[0]) && $this->project->load($array[0], 'dbname'))
87  
                {
88  
                    $rev = $array[1];
89  
                    $prev_rev = $array[1] - 1;
  85
            $this->maincontent .= '<li style="background: #F8F8FF;">;
  86
            <a href="project/'.$project_dbname.'/browse/diff/'.$commit['prev_rev'].'/'.$commit['new_rev'].'">
  87
            <strong>'.map_str(htmlspecialchars($commit['log']), 35).'</strong></a><br />
90 88

                                        
91  
                    $cmd = escapeshellcmd('svn log '.$baseurl.'svn/'.$array[0].' -r'.$rev.' --xml');
92  
                    ob_start();
93  
                    passthru($cmd);
94  
                    $xml = ob_get_clean();
  89
            <span style="font-style: italic;color: #8e8e8e;font-size: 0.8em;">;
  90
            '.i18n('Revision %(rev)d commited by %(author)s on %(project)s',
  91
                array('rev' => (int)$commit['new_rev'],
  92
                      'author' => '<a href="users/show/'.$user_name.'">'.$user_name.'</a>',
  93
                      'project' => '<strong>'.$project_name.'</strong>'
  94
                     )).'</span></li>';
95 95

                                        
96  
                    $simplexml = simplexml_load_string($xml);
97  

                                    
98  
                    $project_dbname = htmlspecialchars($this->project->getDbname());
99  
                    $project_name = htmlspecialchars($this->project->getName());
100  

                                    
101  
                    $user_name = htmlspecialchars($simplexml->logentry->author);
102  
                    $commit_log = htmlspecialchars($simplexml->logentry->msg);
103  

                                    
104  
                    $this->maincontent .= '<li style="background: #F8F8FF;"><a href="project/'.$project_dbname.'/svn/diff/'.$prev_rev.'/'.$rev.'"><strong>'.map_str($commit_log, 35).'</strong></a><br />
105  
                    <span style="font-style: italic;color: #8e8e8e;font-size: 0.8em;">
106  
                    '.i18n('Revision %(rev)d commited by %(author)s on %(project)s',
107  
                           array('rev' => (int)$rev,
108  
                                 'author' => '<a href="users/show/'.$user_name.'">'.$user_name.'</a>',
109  
                                 'project' => '<strong>'.$project_name.'</strong>'
110  
                          )).'</span></li>';
111  

                                    
112  
                    $this->project->unload();
113  
                }
114  
            }
115  
            fclose($file);
  96
            $this->project->unload();
116 97
        }
117 98

                                        
118 99
        $this->maincontent .= '</ul>
119 100

                                        

 

Old New Code
22 22
    <view name="browse" active="TRUE"/>
23 23
    <view name="timeline" active="TRUE"/>
24 24
    <view name="todo" active="FALSE"/>
25  
    <view name="translations" active="TRUE"/>
26 25
  </views>
27 26

                                        
28 27
  <behavior module-position="1" view-position="3"/>
29 28

                                        

 

Old New Code
111 111
                                  </ul>
112 112
                                </li>';
113 113

                                        
114  
        if ($this->views['translations'] == 'TRUE')
115  
            $this->pagemenu .= '<li '.( ($this->page[3] == 'translations') ?
116  
                                        'class="current"><a href="project/'.$this->dbname.'/translations"><img src="public/images/icons/apps/preferences-desktop-locale.png" style="float: left;padding-right: 5px;" />' :
117  
                                        '><a href="project/'.$this->dbname.'/translations">' ).i18n('Translation').'</a></li>';
118  

                                    
119 114
        if ($this->views['doc'] == 'TRUE')
120 115
            $this->pagemenu .= '<li '.( (in_array($this->page[3], array('doc', 'screenshots', 'news'))) ?
121 116
                               'class="current"><a href="project/'.$this->dbname.'/doc"><img src="public/images/icons/apps/accessories-dictionary.png" style="float: left;padding-right: 5px;" />' :
122 117

                                        

 

Old New Code
37 37
 */
38 38
function cmdlaunch($cmd)
39 39
{
40  
    $output = array();
41  
    $err = false;
  40
    ob_start();
  41
    passthru(escapeshellcmd($cmd));
  42
    $xml = ob_get_clean();
42 43

                                        
43  
    $descriptorspec = array(0 => array('pipe', 'r'),
44  
                            1 => array('pipe', 'w'),
45  
                            2 => array('pipe', 'w'));
46  

                                    
47  
    $resource = proc_open($cmd, $descriptorspec, $pipes);
48  
    $error = '';
49  

                                    
50  
    if (stream_get_contents($pipes[2]) != '')
51  
    {
52  
        proc_close($resource);
53  
        return false;
54  
    }
55  
    if (!is_resource($resource))
56  
    {
57  
        proc_close($resource);
58  
        return false;
59  
    }
60  
    else
61  
    {
62  
        $temp = stream_get_contents($pipes[1]);
63  
        proc_close($resource);
64  
        return $temp;
65  
    }
  44
    return $xml;
66 45
}
67 46

                                        
68 47

                                        
173 152
        $part = 0;
174 153
        $j = 0;
175 154

                                        
176  
        $cmd = cmdlaunch('svn di -r '.$old.':'.$new.' '.$file);
  155
        $cmd = cmdlaunch('svn di -r '.$old.':'.$new.' '.$file.'@'.$old);
177 156
        $file = explode("\n",$cmd);
178 157

                                        
179 158
        foreach($file as $line)
180 159

                                        

 

Old New Code
118 118
        <li class="dir"><a href="'.$UrlToSvn;
119 119
        if ($rev != 0)
120 120
            $temp .= '/r'.$rev;        
121  
        $temp .= '"><strong>~</strong></a></li>';
  121
        $temp .= '"><strong>/</strong></a></li>';
122 122

                                        
123 123
        for($i=1;$i<$nb;$i++)
124 124
        {
137 137
        <thead>
138 138
          <tr>
139 139
            <th colspan="2"><span style="float: right;"><a href="'.$UrlToSvn.'/log'.$path.'">'.i18n('Revision log').'</a></span>
140  
            '._('Information on the revision').'</th>
  140
            '.i18n('Information on the revision').'</th>
141 141
          </tr>
142 142
        </thead>
143 143
        <tbody>
144 144
          <tr style="background-color : #EBf0f0">
145  
            <td style="width: 20%;">'._('Revision:').'</td>
  145
            <td style="width: 20%;">'.i18n('Revision:').'</td>
146 146
            <td>'.( ($rev == 0 && $rev != 'HEAD') ? 0 : $log['revision'].' <a href="'.$UrlToSvn.'/diff/'.($log['revision'] - 1).'/'.$info['revision'].$path.'">'.i18n('(differences)').'</a>').'</td>
147 147
          </tr>
148 148
          <tr>
149  
            <td style="width: 20%;">'._('Author:').'</td>
  149
            <td style="width: 20%;">'.i18n('Author:').'</td>
150 150
            <td>'.( ($rev == 0 && $rev != 'HEAD') ? '-' : '<a href="users/show/'.htmlspecialchars($log['author']).'">'.htmlspecialchars($log['author']).'</a>' ).'</td>
151 151
          </tr>
152 152
          <tr style="background-color : #EBf0f0">
153  
            <td style="width: 20%;">'._('Log message:').'</td>
  153
            <td style="width: 20%;">'.i18n('Log message:').'</td>
154 154
            <td>'.( ($rev == 0 && $rev != 'HEAD') ? '-' : nl2br(htmlspecialchars($log['msg'])) ).'</td>
155 155
          </tr>
156 156
          <tr>
162 162
        foreach ($revisions as $name => $rev)
163 163
        {
164 164
            if ($i == 1)
165  
                $return .= _(' to ');
  165
                $return .= i18n(' to ');
166 166
            $return .= ' <input type="text" style="width: 5.0em;" name="'.$name.'" value="'.$rev.'"';
167 167
            $return .= ' /> ';
168 168
            $i++;
195 195
        foreach ($revisions as $name => $rev)
196 196
        {
197 197
            if ($i == 1)
198  
                $return .= _(' to ');
  198
                $return .= i18n(' to ');
199 199
            $return .= ' <input type="text" style="width: 5.0em;" name="'.$name.'" value="'.$rev.'"';
200 200
            $return .= ' /> ';
201 201
            $i++;
319 319
        $geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS, 2);
320 320

                                        
321 321
        if ($file===false)
322  
            $return .=  '<strong>'._('Revision not found.').'</strong>';
  322
            $return .=  '<strong>'.i18n('Revision not found.').'</strong>';
323 323
        else
324 324
        {
325 325
            if ($bin)
374 374

                                        
375 375
            $i = 1;
376 376

                                        
377  
            $return .=  '<li class="dir"><a href="'.$url.'"><strong>~</strong></a></li>';
  377
            $return .=  '<li class="dir"><a href="'.$url.'"><strong>/</strong></a></li>';
378 378
            foreach ($tree as $level)
379 379
            {
380 380
                $link .= '/'.$tree[$i];
386 386

                                        
387 387
            $return .= '</ul></div>';
388 388

                                        
389  
            foreach ($file['Part'] as $part)
390  
            {
391  
                $return .=  '<table style="width: 100%;overflow: auto;display: block;">
392  
                <thead>
393  
                  <tr>
394  
                    <th style="width: 3%;">'._('Old').'</th>
395  
                    <th style="width: 3%;">'._('New').'</th>
396  
                    <th>'._('Code').'</th>
397  
                  </tr>
398  
                </thead>';
  389
            if (count($file['Part']) > 0)
  390
                foreach ($file['Part'] as $part)
  391
                {
  392
                    $return .=  '<table style="width: 100%;overflow: auto;display: block;">
  393
                    <thead>
  394
                      <tr>
  395
                        <th style="width: 3%;">'.i18n('Old').'</th>
  396
                        <th style="width: 3%;">'.i18n('New').'</th>
  397
                        <th>'.i18n('Code').'</th>
  398
                      </tr>
  399
                    </thead>';
399 400

                                        
400  
                $LNum_old = $part['Start-'];
401  
                $LNum_new = $part['Start+'];
402  
                foreach($part['code'] as $line)
403  
                {
404  
                    switch (mb_substr($line, 0, 1))
  401
                    $LNum_old = $part['Start-'];
  402
                    $LNum_new = $part['Start+'];
  403
                    foreach($part['code'] as $line)
405 404
                    {
406  
                        case '-':
407  
                            $line_ = htmlspecialchars($line);
408  
                            $line = mb_substr($line_, 1, strlen($line_));
409  
                            $return .=  '<tr>
410  
                            <td>'.$LNum_old.'</td>
411  
                            <td>&nbsp;</td>
412  
                            <td style="background-color: #FFBBBB;">
413  
                              <pre>'.$line.'</pre>
414  
                            </td>';
415  
                            $LNum_old++;
416  
                            $return .=  '</tr>';
  405
                        switch (mb_substr($line, 0, 1))
  406
                        {
  407
                            case '-':
  408
                                $line_ = htmlspecialchars($line);
  409
                                $line = mb_substr($line_, 1, strlen($line_));
  410
                                $return .=  '<tr>
  411
                                <td>'.$LNum_old.'</td>
  412
                                <td>&nbsp;</td>
  413
                                <td style="background-color: #FFBBBB;">
  414
                                  <pre>'.$line.'</pre>
  415
                                </td>';
  416
                                $LNum_old++;
  417
                                $return .=  '</tr>';
417 418

                                        
418  
                            $latest_del = $line;
419  
                            break;
  419
                                $latest_del = $line;
  420
                                break;
420 421

                                        
421  
                        case '+':
422  
                            $line_ = htmlspecialchars($line);
423  
                            $line = mb_substr($line_, 1, strlen($line_));
  422
                            case '+':
  423
                                $line_ = htmlspecialchars($line);
  424
                                $line = mb_substr($line_, 1, strlen($line_));
424 425

                                        
425  
                            if (!empty($latest_del) && !empty($line))
426  
                            {
427  
                                for ($i=0; $i<strlen($latest_del); $i++)
428  
                                    if ($latest_del[$i] != $line[$i])
  426
                                if (!empty($latest_del) && !empty($line))
  427
                                {
  428
                                    for ($i=0; $i<strlen($latest_del); $i++)
  429
                                        if ($latest_del[$i] != $line[$i])
  430
                                        {
  431
                                            $start = $i;
  432
                                            break;
  433
                                        }
  434

                                    
  435
                                    $p_len = mb_strlen($latest_del) - 1;
  436
                                    $n_len = mb_strlen($line) - 1;
  437
                                    $i = max($p_len, $n_len);
  438
                                    while ($i >= 0)
429 439
                                    {
430  
                                        $start = $i;
431  
                                        break;
432  
                                    }
  440
                                        if ($latest_del[$p_len] != $line[$n_len])
  441
                                        {
  442
                                            $end = $i + 1;
  443
                                            break;
  444
                                        }
433 445

                                        
434  
                                $p_len = mb_strlen($latest_del) - 1;
435  
                                $n_len = mb_strlen($line) - 1;
436  
                                $i = max($p_len, $n_len);
437  
                                while ($i >= 0)
438  
                                {
439  
                                    if ($latest_del[$p_len] != $line[$n_len])
440  
                                    {
441  
                                        $end = $i + 1;
442  
                                        break;
  446
                                        $p_len --;
  447
                                        $n_len --;
  448
                                        $i --;
443 449
                                    }
444 450

                                        
445  
                                    $p_len --;
446  
                                    $n_len --;
447  
                                    $i --;
  451
                                    $new = mb_substr($line, $start, $end - $start);
  452
                                    $line = str_replace($new, '<span class="diffnew">'.$new.'</span>', $line);
  453
                                    $latest_del = '';
448 454
                                }
  455
                                $return .=  '<tr>
  456
                                <td>&nbsp;</td>
  457
                                <td>'.$LNum_new.'</td>
  458
                                <td style="background-color: #BBFFBB;">
  459
                                  <pre>'.$line.'</pre>
  460
                                </td>';
  461
                                $LNum_new++;
  462
                                $return .=  '</tr>';
  463
                                break;
449 464

                                        
450  
                                $new = mb_substr($line, $start, $end - $start);
451  
                                $line = str_replace($new, '<span class="diffnew">'.$new.'</span>', $line);
452  
                                $latest_del = '';
453  
                            }
454  
                            $return .=  '<tr>
455  
                            <td>&nbsp;</td>
456  
                            <td>'.$LNum_new.'</td>
457  
                            <td style="background-color: #BBFFBB;">
458  
                              <pre>'.$line.'</pre>
459  
                            </td>';
460  
                            $LNum_new++;
461  
                            $return .=  '</tr>';
462  
                            break;
  465
                            case '\\':
  466
                                break;
463 467

                                        
464  
                        case '\\':
465  
                            break;
466  

                                    
467  
                        default:
468  
                            $line = htmlspecialchars($line);
469  
                            $return .=  '<tr>
470  
                            <td>'.$LNum_old.'</td>
471  
                            <td>'.$LNum_new.'</td>
472  
                            <td>
473  
                              <pre>'.mb_substr($line, 1, strlen($line)).'</pre>
474  
                            </td>';
475  
                            $LNum_old++;
476  
                            $LNum_new++;
477  
                            $return .=  '</tr>';
478  
                            break;
  468
                            default:
  469
                                $line = htmlspecialchars($line);
  470
                                $return .=  '<tr>
  471
                                <td>'.$LNum_old.'</td>
  472
                                <td>'.$LNum_new.'</td>
  473
                                <td>
  474
                                  <pre>'.mb_substr($line, 1, strlen($line)).'</pre>
  475
                                </td>';
  476
                                $LNum_old++;
  477
                                $LNum_new++;
  478
                                $return .=  '</tr>';
  479
                                break;
  480
                        }
479 481
                    }
  482
                     $return .= '</table>';
480 483
                }
481  
                 $return .= '</table>';
482  
            }
483 484
        }
  485

                                    
484 486
        return $return;
485 487
    }
486 488

                                        
500 502
        if (!$list)
501 503
            $return .= '<strong>'.i18n('This file or directory does not exist.').'</strong>';
502 504
        else {
503  
            $return .= '<table style="width: 100%;">
  505
            $return .= '
  506
            <div class="feed" style="background-image: url(\'public/images/feed.png\');">
  507
            '.i18n('Feed subscription: %(rss)s or %(atom)s.',
  508
                   array('rss' => '<a href="rss'.htmlspecialchars($parents->UrlToSvn).'">'.i18n('RSS').'</a>',
  509
                         'atom' => '<a href="atom'.htmlspecialchars($parents->UrlToSvn).'">'.i18n('Atom').'</a>'
  510
                  )).'</div>
  511

                                    
  512
            <table style="width: 100%;">
504 513
            <thead>
505 514
              <tr>
506  
                <th style="width: 7%;">'._('Revision').'</th>
507  
                <th style="width: 10%;">'._('Author').'</th>
508  
                <th style="width: 15%;">'._('Date').'</th>
509  
                <th>'._('Message').'</th>
  515
                <th style="width: 7%;">'.i18n('Revision').'</th>
  516
                <th style="width: 10%;">'.i18n('Author').'</th>
  517
                <th style="width: 15%;">'.i18n('Date').'</th>
  518
                <th>'.i18n('Message').'</th>
510 519
              </tr>
511 520
            </thead>
512 521
            <tbody>';
513 522

                                        

 

Old New Code
26 26
        $this->ct_db = $db;
27 27
    }
28 28

                                        
29  
    function getTimeline($projectid, $_feed_=FALSE)
  29
    function getTimeline($projectid)
30 30
    {
31 31
        $project = getClass('projects.projects', $this->ct_db);
32 32
        $projects = $project->load($projectid);
43 43
        $feeds = array('atom/project/'.$dbname.'/download' => 'download',
44 44
                       'atom/project/'.$dbname.'/bugs'     => 'bugs',
45 45
                       'atom/project/'.$dbname.'/news'     => 'news',
46  
                       'atom/project/'.$dbname.'/doc'      => 'doc'
  46
                       'atom/project/'.$dbname.'/doc'      => 'doc',
  47
                       'atom/project/'.$dbname.'/browse'   => 'browse'
47 48
                      );
48 49

                                        
49 50
        // Fetch all feeds
76 77
                                                                 'text'   => map_str($text, 50),
77 78
                                                                 'type'   => $type
78 79
                                                                ));
79  

                                    
80 80
                }
81 81
            }
82 82
        }
165 165
        }
166 166

                                        
167 167
        // Sort by date
168  
        global $is_feed;
169  
        $is_feed = $_feed_;
170  

                                    
171 168
        function sort_timeline_by_date($a, $b)
172 169
        {
173  
            global $is_feed;
174  

                                    
175 170
            if ($a[0] == $b[0])
176 171
                return 0;
177 172

                                        
178  
            if ($is_feed)
179  
                return ($a[0] < $b[0]) ? -1 : 1;
180  
            else
181  
                return ($a[0] < $b[0]) ? 1 : -1;
  173
            return ($a[0] < $b[0]) ? 1 : -1;
182 174
        }
183 175

                                        
184 176
        usort($timeline, 'sort_timeline_by_date');
185 177

                                        

 

Old New Code
40 40
        if (!$projects)
41 41
            $this->error->displayError('Project not found.', 0);
42 42

                                        
  43
        $this->id = $this->project->getId();
43 44
        $this->name = htmlspecialchars($this->project->getName());
44 45
        $this->dbname = htmlspecialchars($this->project->getDbname());
45 46
        $this->logo = htmlspecialchars($this->project->getLogo());
57 58
        $this->config->update('projects', 'overall-popularity', $new_overall);
58 59

                                        
59 60
        // Meta tags
60  
        $this->metatags = array('title'       => '',
61  
                                'feed'        => '',
62  
                                'description' => '',
63  
                                'keywords'    => ''
64  
                               );
  61
        $this->metatags = array();
65 62

                                        
66 63
        foreach($this->page as $folder)
67 64
            if (mb_strlen($folder) != 0)
76 73

                                        
77 74
    function showFeed()
78 75
    {
  76
        global $baseurl;
  77
        $feed_array['title'] = i18n('%(name)s commits', array('name' => $this->name));
  78
        $feed_array['link'] = $baseurl.'project/'.$this->dbname.'/browse/log';
  79
        $feed_array['description'] = i18n('Latest commits for %(name)s.', array('name' => $this->name));
  80

                                    
  81
        $commits = getClass('projects.commits', $this->ct_db);
  82
        $list = $commits->getLatests($this->id);
  83

                                    
  84
        if (!empty($list))
  85
        {
  86
            for ($i=0; $i<count($list); $i++)
  87
            {
  88
                $feed_array['threads'][$i]['title'] = 'r'.$list[$i]['new_rev'];
  89
                $feed_array['threads'][$i]['pubDate'] = $list[$i]['datetime'];
  90
                $feed_array['threads'][$i]['guid'] = $baseurl.'project/'.$this->dbname.'/browse/diff/'.$list[$i]['prev_rev'].'/'.$list[$i]['new_rev'];
  91
                $feed_array['threads'][$i]['link'] = $baseurl.'project/'.$this->dbname.'/browse/diff/'.$list[$i]['prev_rev'].'/'.$list[$i]['new_rev'];
  92
                $feed_array['threads'][$i]['dc:creator'] = htmlspecialchars($list[$i]['author']);
  93
                $feed_array['threads'][$i]['description'] = htmlspecialchars($list[$i]['log']);
  94
            }
  95
        }
  96

                                    
  97
        return $feed_array;
79 98
    }
80 99

                                        
81 100
    function treatForms()
164 183

                                        
165 184
            case 'log':
166 185
                $this->metatags['title'] = i18n('Log - Browse the code - %(name)s', array('name' => $this->name));
  186
                $this->metatags['feed'] = 'project/'.$this->dbname.'/browse';
167 187
                $base ++;
168 188
                $this->maincontent .= $this->view->log($base, $this, $ar_rep[$this->dbname]);
169 189
                break;
170 190

                                        

 

Old New Code
1243 1243
        }
1244 1244
        elseif (empty($this->page[4]))
1245 1245
        {
1246  
            $bugs_list = $this->project_bugs->getLatestBugs($this->id, 'ORDER BY id DESC LIMIT 5');
  1246
            $bugs_list = $this->project_bugs->getLatestBugs($this->id, 'ORDER BY LOWER(id) DESC LIMIT 5');
1247 1247

                                        
1248 1248
            if ($this->ct_session->isLogged())
1249 1249
                $this->maincontent .= '<p><a href="project/'.$this->dbname.'/bugs/add">'.i18n('» Click here to report a bug on this project.').'</a></p>';
1250 1250

                                        

 

Old New Code
116 116

                                        
117 117
    function showAPI()
118 118
    {
119  
        $return = array();
  119
        global $basedir;
  120
        global $baseurl;
120 121

                                        
121 122
        $available_status = array('planned' => i18n('Planned'),
122 123
                                  'development' => i18n('Development'),
145 146
                array_push($developers_list, $nick);
146 147
        }
147 148

                                        
148  
        $rfcdate = convertDate($this->date, 'datetime', 'rfc');
149  
        $epochdate = date('Y-m-d H:i:s', $timestamp);
  149
        $languages_list = explode(' ', $this->languages);
  150
        for ($i=0; $i<count($languages_list); $i++)
  151
            if (empty($languages_list[$i]))
  152
                unset($languages_list[$i]);
150 153

                                        
151  
        $textview = getClass('textview');
  154
        // Create the OpenForge document
  155
        Header("Content-Type: application/xml; charset=utf-8");
  156
        $xml = new DOMDocument('1.0', 'utf-8');
  157
        $openforge = $xml->createElement('openforge');
  158
        $xml->appendChild($openforge);
152 159

                                        
153  
        $return['unixname'] = $this->dbname;
154  
        $return['title'] = $this->name;
  160
        // Append the forge info
  161
        $forge = $openforge->appendChild($xml->createElement('forge'));
  162
        $forge->appendChild($xml->createElement('name', 'CodingTeam'));
  163
        $forge->appendChild($xml->createElement('url', $baseurl));
  164
        $forge->appendChild($xml->createElement('version', file_get_contents($basedir.'/VERSION')));
  165
        $forge->appendChild($xml->createElement('apiversion', '0.1'));
  166

                                    
  167
        // Append the results sended by the module
  168
        $project = $xml->createElement('project');
  169

                                    
  170
        $project->appendChild($xml->createElement('name', $this->dbname));
  171
        $project->appendChild($xml->createElement('title', $this->name));
  172

                                    
155 173
        if ($version_stable)
156  
            $return['state'] = array('attribute' => array('common' => $version_stable[0]['status']),
157  
                                     'label' => $available_status[$version_stable[0]['status']]);
  174
        {
  175
            $state = $xml->createElement('state', $available_status[$version_stable[0]['status']]);
  176
            $state->setAttribute('common', $version_stable[0]['status']);
  177
            $project->appendChild($state);
  178
        }
158 179
        elseif ($version_overall)
159  
            $return['state'] = array('attribute' => array('common' => $version_overall[0]['status']),
160  
                                     'label' => $available_status[$version_overall[0]['status']]);
161  
        $return['download'] = $this->downloads;
  180
        {
  181
            $state = $xml->createElement('state', $available_status[$version_overall[0]['status']]);
  182
            $state->setAttribute('common', $version_overall[0]['status']);
  183
            $project->appendChild($state);
  184
        }
162 185

                                        
163  
        $return['administrators'] = array('parent' => $administrators_list);
164  
        $return['developers'] = array('parent' => $developers_list);
  186
        $project->appendChild($xml->createElement('downloads', $this->downloads));
165 187

                                        
166  
        $return['date-rfc'] = $rfcdate;
167  
        $return['date'] = $this->date;
168  
        $return['date-epoch'] = $epochdate;
169  
        
170  
        $return['description'] = htmlspecialchars($this->text, $this->allow_nl2br);
  188
        $administrators = $xml->createElement('administrators');
  189
        foreach ($administrators_list as $admin)
  190
            $administrators->appendChild($xml->createElement('administrator', $admin));
  191
        $project->appendChild($administrators);
171 192

                                        
172  
        return $return;
  193
        $developers = $xml->createElement('developers');
  194
        foreach ($developers_list as $admin)
  195
            $developers->appendChild($xml->createElement('developer', $admin));
  196
        $project->appendChild($developers);
  197

                                    
  198
        $project->appendChild($xml->createElement('date', convertDate($this->date, 'datetime', 'rfc')));
  199

                                    
  200
        $project->appendChild($xml->createElement('description', nl2br($this->text)));
  201

                                    
  202

                                    
  203
        $infos = $xml->createElement('info');
  204

                                    
  205
        $licenses = $xml->createElement('licenses');
  206
        $license = $xml->createElement('license', $this->datas_license[$this->license]);
  207
        $license->setAttribute('common', $this->license);
  208
        $licenses->appendChild($license);
  209
        $infos->appendChild($licenses);
  210

                                    
  211
        $languages = $xml->createElement('languages');
  212
        foreach ($languages_list as $lang)
  213
        {
  214
            $language = $xml->createElement('language', $this->datas_language[$lang]);
  215
            $language->setAttribute('common', $lang);
  216
            $languages->appendChild($language);
  217
        }
  218
        $infos->appendChild($languages);
  219

                                    
  220
        $project->appendChild($infos);
  221

                                    
  222

                                    
  223
        $urls = $xml->createElement('url');
  224
        $urls->appendChild($xml->createElement('home', $baseurl.'project/'.$this->dbname));
  225
        $urls->appendChild($xml->createElement('download', $baseurl.'project/'.$this->dbname.'/download'));
  226
        $urls->appendChild($xml->createElement('screenshot', $baseurl.'project/'.$this->dbname.'/screenshots'));
  227
        $project->appendChild($urls);
  228

                                    
  229

                                    
  230
        $openforge->appendChild($project);
  231

                                    
  232
        // Show the result
  233
        $xml->formatOutput = TRUE;
  234
        echo $xml->saveXML();
173 235
    }
174 236

                                        
175 237
    function showFeed()
176 238

                                        

 

Old New Code
165 165
                    if (!is_scalar($value))
166 166
                        exit('Error.');
167 167

                                        
168  
                if (count($_POST) >= 4 && isset($_POST['edit']))
  168
                if (isset($_POST['delete']))
169 169
                {
  170
                    $downid = $this->ct_db->cleanentry($_POST['downid'], TRUE);
  171

                                    
  172
                    $down = $this->project_downloads->load($downid);
  173
                    if (!$down)
  174
                        $this->error->displayError(i18n('Download not found.'), 0);
  175

                                    
  176
                    if ($this->project_downloads->getProjectid() != $this->id)
  177
                        $this->error->displayError(i18n('You cannot edit or delete a download that are not yours.'), 0);
  178

                                    
  179
                    global $basedir;
  180
                    $file = $basedir.'/public/upload/projects/'.$this->dbname.'/'.$this->project_downloads->getFile();
  181
        
  182
                    if (file_exists($file) && is_file($file))
  183
                        unlink($file);
  184

                                    
  185
                    $new = $this->project->getDownloads() - $this->project_downloads->getDownloads();
  186
                    $this->project->setDownloads($new);
  187

                                    
  188
                    $this->project_downloads->deleteDownload();
  189

                                    
  190
                    global $baseurl;
  191
                    Header('Location: '.$baseurl.'project/'.$this->dbname.'/download');
  192
                    exit();
  193
                }
  194
                elseif (count($_POST) >= 4 && isset($_POST['edit']))
  195
                {
170 196
                    $this->form_filename = $this->ct_db->cleanentry($_POST['filename'], TRUE);
171 197
                    $this->form_description = $this->ct_db->cleanentry($_POST['description'], TRUE);
172 198
                    $this->form_version = $this->ct_db->cleanentry($_POST['version'], TRUE);
349 375
                    if ($this->projectid != $this->id)
350 376
                        $this->error->displayError(i18n('You cannot edit or delete a download that are not yours.'), 0);
351 377

                                        
352  
                    if (!empty($this->page[6]) && $this->page[6] == 'delete')
353  
                    {
354  
                        global $basedir;
355  
                        $file = $basedir.'/public/upload/projects/'.$this->dbname.'/'.$this->project_downloads->getFile();
356  
        
357  
                        if (file_exists($file) && is_file($file))
358  
                            unlink($file);
359  

                                    
360  
                        $new = $this->project->getDownloads() - $this->project_downloads->getDownloads();
361  
                        $this->project->setDownloads($new);
362  

                                    
363  
                        $this->project_downloads->deleteDownload();
364  

                                    
365  
                        global $baseurl;
366  
                        Header('Location: '.$baseurl.'project/'.$this->dbname.'/download');
367  
                        exit();
368  
                    }
369  

                                    
370 378
                    $name = htmlspecialchars($this->project_downloads->getName());
371 379
                    $text = htmlspecialchars($this->project_downloads->getText());
372 380
                    $version = htmlspecialchars($this->project_downloads->getVersion());
412 420
                        <input style="width: 200px;" class="submit" type="submit" value="'.i18n('Edit this file').'" /></p></form></div>
413 421
                            
414 422
                        <div class="adminbox"><h3>'.i18n('Delete %(name)s', array('name' => $name)).'</h3>
415  
                        '.i18n('You can delete this download but you will loose downloads number and uploaded files! If you are sure of what you are doing, %(link)s to delete this download.',
416  
                               array('link' => '<a href="project/'.$this->dbname.'/download/edit/'.$this->page[5].'/delete">'.i18n('click here').'</a>')).'
  423
                        '.i18n('You can delete this download but you will loose downloads number and uploaded files!').'
  424
                          <form action="'.getURLbyTags($this->page).'" method="post">
  425
                            <p>
  426
                              <input type="hidden" name="downid" value="'.$this->page[5].'" />
  427

                                    
  428
                              <input type="submit" name="delete" value="'.i18n('Delete').'" onclick="javascript: return confirm(\''.i18n('Do you really want to delete this donwload?').'\');" />
  429
                            </p>
  430
                          </form>
417 431
                        </div>';
418 432
                    }
419 433
                }
420 434

                                        

 

Old New Code
64 64
        $this->project_versions = getClass('project.versions', $this->ct_db);
65 65
        $this->project_forum = getClass('project.forum', $this->ct_db);
66 66

                                        
67  
        // Delete a topic
68  
        if (!empty($this->page[4]) && ( $this->page[4] == 'delete' || $this->page[4] == 'toggleclose' ) && !empty($this->page[5]))
69  
        {
70  
            if ($this->ct_session->isLogged() && $this->page[4] != 'edit')
71  
                if (is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
72  
                {
73  
                    if ($this->page[4] == 'delete')
74  
                    {
75  
                        if ($this->page[5] == 'topic')
76  
                            $this->project_forum->deleteTopic($this->id, $this->page[6]);
77  
                        elseif ($this->page[5] == 'answer')
78  
                        {
79  
                            $this->project_forum->deleteAnswer($this->page[7], $this->page[6]);
80  

                                    
81  
                            if (!$this->project_forum->load($this->page[6]))
82  
                                $this->error->displayError(i18n('Post not found.'), 0);
83  

                                    
84  
                            if ($this->id != $this->project_forum->getProjectid())
85  
                                exit('Error.');
86  

                                    
87  
                            $answers = $this->project_forum->getAnswers(); 
88  
                            $this->project_forum->setAnswers($answers - 1);
89  
                        }
90  

                                    
91  
                        $id = $this->page[6];
92  
                    }
93  
                    elseif ($this->page[4] == 'toggleclose')
94  
                    {
95  
                        $this->project_forum->toggleClose($this->id, $this->page[5]);
96  
                        $id = $this->page[5];
97  
                    }
98  

                                    
99  
                    global $baseurl;
100  
                    Header('Location: '.$baseurl.'project/'.$this->dbname.'/forum/show/'.$id);
101  
                    exit();
102  
                }
103  
                else
104  
                    exit('Error.');
105  
            else
106  
                exit('Error.');
107  
        }
108  

                                    
109 67
        // Categories
110 68
        $this->categories = array('help' => i18n('Help'),
111 69
                                  'developement' => i18n('Developement'),
167 125
                if (!$this->project_forum->getIs_open())
168 126
                    $this->error->displayError(i18n('Topic is closed.'), 0);
169 127

                                        
170  
                if (!$this->ct_session->isLogged() && $_SESSION['id'] != $this->project_forum->getRegistered_id() || !is_level($_SESSION['id'], 'administrator', $this->ct_db) || !is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
  128
                if (!$this->ct_session->isLogged())
171 129
                    exit('Error.');
172 130

                                        
  131
                if ( !($_SESSION['id'] == $this->project_forum->getRegistered_id()) &&
  132
                     !is_level($_SESSION['id'], 'administrator', $this->ct_db) &&
  133
                     !is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
  134
                    exit('Error.');
  135

                                    
173 136
                $this->post_title = $this->project_forum->getTitle();
174 137
                $this->post_text = $this->project_forum->getText();
175 138
                $this->post_cat = $this->project_forum->getCategory();
200 163

                                        
201 164
                $this->post_text = $answer['text'];
202 165

                                        
203  
                if (!$this->ct_session->isLogged() && $_SESSION['id'] != $answer['authorid'] || !is_level($_SESSION['id'], 'administrator', $this->ct_db) || !is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
  166
                if (!$this->ct_session->isLogged())
204 167
                    exit('Error.');
205 168

                                        
  169
                if ( !($_SESSION['id'] == $answer['authorid']) &&
  170
                     !is_level($_SESSION['id'], 'administrator', $this->ct_db) &&
  171
                     !is_affiliation($_SESSION['id'], $this->project->getId(), $this->ct_db)
  172
                   )
  173
                    exit('Error.');
  174

                                    
206 175
                $title = i18n('Edit a reply - Forum - %(name)s', array('name' => $this->name));
207 176
            }
208 177
            else
265 234
            if (!is_scalar($value))
266 235
                exit('Error.');
267 236

                                        
268  
        if (count($_POST) >= 2 && $this->page[4] == 'add')
  237
        if ($this->page[4] == 'show' && (isset($_POST['delete']) || isset($_POST['deleteanswer']) || isset($_POST['toggleclose'])))
269 238
        {
  239
            if ($this->ct_session->isLogged())
  240
                if (is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
  241
                {
  242
                    $post_id = $this->ct_db->cleanentry($_POST['postid'], FALSE);
  243

                                    
  244
                    if (isset($_POST['delete']))
  245
                        $this->project_forum->deleteTopic($this->id, $post_id);
  246
                    elseif (isset($_POST['deleteanswer']))
  247
                    {
  248
                        $post_pid = $this->ct_db->cleanentry($_POST['parentpostid'], FALSE);
  249

                                    
  250
                        if (!$this->project_forum->load($post_pid))
  251
                            $this->error->displayError(i18n('Post not found.'), 0);
  252

                                    
  253
                        if ($this->id != $this->project_forum->getProjectid())
  254
                            exit('Error.');
  255

                                    
  256
                        $this->project_forum->deleteAnswer($post_id, $post_pid);
  257

                                    
  258
                        $answers = $this->project_forum->getAnswers(); 
  259
                        $this->project_forum->setAnswers($answers - 1);
  260
                        
  261
                        $post_id = $post_pid;
  262
                    }
  263
                    elseif (isset($_POST['toggleclose']))
  264
                    {
  265
                        $this->project_forum->toggleClose($this->id, $post_id);
  266
                    }
  267

                                    
  268
                    global $baseurl;
  269
                    Header('Location: '.$baseurl.'project/'.$this->dbname.'/forum/show/'.$post_id);
  270
                    exit();
  271
                }
  272
        }
  273
        elseif (count($_POST) >= 2 && $this->page[4] == 'add')
  274
        {
270 275
            $this->form_text = $this->ct_db->cleanentry($_POST['text'], FALSE);
271 276
            $this->form_title = $this->ct_db->cleanentry($_POST['title'], TRUE);
272 277

                                        
638 643

                                        
639 644
            if ($this->ct_session->isLogged() && $this->page[4] != 'edit')
640 645
                if (is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
641  
                    $this->maincontent .= ' - <a href="project/'.$this->dbname.'/forum/delete/topic/'.$this->post_id.'">'.i18n('Delete this topic').'</a>
642  
                    - <a href="project/'.$this->dbname.'/forum/toggleclose/'.$this->post_id.'">'.i18n('Open/Close this topic').'</a>';
  646
                    $this->maincontent .= '
  647
                    <form action="'.getURLbyTags($this->page).'" method="post">
  648
                      <p>
  649
                        <input type="hidden" name="postid" value="'.$this->post_id.'" />
643 650

                                        
  651
                        <input type="submit" name="delete" value="'.i18n('Delete this topic').'" onclick="javascript: return confirm(\''.i18n('Do you really want to delete this topic?').'\');" />
  652
                        <input type="submit" name="toggleclose" value="'.i18n('Open/Close this topic').'" />
  653
                      </p>
  654
                    </form>';
  655

                                    
644 656
            $this->maincontent .= '</div>
645 657
            <h2><a href="project/'.$this->dbname.'/forum/category/'.$this->post_cat.'">'.$this->categories[$this->post_cat].'</a> » <a href="project/'.$this->dbname.'/forum/show/'.$this->post_id.'" style="';
646 658

                                        
691 703
                  .show_user_infos($answer['unregistered_nick'], $answer['registered_id'], $this->ct_db, $this->lang).
692 704
                  '<br /><br /><em>'.i18n('Posted on %(date)s.', array('date' => i18nDate($answer['datetime'], $this->lang))).'</em>';
693 705

                                        
694  
                if ($this->ct_session->isLogged() && ( $_SESSION['id'] == $this->answer['registered_id'] || is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db) ))
  706
                if ($this->ct_session->isLogged() && ( $_SESSION['id'] == $answer['registered_id'] || is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db) ))
695 707
                {
696 708
                    $this->maincontent .= '<br />
697 709
                    <ul style="margin-top: 10px;">
698  
                      <li><a href="project/'.$this->dbname.'/forum/answer/'.$this->post_id.'/'.$answer['id'].'">'.i18n('Edit').'</a></li>';
  710
                      <li><a href="project/'.$this->dbname.'/forum/answer/'.$this->post_id.'/'.$answer['id'].'">'.i18n('Edit').'</a></li>
  711
                    </ul>';
699 712

                                        
700 713
                    if (is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
701  
                        $this->maincontent .= '<li><a href="project/'.$this->dbname.'/forum/delete/answer/'.$this->post_id.'/'.$answer['id'].'">'.i18n('Delete').'</a></li>';
  714
                        $this->maincontent .= '
  715
                        <form action="'.getURLbyTags($this->page).'" method="post">
  716
                          <p>
  717
                            <input type="hidden" name="parentpostid" value="'.$this->post_id.'" />
  718
                            <input type="hidden" name="postid" value="'.$answer['id'].'" />
702 719

                                        
703  
                    $this->maincontent .= '</ul>';
  720
                            <input type="submit" name="deleteanswer" value="'.i18n('Delete').'" onclick="javascript: return confirm(\''.i18n('Do you really want to delete this answer?').'\');" />;
  721
                          </p>
  722
                        </form>';
704 723
                }
705 724

                                        
706 725
                $this->maincontent .= '</td>
707  
                  <td style="padding: 5px;vertical-align: top;overflow: auto;display: block;">'.$textview->prepare($answer['text'], $answer['allow_nl2br']).'</td>
  726
                  <td style="padding: 5px;vertical-align: top;max-width: 500px;overflow: auto;">'.$textview->prepare($answer['text'], $answer['allow_nl2br']).'</td>
708 727
                 </tr>            
709 728
                </table>';
710 729
            }
711 730

                                        

 

Old New Code
170 170

                                        
171 171
        if (!empty($list[1]))
172 172
        {
173  
            for ($i=0; $i<count($list); $i++)
  173
            for ($i=0; $i<count($list[1]); $i++)
174 174
            {
175 175
                global $basedir;
176 176
                require_once($basedir.'/inc/classes/textview.php');    
178 178
                $text = $textview->prepare($list[1][$i]['text']);
179 179

                                        
180 180
                $user = getUser($list[1][$i]['authorid'], $this->ct_db);
181  
                $nick = htmlspecialchars($user->getNickname());
182 181

                                        
183 182
                $feed_array['threads'][$i]['title'] = htmlspecialchars($list[1][$i]['title']);
184 183
                $feed_array['threads'][$i]['pubDate'] = $list[1][$i]['datetime'];
185 184
                $feed_array['threads'][$i]['guid'] = $baseurl.'project/'.$this->dbname.'/news/show/'.$list[1][$i]['id'].'-'.htmlspecialchars($list[1][$i]['link']);
186 185
                $feed_array['threads'][$i]['link'] = $baseurl.'project/'.$this->dbname.'/news/show/'.$list[1][$i]['id'].'-'.htmlspecialchars($list[1][$i]['link']);
187  
                $feed_array['threads'][$i]['dc:creator'] = $nick;
  186
                $feed_array['threads'][$i]['dc:creator'] = htmlspecialchars($user->getNickname());
188 187
                $feed_array['threads'][$i]['description'] = htmlspecialchars($text);
189 188
            }
190 189
        }
335 334
            $this->maincontent .= i18n('Written by %(nick)s on %(date)s',
336 335
                                       array('nick' => '<a href="users/show/'.$nick.'">'.$nick.'</a>',
337 336
                                             'date' => i18nDate($this->news_datetime, $this->lang)
338  
                                      )).'- <strong>'.i18n('%(n)d seens', array('n' => $this->news_nbseen)).'</strong></div>';
  337
                                      )).' - <strong>'.i18n('%(n)d seens', array('n' => $this->news_nbseen)).'</strong></div>';
339 338
        }
340 339
        elseif (empty($this->page[4]) || is_numeric($this->page[4]))
341 340
        {
342 341

                                        

 

Old New Code
228 228

                                        
229 229
        }
230 230
        else
231  
            $this->maincontent .= '<em>'.i18n('This project has no version. You could browse screenshots!').'</em>';
  231
            $this->maincontent .= '<em>'.i18n('This project has no version. You could not browse screenshots!').'</em>';
232 232

                                        
233 233
        if ($this->ct_session->isLogged())
234 234
            if (is_level($_SESSION['id'], 'administrator', $this->ct_db) || is_affiliation($_SESSION['id'], $this->id, $this->ct_db))
235 235

                                        

 

Old New Code
75 75
                                'description' => '',
76 76
                                'keywords'    => ''
77 77
                               );
  78

                                    
  79
        $this->project_versions = getClass('project.versions', $this->ct_db);
78 80
    }
79 81

                                        
80 82
    function showFeed()
87 89

                                        
88 90
    function showPage()
89 91
    {
  92
        $versions = $this->project_versions->getVersions($this->id);
90 93
        $this->maincontent .= '<h1>'.i18n('Statistics').'</h1>
91 94
        
92  
        <h2>'.i18n('Tracker activity').'</h2>
  95
        <h2>'.i18n('Tracker').'</h2>
93 96

                                        
94  
        <div class="statistic">
95  
          <div style="position: absolute;margin-left: 500px;">
96  
            <p>
97  
              <strong>'.i18n('Summary of bugs reported and still open bugs.').'</strong>
98  
            </p>
99  
          </div>
  97
       <object data="svg/project/'.$this->dbname.'/bugs" width="450" height="270" type="image/svg+xml" class="chart"></object>
  98
       <p>'.i18n('This chart show reported bugs and open bugs for each version registered by the project.').'</p>
  99
       <ul>
  100
         <li><a href="svg/project/'.$this->dbname.'/bugs"><strong>'.i18n('View and download the SVG').'</strong></a></li>
  101
         <li><a href="project/'.$this->dbname.'/roadmap">'.i18n('Go to the Roadmap').'</a></li>
  102
       </ul>
100 103

                                        
101  
          <p class="export"><a href="svg/project/'.$this->dbname.'/bugs">
102  
             <span style="background-image: url(\'public/images/icons/actions/document-save.png\');" class="button">
103  
             '.i18n('Export this XML/SVG').'</span></a>
  104
        <p style="clear: left;height: 20px;">&nbsp;</p>
104 105

                                        
105  
             <a href="inc/templates/svg-graphics.css">
106  
             <span style="background-image: url(\'public/images/icons/actions/go-bottom.png\');" class="button">
107  
             '.i18n('Get the stylesheet').'</span></a>
108  
          </p>
  106
        <h2>'.i18n('Contributors').'</h2>
109 107

                                        
110  
          <object data="svg/project/'.$this->dbname.'/bugs" width="450" height="250" type="image/svg+xml"></object>
111  
        </div>';
  108
       <object data="svg/project/'.$this->dbname.'/contributors" width="450" height="270" type="image/svg+xml" class="chart"></object>;
  109
       <p>'.i18n('A list of contributors with the number of commits they did.').'</p>
  110
       <ul>
  111
         <li><a href="svg/project/'.$this->dbname.'/contributors"><strong>'.i18n('View and download the SVG').'</strong></a></li>
  112
         <li><a href="project/'.$this->dbname.'/browse">'.i18n('Go to code browsing').'</a></li>
  113
       </ul>
112 114

                                        
  115
        <p style="clear: left;height: 20px;">&nbsp;</p>
113 116

                                        
  117
        <h2>'.i18n('History').'</h2>
114 118

                                        
  119
       <object data="svg/project/'.$this->dbname.'/history" width="450" height="270" type="image/svg+xml" class="chart"></object>
  120
       <p>'.i18n('The list of months, with the evolution of commits number.').'</p>
  121
       <ul>
  122
         <li><a href="svg/project/'.$this->dbname.'/history"><strong>'.i18n('View and download the SVG').'</strong></a></li>
  123
         <li><a href="project/'.$this->dbname.'/browse">'.i18n('Go to code browsing').'</a></li>
  124
       </ul>';
115 125

                                        
116  

                                    
117  

                                    
118  

                                    
119  

                                    
120  

                                    
121  

                                    
122  

                                    
123  

                                    
124  

                                    
125  

                                    
126  

                                    
127  

                                    
128  

                                    
129  

                                    
130  

                                    
131 126
        return $this->maincontent;
132 127
    }
133 128
}
134 129

                                        

 

Old New Code
87 87
        global $baseurl;
88 88

                                        
89 89
        // Get a timeline
90  
        $timeline = $this->project_timeline->getTimeline($this->id, TRUE);
  90
        $timeline = $this->project_timeline->getTimeline($this->id);
91 91

                                        
92 92
        $feed_array['title'] = i18n('%(name)s timeline', array('name' => $this->name));
93 93
        $feed_array['link'] = 'project/'.$this->dbname.'/timeline';
94 94
        $feed_array['description'] = i18n('Latest events for %(name)s.', array('name' => $this->name));
  95
        $feed_array['threads'] = array();
95 96

                                        
96 97
        foreach ($timeline as $date_)
97 98
        {
98 99
            $date = $date_[0];
99 100

                                        
100 101
            $i = 0;
101  
            $a = 0;
102 102
            foreach ($date_ as $item)
103 103
            {
104 104
                if (isset($item['title']) && $i > 0)
105  
                {
106  
                    $feed_array['threads'][$a]['title'] = htmlspecialchars($item['title']);
107  
                    $feed_array['threads'][$a]['pubDate'] = $date.' '.$item['time'];
108  
                    $feed_array['threads'][$a]['guid'] = htmlspecialchars($item['link']);
109  
                    $feed_array['threads'][$a]['link'] = htmlspecialchars($item['link']);
110  
                    $feed_array['threads'][$a]['dc:creator'] = htmlspecialchars($item['author']);
111  
                    $feed_array['threads'][$a]['description'] = htmlspecialchars($item['text']);
  105
                    array_push($feed_array['threads'], array('title' => htmlspecialchars($item['title']),
  106
                                                             'pubDate' => $date.' '.$item['time'],
  107
                                                             'guid' => htmlspecialchars($item['link']),
  108
                                                             'link' => htmlspecialchars($item['link']),
  109
                                                             'dc:creator' => htmlspecialchars($item['author']),
  110
                                                             'description' => htmlspecialchars($item['text'])
  111
                                                            ));
112 112

                                        
113  
                    $a ++;
114  
                }
115  

                                    
116 113
                $i ++;
117 114
            }
118  

                                    
119  
            $this->maincontent .= '</ul>';
120 115
        }
121 116

                                        
  117
        // Only 5 newer
  118
        $final_feed_array = array();
  119
        for ($i=0; $i<5; $i++)
  120
            array_push($final_feed_array, $feed_array['threads'][$i]);
  121

                                    
  122
        $feed_array['threads'] = $final_feed_array;
122 123
        return $feed_array;
123 124
    }
124 125

                                        
140 141
        $types = array('download' => i18n('downloads'),
141 142
                       'bugs'     => i18n('bugs'),
142 143
                       'news'     => i18n('news'),
143  
                       'doc'      => i18n('documentation')
  144
                       'doc'      => i18n('documentation'),
  145
                       'browse'   => i18n('source code')
144 146
                      );
145 147

                                        
146 148
        // Get a timeline
147 149

                                        

 

Old New Code
43 43

                                        
44 44
        if ($views['default'] == 'TRUE')
45 45
            $this->pagemenu .= '<li '.( (!isset($this->page[2])) ?
46  
                               'class="current"><a href="projects"><img src="public/images/icons/stock/form/stock_form-time-field.png" style="float: left;padding-right: 5px;" />' :
  46
                               'class="current"><a href="projects"><img src="public/images/icons/stock/form/stock_form-time-field.png" style="float: left;padding-right: 5px;" alt="time" />' :
47 47
                               '><a href="projects">' ).i18n('Latest projects').'</a></li>';
48 48

                                        
49 49
        if ($views['browse'] == 'TRUE')
50 50
        {
51 51
            $this->pagemenu .= '<li '.( ($this->page[2] == 'browse') ?
52  
                               'class="current"><a href="projects/browse"><img src="public/images/icons/actions/edit-find.png" style="float: left;padding-right: 5px;" />' :
  52
                               'class="current"><a href="projects/browse"><img src="public/images/icons/actions/edit-find.png" style="float: left;padding-right: 5px;" alt="find" />' :
53 53
                               '><a href="projects/browse">' ).i18n('Browse all projects').' <img src="public/images/dropdown.png" alt="dropdown" /></a>
54 54
            <ul class="submenu">
55 55

                                        
102 102

                                        
103 103
        if ($views['tags'] == 'TRUE')
104 104
            $this->pagemenu .= '<li '.( ($this->page[2] == 'tags') ?
105  
                               'class="current"><a href="projects/tags"><img src="public/images/icons/status/weather-overcast.png" style="float: left;padding-right: 5px;" />' :
  105
                               'class="current"><a href="projects/tags"><img src="public/images/icons/status/weather-overcast.png" style="float: left;padding-right: 5px;" alt="tags" />' :
106 106
                               '><a href="projects/tags">' ).i18n('Tags cloud').'</a></li>';
107 107

                                        
108 108
        if ($views['add'] == 'TRUE')
109 109
            $this->pagemenu .= '<li '.( ($this->page[2] == 'add') ?
110  
                               'class="current"><a href="projects/add"><img src="public/images/icons/actions/list-add.png" style="float: left;padding-right: 5px;" />' :
  110
                               'class="current"><a href="projects/add"><img src="public/images/icons/actions/list-add.png" style="float: left;padding-right: 5px;" alt="add" />' :
111 111
                               '><a href="projects/add">' ).i18n('Add a project').'</a></li>';         
112 112

                                        
113 113
        $this->pagemenu .= '</ul>
114 114

                                        

 

Old New Code
31 31

                                        
32 32
    function getProjectsByWhere($where, $orderby, $page, $limit, $rule, $listby)
33 33
    {
34  
        if (in_array($listby, array('language', 'translation', 'system')))
  34
        if ($listby == 'all')
35 35
        {
36  
            $req0 = $this->db->like('projects', $where, 'id');
37  
            $req1 = $this->db->like('projects', $where, '*', 'ORDER BY LOWER('.$orderby.') '.$rule.' '.$limit);
38  
        }
39  
        elseif ($listby == 'all')
40  
        {
41 36
            $req0 = $this->db->select('projects', FALSE, 'id');
42 37
            $req1 = $this->db->select('projects', FALSE, '*', 'ORDER BY LOWER('.$orderby.') '.$rule.' '.$limit);
43 38
        }
52 47

                                        
53 48
    function getProjectsByTag($tag, $orderby, $page, $limit, $rule)
54 49
    {
55  
        $req0 = $this->db->like('projects', array('tags' => $tag.' ', 'is_valid' => TRUE), 'id');
56  
        $req1 = $this->db->like('projects', array('tags' => $tag.' ', 'is_valid' => TRUE), '*', 'ORDER BY LOWER('.$orderby.') '.$rule.' '.$limit);
  50
        $req0 = $this->db->select('projects', array('tags' => array($tag.' ', 'LIKE'), 'is_valid' => TRUE), 'id');
  51
        $req1 = $this->db->select('projects', array('tags' => array($tag.' ', 'LIKE'), 'is_valid' => TRUE), '*', 'ORDER BY LOWER('.$orderby.') '.$rule.' '.$limit);
57 52

                                        
58 53
        return array(count($req0), $req1);
59 54
    }
80 75

                                        
81 76
        foreach ($newtags as $key => $value)
82 77
        {
83  
            $number = $this->db->like('projects', array('tags' => $value.' ', 'is_valid' => TRUE), 'tags');
  78
            $number = $this->db->select('projects', array('tags' => array($value.' ', 'LIKE'), 'is_valid' => TRUE), 'tags');
84 79
            $tags_final[$value] = count($number);
85 80
        }
86 81

                                        
220 215
    function deleteProject()
221 216
    {
222 217
        if (isset($this->id))
  218
        {
223 219
            $this->db->delete('projects', array('id' => $this->id));
  220
            $this->unload();
  221
        }
224 222
    }
225 223

                                        
226 224
    function updateField($field, $value)
227 225

                                        

 

Old New Code
291 291
            {
292 292
                if ($this->action == 'add')
293 293
                {
294  
                    $projectneedvalidate = $this->config->get('projects', 'needvalidate');
  294
                    $projectneedvalidate = $this->config->get('projects', 'need-validate');
295 295
                
296 296
                    if ($projectneedvalidate)
297 297
                    {
298 298

                                        

 

Old New Code
65 65
                else
66 66
                {
67 67
                    $this->header = i18n('Browsing <strong>%d</strong> projects filed in <strong>%(category)s</strong>.', array('category' => $categories[$this->keyword]));
68  
                    $title = i18n('Browsing projects filed under %(category)s.', array('category' => $categories[$this->keyword]));
  68
                    $title = i18n('Browsing projects filed under %(category)s', array('category' => $categories[$this->keyword]));
69 69
                }
70 70
                break;
71 71
            
75 75
                else
76 76
                {
77 77
                    $this->header = i18n('Browsing <strong>%d</strong> projects published under <strong>%(license)s</strong>.', array('license' => $licenses[$this->keyword]));
78  
                    $title = i18n('Browsing projects published under %(license)s.', array('license' => $licenses[$this->keyword]));
  78
                    $title = i18n('Browsing projects published under %(license)s', array('license' => $licenses[$this->keyword]));
79 79
                }
80 80
                break;
81 81

                                        
85 85
                else
86 86
                {
87 87
                    $this->header = i18n('Browsing <strong>%d</strong> projects programmed with <strong>%(language)s</strong>.', array('language' => $language[$this->keyword]));
88  
                    $title = i18n('Browsing projects programmed with %(language)s.', array('language' => $language[$this->keyword]));
  88
                    $title = i18n('Browsing projects programmed with %(language)s', array('language' => $language[$this->keyword]));
89 89
                }
90 90
                break;
91 91

                                        
95 95
                else
96 96
                {
97 97
                    $this->header = i18n('Browsing <strong>%d</strong> projects available in <strong>%(i18n)s</strong>.', array('i18n' => $i18n[$this->keyword]));
98  
                    $title = i18n('Browsing projects available in %(i18n)s.', array('i18n' => $i18n[$this->keyword]));
  98
                    $title = i18n('Browsing projects available in %(i18n)s', array('i18n' => $i18n[$this->keyword]));
99 99
                }
100 100
                break;
101 101

                                        
105 105
                else
106 106
                {
107 107
                    $this->header = i18n('Browsing <strong>%d</strong> projects available under <strong>%(platform)s</strong>.', array('platform' => $platformslist[$this->keyword]));
108  
                    $title = i18n('Browsing projects available under %(platform)s.', array('platform' => $platformslist[$this->keyword]));
  108
                    $title = i18n('Browsing projects available under %(platform)s', array('platform' => $platformslist[$this->keyword]));
109 109
                }
110 110
                break;
111 111
            }
122 122
        {
123 123
            $this->listby = 'all';
124 124
            $this->header = i18n('Browsing <strong>%s</strong> projects.');
125  
            $title = i18n('Browsing projects.');
  125
            $title = i18n('Browsing projects');
126 126

                                        
127 127
            $this->checkone = $this->page[3];
128 128
            $this->checktwo = $this->page[4];
189 189

                                        
190 190
            list($orderby, $rule) = explode(':', $order);
191 191

                                        
192  
            $projects_list = $projects->getProjectsByWhere(array($field => $this->keyword, 'is_valid' => TRUE), $orderby, $page, 'LIMIT '.$start.','.$max, strtoupper($rule), $this->listby);
  192
            if (in_array($this->listby, array('language', 'translation', 'system')))
  193
                $where = array($field => array($this->keyword, 'LIKE'), 'is_valid' => TRUE);
  194
            else
  195
                $where = array($field => $this->keyword, 'is_valid' => TRUE);
193 196

                                        
  197
            $projects_list = $projects->getProjectsByWhere($where, $orderby, $page, 'LIMIT '.$start.','.$max, strtoupper($rule), $this->listby);
  198

                                    
194 199
            if ($this->listby != 'all')
195 200
                $link = '/'.$this->listby.'/'.$this->keyword.'/';
196 201
            else
313 318
                                              'stable' => i18n('Stable'),
314 319
                                              'abandonned' => i18n('Abandonned')
315 320
                                             );
316  
    
  321

                                    
317 322
                    global $basedir;
318 323
                    require($basedir.'/inc/data/categories.php');
319 324
                    $file = 'public/upload/projects/'.$dbname.'/'.$logo;
345 350
                        $this->maincontent .= ' class="current-td center"';
346 351
                    else
347 352
                        $this->maincontent .= ' style="background: #f0f0f0;" class="center"';
348  
                    $this->maincontent .= '><strong>'.(int)($popularity / $overall * 100).'%</strong></td>
  353
                    $this->maincontent .= '><strong>'.(($overall > 0) ? number_format(($popularity / $overall * 100), 2) : 0 ).'%</strong></td>
349 354
                    <td';
350 355
                    if ($orderby == 'downloads')            
351 356
                        $this->maincontent .= ' class="current-td center"';
352 357

                                        

 

Old New Code
156 156

                                        
157 157
                <td style="background: #f0f0f0;"><a href="project/'.$dbname.'"><strong>'.$name.'</strong></a></td>
158 158
                <td style="background: #f0f0f0;" class="center">'.i18nDate($date, $this->lang).'</td>
159  
                <td style="background: #f0f0f0;" class="center"><strong>'.(int)($popularity / $overall * 100).'%</strong></td>
  159
                <td style="background: #f0f0f0;" class="center"><strong>'.(($overall > 0) ? number_format(($popularity / $overall * 100), 2) : 0 ).'%</strong></td>
160 160
                <td style="background: #f0f0f0;" class="center"><strong>'.$downloads.'</strong></td>
161 161
                </tr>
162 162
                <tr>
163 163

                                        

 

Old New Code
246 246
                        $logourl = $logo;
247 247

                                        
248 248
                    $this->maincontent .= '<tr>
249  
                    <td class="center" rowspan="2" style="width: 45px;"><img src="'.$logourl.'" alt="'.$dbname.'" style="width: 42px;height: 42px;" /></td>
  249
                    <td class="center" style="width: 45px;" rowspan="2"><img src="'.$logourl.'" alt="'.$dbname.'" style="width: 42px;height: 42px;" /></td>
250 250

                                        
251 251
                    <td';
252 252
                    if ($orderby == 'name')            
253  
                        $this->maincontent .= ' class="current-td" style="width: 33%;"';
  253
                        $this->maincontent .= ' class="current-td"';
254 254
                    else
255  
                        $this->maincontent .= ' style="background: #f0f0f0;width: 33%;"';
  255
                        $this->maincontent .= ' style="background: #f0f0f0;"';
256 256
                    $this->maincontent .= '><a href="project/'.$dbname.'"><strong>'.map_str($name, 20).'</strong></a></td>
257 257
                    <td';
258 258
                    if ($orderby == 'date')            
265 265
                        $this->maincontent .= ' class="current-td center"';
266 266
                    else
267 267
                        $this->maincontent .= ' style="background: #f0f0f0;" class="center"';
268  
                    $this->maincontent .= '><strong>'.(int)($popularity / $overall * 100).'%</strong></td>
  268
                    $this->maincontent .= '><strong>'.(($overall > 0) ? number_format(($popularity / $overall * 100), 2) : 0 ).'%</strong></td>
269 269
                    <td';
270 270
                    if ($orderby == 'downloads')            
271 271
                        $this->maincontent .= ' class="current-td center"';
272 272

                                        

 

Old New Code
44 44
        // Available criterias
45 45
        $this->as_array = array('name' => i18n('Name/Title'),
46 46
                                'author' => i18n('Author'),
47  
                                'date' => i18n('Date'),
  47
                                'date' => i18n('Date <em>(Y-m-d H:i:s)</em>'),
48 48
                                'content' => i18n('Content')
49 49
                               );
50 50

                                        
51 51
        $this->in_array = array('projects' => i18n('Projects'),
52 52
                                'projects-bugs' => i18n('Bugs'),
53 53
                                'projects-doc' => i18n('Documentation'),
54  
                                'projects-downloads' => i18n('Downloads'),
55 54
                                'projects-forum' => i18n('Forum'),
56 55
                                'projects-news' => i18n('News'),
57  
                                'projects-screenshots' => i18n('Screenshots'),
58  
                                'projects-todo' => i18n('Todo list'),
59  
                                'notepad' => i18n('Notepad'),
60 56
                                'users' => i18n('Users')
61 57
                                );
62 58

                                        
78 74
            if ($user)
79 75
            {
80 76
                $this->previous_keyword = $this->keyword; 
81  
                $this->keyword = $user->getId();
  77
                $this->keyword = (int)$user->getId();
82 78
            }
83 79
        }
84 80

                                        
89 85
            $this->in = 'projects';
90 86

                                        
91 87
        // Rules to associate as/in with real database structure
92  
        $projects_dbrules = array('name' => array('name', 'dbname'),
93  
                                  'author' => 'userid',
94  
                                  'date' => 'date',
95  
                                  'content' => array('oneline', 'text'),
96  
                                  'db-table' => 'projects'
97  
                                  );
  88
        $dbrules['projects'] = array('name' => array('name', 'dbname'),
  89
                                     'author' => 'userid',
  90
                                     'date' => 'date',
  91
                                     'content' => array('oneline', 'text'),
  92
                                     'db-table' => 'projects'
  93
                                    );
98 94

                                        
99  
        $projectsbugs_dbrules = array('name' => 'name',
100  
                                      'author' => 'authorid',
101  
                                      'date' => 'datetime',
102  
                                      'content' => 'text',
103  
                                      'db-table' => 'projects_bugs'
104  
                                      );
  95
        $dbrules['projects-bugs'] = array('name' => 'name',
  96
                                          'author' => 'authorid',
  97
                                          'date' => 'datetime',
  98
                                          'content' => 'text',
  99
                                          'db-table' => 'projects_bugs'
  100
                                          );
105 101

                                        
  102
        $dbrules['projects-doc'] = array('name' => 'link',
  103
                                          'author' => 'registered_id',
  104
                                          'author_' => 'unregistered_nick',
  105
                                          'date' => 'datetime',
  106
                                          'content' => 'text',
  107
                                          'db-table' => 'projects_doc'
  108
                                          );
106 109

                                        
  110
        $dbrules['projects-forum'] = array('name' => 'title',
  111
                                           'author' => 'registered_id',
  112
                                           'author_' => 'unregistered_nick',
  113
                                           'date' => 'datetime',
  114
                                           'content' => 'text',
  115
                                           'db-table' => 'projects_forum'
  116
                                          );
107 117

                                        
108  
        $projectsforum_dbrules = array('name' => 'projects_forum.title',
109  
                                       'author' => '(projects_forum.registered_id OR projects_forum_answers.registered_id)',
110  
                                       'date' => 'projects_forum.datetime OR projects_forum_answers.datetime',
111  
                                       'content' => 'projects_forum.text OR projects_forum_answers.text',
112  
                                       'db-table' => 'projects_forum, projects_forum_answers'
113  
                                      );
  118
        $dbrules['projects-news'] = array('name' => 'title',
  119
                                          'author' => 'authorid',
  120
                                          'date' => 'datetime',
  121
                                          'content' => 'text',
  122
                                          'db-table' => 'projects_news'
  123
                                          );
114 124

                                        
  125
        $dbrules['users'] = array('name' => array('nickname', 'name', 'surname'),
  126
                                  'author' => array('nickname', 'name', 'surname'),
  127
                                  'date' => 'date',
  128
                                  'content' => array('nickname', 'name', 'surname'),
  129
                                  'db-table' => 'users'
  130
                                 );
115 131

                                        
116  

                                    
117  

                                    
118 132
        // Search in database
119  
        if ($this->in == 'projects')
120  
            $rules = $projects_dbrules;
121  
        elseif ($this->in == 'projects-bugs')
122  
            $rules = $projectsbugs_dbrules;
  133
        $rules = $dbrules[$this->in];
123 134

                                        
124  
        elseif ($this->in == 'projects-forum')
125  
            $rules = $projectsforum_dbrules;
126  

                                    
127 135
        foreach ($rules as $key => $value)
128 136
            if ($this->as == $key)
129 137
            {
130 138
                if (is_array($value))
131 139
                {
132 140
                    foreach ($value as $field)
133  
                        $where[$field] = $this->keyword;
  141
                        $where[$field] = array($this->keyword, 'LIKE');
134 142
                }
135 143
                else
136 144
                {
137  
                    $where = array($value => $this->keyword);
  145
                    if (is_int($this->keyword))
  146
                        $where = array($value => $this->keyword);
  147
                    elseif (in_array($value.'_', $rules) && $this->as == 'author')
  148
                        $where = array($value.'_' => array($this->keyword, 'LIKE'));
  149
                    else
  150
                        $where = array($value => array($this->keyword, 'LIKE'));
138 151
                }
139 152
            }
140 153

                                        
141 154
        // Show by project/version
142  
        if ($this->in != 'projects')
  155
        $sql = '';
  156
        if (!in_array($this->in, array('projects', 'users')))
143 157
        {
144  
            $sql = '';
145 158
            if (!empty($this->project))
146 159
            {
147 160
                $prjclass = getClass('projects.projects', $this->ct_db);
148 161
                if ($prjclass->load($this->project, 'dbname'))
149  
                    $sql = 'AND `projectid` = "'.$prjclass->getId().'" ';
  162
                    $sql .= 'AND `projectid` = "'.$prjclass->getId().'" ';
150 163
            }
151 164

                                        
152  
            if (!empty($this->version))
  165
            if (!empty($this->version) && !in_array($this->in, array('projects-doc', 'projects-forum', 'projects-news')))
153 166
            {
154 167
                $prjclass = getClass('projects.projects', $this->ct_db);
155 168
                if ($prjclass->load($this->project, 'dbname'))
156 169
                {
157 170
                    $vrnclass = getClass('project.versions', $this->ct_db);
158 171
                    if ($vrnclass->versionExist($prjclass->getId(), $this->version))
159  
                        $sql = 'AND `version` = "'.$this->version.'" ';
  172
                        $sql .= 'AND `version` = "'.$this->version.'" ';
160 173
                }
161 174
            }
162 175
        }
163 176

                                        
  177
        // Show newer before
  178
        $sql .= 'ORDER BY '.$rules['date'].' DESC';
  179

                                    
  180
        // Retrieve the keyword if API
  181
        if ($this->page[1] == 'api')
  182
            $this->keyword = $this->page[3];
  183

                                    
164 184
        if (!empty($this->keyword))
165 185
        {
166  
            $this->search_results = $this->ct_db->like($rules['db-table'], $where, '*', $sql, 'OR');
  186
            if (isset($_GET['max']))
  187
                $max = $_GET['max'];
  188
            else
  189
                $max = 20;
  190

                                    
  191
            // API or not
  192
            if ($this->page[1] == 'api')
  193
            {
  194
                $p_where = array('name' => array($this->keyword, 'LIKE'),
  195
                                 'dbname' => array($this->keyword, 'LIKE')
  196
                                );
  197
                $u_where = array('nickname' => array($this->keyword, 'LIKE'),
  198
                                 'name' => array($this->keyword, 'LIKE'),
  199
                                 'surname' => array($this->keyword, 'LIKE')
  200
                                );
  201

                                    
  202
                $this->projects_results = $this->ct_db->select('projects', $p_where, '*', 'LIMIT 0, '.$max, 'OR');
  203
                $this->users_results = $this->ct_db->select('users', $u_where, '*', 'LIMIT 0, '.$max, 'OR');
  204
            }
  205
            else
  206
                $this->search_results = $this->ct_db->select($rules['db-table'], $where, '*', $sql.' LIMIT 0, '.$max, 'OR');
167 207
        }
168 208

                                        
169 209
        // Show the real nickname to user
177 217

                                        
178 218
    function showAPI()
179 219
    {
180  
        // Use $this->page[2] and search in projects and users as name
  220
        global $basedir;
  221
        global $baseurl;
  222

                                    
  223
        // Create the OpenForge document
  224
        Header("Content-Type: application/xml; charset=utf-8");
  225
        $xml = new DOMDocument('1.0', 'utf-8');
  226
        $openforge = $xml->createElement('openforge');
  227
        $xml->appendChild($openforge);
  228

                                    
  229
        // Append the forge info
  230
        $forge = $openforge->appendChild($xml->createElement('forge'));
  231
        $forge->appendChild($xml->createElement('name', 'CodingTeam'));
  232
        $forge->appendChild($xml->createElement('url', $baseurl));
  233
        $forge->appendChild($xml->createElement('version', file_get_contents($basedir.'/VERSION')));
  234
        $forge->appendChild($xml->createElement('apiversion', '0.1'));
  235

                                    
  236
        // Append the results sended by the module
  237
        $search = $xml->createElement('search');
  238

                                    
  239
        // Users
  240
        if (count($this->users_results) > 0)
  241
        {
  242
            $users = $xml->createElement('users');
  243

                                    
  244
            rsort($this->users_results);
  245
            foreach ($this->users_results as $user)
  246
            {
  247
                $usr = $xml->createElement('user');
  248

                                    
  249
                $usr->setAttribute('nickname', $user['nickname']);
  250
                $usr->setAttribute('firstname', $user['name']);
  251
                $usr->setAttribute('lastname', $user['surname']);
  252
                $usr->setAttribute('url', $baseurl.'users/show/'.$user['nickname']);
  253

                                    
  254
                $users->appendChild($usr);
  255
            }
  256

                                    
  257
            $search->appendChild($users);
  258
        }
  259

                                    
  260
        // Projects
  261
        if (count($this->projects_results) > 0)
  262
        {
  263
            $projects = $xml->createElement('projects');
  264

                                    
  265
            rsort($this->projects_results);
  266
            foreach ($this->projects_results as $project)
  267
            {
  268
                $prj = $xml->createElement('project');
  269

                                    
  270
                $prj->setAttribute('name', $project['dbname']);
  271
                $prj->setAttribute('title', $project['name']);
  272
                $prj->setAttribute('url', $baseurl.'project/'.$project['dbname']);
  273

                                    
  274
                $projects->appendChild($prj);
  275
            }
  276

                                    
  277
            $search->appendChild($projects);
  278
        }
  279

                                    
  280
        $openforge->appendChild($search);
  281

                                    
  282
        // Show the result
  283
        $xml->formatOutput = TRUE;
  284
        echo $xml->saveXML();
181 285
    }
182 286

                                        
183 287
    function treatForms()
189 293
        $this->maincontent .= '<h1>'.i18n('Search in CodingTeam').'</h1>
190 294
        <h2>'.i18n('Edit criterias').'</h2>
191 295
        <form action="'.getURLbyTags($this->page).'/" method="get">
192  
        <table style="width: 50%;">
  296
        <table style="width: 72%;">
193 297
         <tr>
194 298
          <td style="width: 25%;border-right: 1px #ccc solid;"><strong>'.i18n('Search for:').'</strong></td>
195 299
          <td style="padding-left: 10px;"><input type="text" name="keyword" style="width: 95%" value="'.((!empty($this->keyword)) ? htmlspecialchars($this->keyword) : '').'" /></td>
235 339
         </tr>
236 340
         <tr>
237 341
          <td style="width: 25%;border-right: 1px #ccc solid;"><strong>'.i18n('Show by project:').'</strong></td>
238  
          <td style="padding-left: 10px;padding-bottom: 10px;border-bottom: 1px #ccc solid;"><input type="text" name="project" style="width: 50%;" value="'.((!empty($this->project)) ? htmlspecialchars($this->project) : '').'" />
  342
          <td style="padding-left: 10px;"><input type="text" name=&quot;project" style="width: 50%;" value="'.((!empty($this->project)) ? htmlspecialchars($this->project) : '').'" />
239 343
          <strong>'.i18n('version: ').'</strong><input type="text" name="version" style="width: 20%;" value="'.((!empty($this->version)) ? htmlspecialchars($this->version) : '').'" /></td>
240 344
         </tr>
  345

                                    
  346
         <tr>
  347
          <td style="width: 25%;border-right: 1px #ccc solid;"><strong>'.i18n('Results number:').'</strong></td>
  348
          <td style="padding-left: 10px;padding-bottom: 10px;border-bottom: 1px #ccc solid;"><select name="max">
  349
            <option value="20" '.( (isset($_GET['max']) && $_GET['max'] == 20) ? ' selected="selected"' : '').'>20</option>
  350
            <option value="40" '.( (isset($_GET['max']) && $_GET['max'] == 40) ? ' selected="selected"' : '').'>40</option>
  351
            <option value="60" '.( (isset($_GET['max']) && $_GET['max'] == 60) ? ' selected="selected"' : '').'>60</option>
  352
            <option value="80" '.( (isset($_GET['max']) && $_GET['max'] == 80) ? ' selected="selected"' : '').'>80</option>
  353
            <option value="100" '.( (isset($_GET['max']) && $_GET['max'] == 100) ? ' selected="selected"' : '').'>100</option>
  354
            <option value="120" '.( (isset($_GET['max']) && $_GET['max'] == 120) ? ' selected="selected"' : '').'>120</option>
  355
          </select></td>
  356
         </tr>
  357

                                    
241 358
        </table>
242 359
        <p>
243 360
          <input type="submit" class="submit" value="'.i18n('Search').'" style="margin-top: 30px;width: 150px;" />
244 361
        </p>
245 362
        </form>
246  
        <h2>'.i18n('Results').'</h2>';
  363
        <p>&nbsp;</p>
  364
        <h2>'.i18n('Results').'</h2>
247 365

                                        
248  
        global $baseurl;
249  
        foreach ($this->search_results as $result)
  366
        <table style="width: 100%;">
  367
          <thead>
  368
            <tr>
  369
              <th colspan="2">'.$this->in_array[$this->in].'</th>
  370
            </tr>
  371
          </thead>
  372
          <tbody>';
  373

                                    
  374
        if (!empty($this->keyword) && count($this->search_results) > 0)
250 375
        {
251  
            // Project
252  
            if (isset($result['text']) && isset($result['name']) && isset($result['dbname']))
253  
                $this->maincontent .= '<a href="project/'.htmlspecialchars($result['dbname']).'" style="font-size: 1.2em;color: #0000FF;">'.
254  
                                      htmlspecialchars($result['name']).'</a><br /><span style="padding-left: 5px;">'.map_str(htmlspecialchars($result['text']), 200).
255  
                                      '</span><br />
256  
                                      <a href="project/'.htmlspecialchars($result['dbname']).'" style="color: #228B22;">'.$baseurl.'project/'.htmlspecialchars($result['dbname']).'</a>
257  
                                      <br /><br />';
  376
            $i = 0;
  377
            foreach ($this->search_results as $result)
  378
            {
  379
                if ($i & 1)
  380
                    $color = '#f0f0f0';
  381
                else
  382
                    $color = '#fff';
258 383

                                        
  384
                if (isset($result['projectid']))
  385
                {
  386
                    $prjclass = getClass('projects.projects', $this->ct_db);
  387
                    $prjclass->load($result['projectid']);
  388
                    $dbname = htmlspecialchars($prjclass->getDbname());
  389
                }
259 390

                                        
260  
            // Project - Forum
261  
            if (isset($result['title']) && isset($result['text']) && isset($result['id']))
262  
                $this->maincontent .= '<a href="project/'.htmlspecialchars($result['dbname']).'" style="font-size: 1.2em;color: #0000FF;">'.
263  
                                      htmlspecialchars($result['title']).'</a><br /><span style="padding-left: 5px;">'.map_str(htmlspecialchars($result['text']), 200).
264  
                                      '</span><br />
265  
                                      <a href="project/'.htmlspecialchars($result['dbname']).'" style="color: #228B22;">'.$baseurl.'project/'.htmlspecialchars($result['dbname']).'</a>
266  
                                      <br /><br />';
  391
                switch ($this->in)
  392
                {
  393
                    case 'projects':
  394
                        $this->maincontent .= '
  395
                        <tr>
  396
                          <td style="width: 20%;background-image: url(\'public/images/icons/mimetypes/package-x-generic.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  397
                            <a href="project/'.htmlspecialchars($result['dbname']).'" style="display: block;">
  398
                              '.htmlspecialchars($result['name']).'
  399
                            </a>
  400
                          </td>
  401
                          <td style="background-color: '.$color.';">
  402
                            '.map_str(htmlspecialchars($result['oneline']), 120).'
  403
                          </td>
  404
                        </tr>';
  405
                        break;
267 406

                                        
  407
                    case 'projects-bugs':
  408
                        $this->maincontent .= '
  409
                        <tr>
  410
                          <td style="width: 27%;background-image: url(\'public/images/icons/categories/preferences-system.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  411
                            <a href="project/'.$dbname.'/bugs/show/'.$result['id'].'" style="display: block;">
  412
                              '.map_str(htmlspecialchars($result['name']), 42).'
  413
                            </a>
  414
                          </td>
  415
                          <td style="background-color: '.$color.';">
  416
                            '.map_str(htmlspecialchars($result['text']), 120).'
  417
                          </td>
  418
                        </tr>';
  419
                        break;
268 420

                                        
  421
                    case 'projects-doc':
  422
                        $this->maincontent .= '
  423
                        <tr>
  424
                          <td style="width: 16%;background-image: url(\'public/images/icons/apps/accessories-dictionary.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  425
                            <a href="project/'.$dbname.'/doc/'.htmlspecialchars($result['link']).':'.convertDate(
  426
                            $result['datetime'], 'datetime', 'timestamp').'" style="display: block;">
  427
                              '.map_str(htmlspecialchars($result['link']), 20).'
  428
                            </a>
  429
                          </td>
  430
                          <td style="background-color: '.$color.';">
  431
                            '.map_str(htmlspecialchars($result['log']), 120).'
  432
                          </td>
  433
                        </tr>';
  434
                        break;
  435

                                    
  436
                    case 'projects-forum':
  437
                        $this->maincontent .= '
  438
                        <tr>
  439
                          <td style="width: 27%;background-image: url(\'public/images/icons/actions/mail-reply-all.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  440
                            <a href="project/'.$dbname.'/forum/show/'.$result['id'].'" style="display: block;">
  441
                              '.map_str(htmlspecialchars($result['title']), 42).'
  442
                            </a>
  443
                          </td>
  444
                          <td style="background-color: '.$color.';">
  445
                            '.map_str(htmlspecialchars($result['text']), 120).'
  446
                          </td>
  447
                        </tr>';
  448
                        break;
  449

                                    
  450
                    case 'projects-news':
  451
                        $this->maincontent .= '
  452
                        <tr>
  453
                          <td style="width: 27%;background-image: url(\'public/images/icons/apps/accessories-dictionary.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  454
                            <a href="project/'.$dbname.'/news/show/'.$result['id'].'-'.$result['link'].'" style="display: block;">
  455
                              '.map_str(htmlspecialchars($result['title']), 42).'
  456
                            </a>
  457
                          </td>
  458
                          <td style="background-color: '.$color.';">
  459
                            '.map_str(htmlspecialchars($result['text']), 120).'
  460
                          </td>
  461
                        </tr>';
  462
                        break;
  463

                                    
  464
                    case 'users':
  465
                        $this->maincontent .= '
  466
                        <tr>
  467
                          <td style="width: 20%;background-image: url(\'public/images/icons/stock/generic/stock_people.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  468
                            <a href="users/show/'.htmlspecialchars($result['nickname']).'" style="display: block;">
  469
                              '.htmlspecialchars($result['nickname']).'
  470
                            </a>
  471
                          </td>
  472
                          <td style="background-color: '.$color.';">
  473
                            '.htmlspecialchars($result['name']).' '.htmlspecialchars($result['surname']).'
  474
                          </td>
  475
                        </tr>';
  476
                        break;
  477
                }
  478

                                    
  479
                $i ++;
  480
            }
269 481
        }
  482
        else
  483
        {
  484
            $this->maincontent .= '
  485
            <tr>
  486
              <td colspan="2">&nbsp;'.i18n('No results.').'</td>
  487
            </tr>';
  488
        }
270 489

                                        
  490
        $this->maincontent .= '
  491
          </tbody>
  492
        </table>';
  493

                                    
  494
        if (!empty($this->keyword))
  495
        {
  496
            // OpenForge - external search
  497
            $this->config = getClass('config', $this->ct_db);
  498
            if (in_array($this->in, array('projects', 'users')) && $this->config->get('openforge', 'esearch-active'))
  499
            {
  500
                $this->maincontent .= '<p>&nbsp;</p>
  501
                <h2>'.i18n('External results').'</h2>
  502
                <table style="width: 100%;">
  503
                  <thead>
  504
                    <tr>
  505
                      <th colspan="2">'.$this->in_array[$this->in].'</th>
  506
                    </tr>
  507
                  </thead>
  508
                  <tbody>';
  509

                                    
  510
                $servers_list = $this->config->get('openforge', 'esearch-servers');
  511

                                    
  512
                if (!empty($servers_list))
  513
                {
  514
                    if (strstr($servers_list, ';'))
  515
                        $servers = explode(';', $servers_list);
  516
                    else
  517
                        $servers = array($servers_list);
  518

                                    
  519
                    foreach ($servers as $server)
  520
                    {
  521
                        $this->maincontent .= '
  522
                        <tr>
  523
                          <td colspan="2" style="background-color: #f4f4f4;">
  524
                            <ul>
  525
                              <li>'.i18n('Results from <strong>%(server)s</strong>:', array('server' => $server)).'</li>
  526
                            </ul>
  527
                          </td>
  528
                        </tr>';
  529

                                    
  530
                        // Max
  531
                        if (!isset($_GET['max']))
  532
                            $max = 20;
  533
                        elseif (in_array($_GET['max'], array(20, 40, 60, 80, 100, 120)))
  534
                            $max = $_GET['max'];
  535
                        else
  536
                            $max = 20;
  537

                                    
  538
                        // Load the XML file for search results
  539
                        error_reporting(0);
  540
                        $xml = simplexml_load_file($server.'search/'.$this->keyword);
  541
                        $nb = 0;
  542

                                    
  543
                        // Select path
  544
                        if ($this->in == 'projects')
  545
                        {
  546
                            $path = $xml->search->projects->project;
  547

                                    
  548
                            if (isset($xml->search->projects))
  549
                                $nb = count($xml->search->projects->children());
  550
                        }
  551
                        else
  552
                        {
  553
                            $path = $xml->search->users->user;
  554

                                    
  555
                            if (isset($xml->search->users))
  556
                                $nb = count($xml->search->users->children());
  557
                        }
  558

                                    
  559
                        $i = 0;
  560
                        if ($nb > 0)
  561
                        {
  562
                            foreach ($path as $element)
  563
                            {
  564
                                if ($i > $max)
  565
                                    break;
  566

                                    
  567
                                $attributes = $element->attributes();
  568

                                    
  569
                                if ($this->in == 'projects')
  570
                                    $this->maincontent .= '
  571
                                    <tr>
  572
                                      <td style="width: 20%;background-image: url(\'public/images/icons/mimetypes/package-x-generic.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  573
                                        <a href="'.$attributes->url.'" style="display: block;">
  574
                                          '.htmlspecialchars($attributes->title).'
  575
                                        </a>
  576
                                      </td>
  577
                                      <td>'.htmlspecialchars($attributes->title).'</td>
  578
                                    </tr>';
  579
                                else
  580
                                    $this->maincontent .= '
  581
                                    <tr>
  582
                                      <td style="width: 20%;background-image: url(\'public/images/icons/stock/generic/stock_people.png\');background-repeat: no-repeat;padding-left: 20px;" class="current-td">
  583
                                        <a href="'.$attributes->url.'" style="display: block;">
  584
                                          '.htmlspecialchars($attributes->nickname).'
  585
                                        </a>
  586
                                      </td>
  587
                                      <td>
  588
                                        '.htmlspecialchars($attributes->firstname).' '.htmlspecialchars($attributes->lastname).'
  589
                                      </td>
  590
                                    </tr>';
  591

                                    
  592
                                $i ++;
  593
                            }
  594
                        }
  595
                        else
  596
                            $this->maincontent .= '
  597
                            <tr>
  598
                              <td colspan="2">&nbsp;'.i18n('No results.').'</td>
  599
                            </tr>';
  600
                    }
  601
                }
  602

                                    
  603
                $this->maincontent .= '
  604
                  </tbody>
  605
                </table>';
  606

                                    
  607
            }
  608

                                    
  609
        } 
  610

                                    
271 611
        return $this->maincontent;
272 612
    }
273 613
}
274 614

                                        

 

Old New Code
38 38
          <li><a href="admin">'.i18n('Users').' <img src="public/images/dropdown.png" alt="dropdown" /></a>
39 39
            <ul class="submenu">
40 40
              <li><a href="admin/users/tou">'.i18n('Terms of Use').'</a></li>
  41
              <li><a href="admin/users/manage">'.i18n('Manage').'</a></li>
41 42
            </ul>
42 43
          </li>';
43 44

                                        
44 45

                                        

 

Old New Code
36 36

                                        
37 37
        // Meta tags
38 38
        $this->metatags = array('title'       => i18n('Register an account'),
39  
                                'feed'         => '',
  39
                                'feed'        =&gt; '',
40 40
                                'description' => '',
41 41
                                'keywords'    => ''
42 42
                               );
192 192
                $this->form_mail, $this->form_jabberid, $this->form_website, $this->form_avatar, $level, $hash,
193 193
                $this->form_lang))
194 194
                {
195  
                    // Send mail
196  
                    $text = i18n('Welcome on CodingTeam, %(nick)s!'."\n".'Remember your password is `%(pass)s`.',
197  
                                 array('nick' => $this->form_nickname, 'pass' => $this->form_password1));
198  
                    $mail = sendmail(i18n('CodingTeam registration'), $text, $this->form_mail, $this->ct_db);
199  
        
200 195
                    // Log in and redirect
201 196
                    $this->ct_session->login($this->form_nickname, $this->form_password1, 0);
202 197
                    global $baseurl;
233 228
                        '.$page['text'].'
234 229
                      <br /><br /><span style="font-style: italic;">'.i18n('Last modification:').' '.i18nDate($page['date'], $this->lang).'</span>
235 230
                      </div>
236  
                      <p style="font-weight: bold;">'.i18n('» I have read and I accept this Term of use.').'</p>';
  231
                      <p style="font-weight: bold;">'.i18n('» I read and I accept this Term of use.').'</p>';
237 232
        }
238 233
        elseif ($this->form_step == 1)
239 234
        {
240 235

                                        

 

Old New Code
49 49

                                        
50 50
    function showAPI()
51 51
    {
52  
        $return = array();
  52
        $classadm = getClass('project.admins', $this->ct_db);
  53
        $classprj = getClass('projects.projects', $this->ct_db);
  54
        $user_obj = getUser($this->nickname, $this->ct_db, 'nickname');
53 55

                                        
54  
            $classadm = getClass('project.admins', $this->ct_db);
55  
            $classprj = getClass('projects.projects', $this->ct_db);
  56
        global $basedir;
  57
        global $baseurl;
56 58

                                        
57  
        $user = getUser($this->nickname, $this->ct_db, 'nickname');
58  
        if ($user)
59  
        {
60  
            $nick = htmlspecialchars($user->getNickname());
61  
            $name = htmlspecialchars($user->getName());
62  
            $surname = htmlspecialchars($user->getSurname());
63  
            $date = $user->getDate();
  59
        // Create the OpenForge document
  60
        Header("Content-Type: application/xml; charset=utf-8");
  61
        $xml = new DOMDocument('1.0', 'utf-8');
  62
        $openforge = $xml->createElement('openforge');
  63
        $xml->appendChild($openforge);
64 64

                                        
65  
            $rfcdate = convertDate($date, 'datetime', 'rfc');
66  
            $epochdate = date('Y-m-d H:i:s', $timestamp);
  65
        // Append the forge info
  66
        $forge = $openforge->appendChild($xml->createElement('forge'));
  67
        $forge->appendChild($xml->createElement('name', 'CodingTeam'));
  68
        $forge->appendChild($xml->createElement('url', $baseurl));
  69
        $forge->appendChild($xml->createElement('version', file_get_contents($basedir.'/VERSION')));
  70
        $forge->appendChild($xml->createElement('apiversion', '0.1'));
67 71

                                        
68  
            $return['nickname'] = $nick;
69  
            $return['firstname'] = $name;
70  
            $return['lastname'] = $surname;
  72
        // Append the results sended by the module
  73
        $user = $xml->createElement('user');
71 74

                                        
72  
            $return['date-rfc'] = $rfcdate;
73  
            $return['date'] = $date;
74  
            $return['date-epoch'] = $epochdate;
  75
        $user->appendChild($xml->createElement('nickname', $user_obj->getNickname()));
  76
        $user->appendChild($xml->createElement('firstname', $user_obj->getName()));
  77
        $user->appendChild($xml->createElement('lastname', $user_obj->getSurname()));
75 78

                                        
76  
            $projects = array();
77  
            foreach (array('projects', 'projects_admins') as $type)
78  
            {
79  
                $projects_ = $classadm->getAdmins($user->getId(), 'user', $type);
80  
                foreach ($projects_ as $project)
81  
                    array_push($projects, $project['dbname']); 
82  
            }
83  
            $return['projects'] = array('parent' => $projects);
  79
        $user->appendChild($xml->createElement('date', convertDate($user_obj->getDate(), 'datetime', 'rfc')));
  80

                                    
  81
        $projects = $xml->createElement('projects');
  82
        foreach (array('projects', 'projects_admins') as $type)
  83
        {
  84
            $projects_ = $classadm->getAdmins($user_obj->getId(), 'user', $type);
  85
            foreach ($projects_ as $prj)
  86
                $projects->appendChild($xml->createElement('project', $prj['dbname'])); 
84 87
        }
  88
        $user->appendChild($projects);
85 89

                                        
86  
        return $return;
  90
        $openforge->appendChild($user);
  91

                                    
  92
        // Show the result
  93
        $xml->formatOutput = TRUE;
  94
        echo $xml->saveXML();
87 95
    }
88 96

                                        
89 97
    function showFeed()
110 118
              <li><a href="search/?keyword='.$nick.'&as=author&in=projects-doc">'.i18n('Show documentation from this user').'</a></li>
111 119
              <li><a href="search/?keyword='.$nick.'&as=author&in=projects-forum">'.i18n('Show messages from this user').'</a></li>
112 120
              <li><a href="search/?keyword='.$nick.'&as=author&in=projects-news">'.i18n('Show news from this user').'</a></li>
113  
              <li><a href="search/?keyword='.$nick.'&as=author&in=notepad">'.i18n('Show paste from this user').'</a></li>
114 121
            </ul>
115 122
            <h2 style="clear: left;">'.i18n('Projects').'</h2>
116 123
            <table style="width: 100%;">
165 172

                                        
166 173
                    <td style="background: #f0f0f0;"><a href="project/'.$dbname.'"><strong>'.$name.'</strong></a></td>
167 174
                    <td style="background: #f0f0f0;" class="center">'.i18nDate($date[0], $this->lang).'</td>
168  
                    <td style="background: #f0f0f0;" class="center"><strong>'.(int)($popularity / $overall * 100).'%</strong></td>
  175
                    <td style="background: #f0f0f0;" class="center"><strong>'.(($overall > 0) ? number_format(($popularity / $overall * 100), 2) : 0 ).'%</strong></td>
169 176
                    <td style="background: #f0f0f0;" class="center"><strong>'.$downloads.'</strong></td>
170 177
                    </tr>
171 178
                    <tr>
172 179

                                        

 

Old New Code
4 4
  padding: 0;
5 5
  margin: 0;
6 6
  font-family: "DejaVu sans", Verdana, sans-serif;
7  
  font-size: 0.99em;
  7
  font-size: 1.0em;
8 8
  background: transparent;
9 9
}
10 10

                                        
11 11
body {
12 12
  background: #f0f0f0;
13 13
  color: #000000;
14  
  font-size: 0.98em;
  14
  font-size: 11px;
15 15
}
16 16

                                        
17 17
a:link, a:visited {
58 58
  color: #436EEE;
59 59
}
60 60

                                        
61  
td td pre {
62  
  font-size: 1.1em;
  61
td td pre, td td a {
  62
  font-size: 1.05em;
63 63
}
64 64

                                        
65 65
.current-td {
102 102
  font-size: 0.80em;
103 103
}
104 104

                                        
  105
p {
  106
  padding-top: 5px;
  107
}
  108

                                    
  109
#informationbox p, #header p, #footer p {
  110
  padding-top: 0;
  111
}
  112

                                    
  113
select .caption {
  114
  text-align: center;
  115
  font-weight: bold;
  116
  color: #000;
  117
}
  118

                                    
105 119
/* GLOBAL */
106 120
#container {
107 121
  padding: 5px;
173 187
}
174 188

                                        
175 189
#header #navlist li a {
176  
  font-size: 0.95em;
177  
  background: #f3f3f3;
178  
  line-height: 14px;
179  
  font-weight: bold;
  190
/*  font-size: 0.98em;
  191
  line-height: 14px; */
  192
  font-size: 1.0em;
  193
  line-height: 1.49em;
  194

                                    
180 195
  padding: 2px 10px 2px 10px;
181 196
  margin-right: 4px;
  197

                                    
  198
  background: #f3f3f3;  
  199
  font-weight: bold;
182 200
  border: 1px solid #ccc;
183 201
  text-decoration: none;
184 202
  color: #666;
615 633
  float: right;
616 634
}
617 635

                                        
618  
#content .statistic {
619  
  background-color: #fffafa;
620  
  padding: 10px;
621  
  margin: 10px;
622  
  border: 1px #ccc solid;
623  
  position: relative;
624  
}
625  

                                    
626  
#content .statistic object {
  636
#content .chart {
  637
  float: left;
627 638
  background-color: #fff;
628 639
  border: 1px #ccc solid;
629 640
  padding: 5px;
  641
  margin-right: 30px;
630 642
}
631 643

                                        
632  
#content .statistic .export {
633  
  position: absolute;
634  
  padding: 10px;
635  
  right: 0;
636  
  bottom: 0;
637  
}
638  

                                    
639 644
#content ul, #content ol, #content p {
640 645
  margin-top: 5px;
641 646
  margin-bottom: 5px;
642 647

                                        

 

Old New Code
5 5
    <title>{title} - CodingTeam</title>
6 6
    {htmlmeta}
7 7
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8  
    <link href="{tpl:cssdir}default.css" rel="stylesheet" type="text/css" />
  8
    <link href="{tpl:cssdir}default.css" rel="stylesheet" type="text/css" media="all" />
  9
    <link href="{tpl:cssdir}print.css" rel="stylesheet" type="text/css" media="print" />
9 10
    <link href="{tpl:logosimages}ct_cube.ico" rel="shortcut icon" />
10 11
  </head>
11 12
  <body>
12 13

                                        

 

Old New Code
7 7
.refleft
8 8
{
9 9
    fill: #000000;
10  
    font-family: "DejaVu sans", Verdana, sans-serif;
11  
    font-size: 11px;
  10
    font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif;
  11
    font-size: 12px;
12 12
}
13 13

                                        
14 14
.reftext
15 15
{
16 16
    fill: #586070;
  17
    font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif;
  18
    font-size: 11px;
  19
}
  20

                                    
  21
.bubbletextblue
  22
{
  23
    fill: none;
  24
    font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif;
  25
    font-size: 15px;
  26
    text-anchor: end;
  27
}
  28

                                    
  29
.bubbletextred
  30
{
  31
    fill: none;
  32
    font-family: "Inconsolata", "DejaVu Serif sans", Verdana, sans-serif;
  33
    font-size: 15px;
  34
    text-anchor: end;
  35
}
  36

                                    
  37
.bluebar {
  38
    fill: "#6C84C0";
  39
    fill-opacity: "0.6";
  40
}
  41

                                    
  42
.gbar:hover .bluebar
  43
{
  44
    fill: #2A3F73;
  45
}
  46

                                    
  47
.gbar:hover .redbar
  48
{
  49
    fill: #C70705;
  50
}
  51

                                    
  52
.gbar:hover #bubble
  53
{
  54
    fill: white;
  55
    stroke: grey;
  56
}
  57

                                    
  58
.gbar:hover .bubbletextblue
  59
{
  60
    fill: #2A3F73;
  61
}
  62

                                    
  63
.gbar:hover .bubbletextred
  64
{
  65
    fill: #C70705;
  66
}
  67

                                    
  68
.gbar:hover .reftext
  69
{
  70
    fill: #000000;
  71
}
  72

                                    
  73

                                    
  74
/*
  75
.refline
  76
{
  77
    stroke:#596171;
  78
    stroke-width:2px;
  79
}
  80

                                    
  81
.refleft
  82
{
  83
    fill: #000000;
17 84
    font-family: "DejaVu sans", Verdana, sans-serif;
18 85
    font-size: 11px;
19 86
}
20 87

                                        
  88
.reftext
  89
{
  90
    fill: #8e8e8e;
  91
    font-family: "DejaVu sans", Verdana, sans-serif;
  92
    font-size: 10px;
  93
}
  94

                                    
21 95
.bubbletext
22 96
{
23 97
    fill: none;
41 115
.gbar:hover .bubbletext
42 116
{
43 117
    fill: black;
44  
}
  118
}
  119

                                    
  120
.gbar:hover .reftext
  121
{
  122
    fill: #586070;
  123
    background-color: #000;
  124
}
  125
*/
45 126

                                        

 

Old New Code
32 32
{
33 33
    // Set the CodingTeam basedir
34 34
    $basedir = mb_substr($base, 0, $length);
  35
    require($basedir.'/inc/globalFunctions.php');
35 36

                                        
36 37
    // Treatment for args
37 38
    $var = explode('/', $argv[1]);
38 39
    $project = $var[ count($var) - 1 ];
  40
    $rev = $argv[2];
  41
    $prev_rev = $rev - 1;
39 42

                                        
40  
    $number = $argv[2];
  43
    // Check if the configuration file exist
  44
    if (!file_exists($basedir.'/inc/codingteam.cfg'))
  45
        die ('There are no configuration file. CodingTeam cannot start.');
41 46

                                        
42  
    // The line to write in the commits log
43  
    $global_line = $project.'/'.$number."\n";
  47
    // Check if the configuration file is well formed
  48
    $xml = new DomDocument();
  49
    $xml->load($basedir.'/inc/codingteam.cfg');
  50
    if (!$xml->schemaValidate($basedir.'/inc/codingteam-conf.xsd'))
  51
        die ('The configuration file is not well formed. CodingTeam cannot start.');
44 52

                                        
45  
    // Commits log
46  
    $svnlog = $basedir.'/public/svn/commits.log';
47  
    if (is_file($svnlog))
48  
    {
49  
        $file = fopen($svnlog, 'r');
50  
        $i = 0;        
51  
        while (!feof($file))
52  
        {
53  
            $line = fgets($file, 1024);
  53
    // Import configuration
  54
    $xml = simplexml_load_file($basedir.'/inc/codingteam.cfg');
  55
    $db_type = $xml->db->type;
  56
    $db_hostname = $xml->db->hostname;
  57
    $db_database = $xml->db->database;
  58
    $db_username = $xml->db->username;
  59
    $db_password = $xml->db->password;
54 60

                                        
55  
            if (!empty($line) && $i < 4)
56  
            {
57  
                $global_line .= $line."\n";
58  
            }
  61
    // Database connection
  62
    require($basedir.'/inc/classes/db.php');
  63
    $ct_db = new Database($db_type, $db_hostname, $db_database,
  64
                          $db_username, $db_password);
59 65

                                        
60  
            $i ++;
61  
        }
62  
        fclose($file);
63  
    }
  66
    // Project identifier
  67
    $prj_class = getClass('projects.projects', $ct_db);
  68
    $prj_obj = $prj_class->load($project, 'dbname');
  69
    if ($prj_obj)
  70
        $prj_id = $prj_class->getId();
  71
    else
  72
        exit('POST-COMMIT HOOK FAILED');
64 73

                                        
65  
    // Write this commit to the log
66  
    file_put_contents($svnlog, $global_line);
  74
    // Get commits information
  75
    $author = exec(escapeshellcmd('svnlook author '.$argv[1].' -r'.$rev));
  76
    $date = exec(escapeshellcmd('svnlook date '.$argv[1].' -r'.$rev));
  77
    $datetime = mb_substr($date, 0, 19);
67 78

                                        
  79
    $cmd = escapeshellcmd('svnlook log '.$argv[1].' -r'.$rev);
  80
    ob_start();
  81
    passthru($cmd);
  82
    $log = ob_get_clean();
  83

                                    
  84
    $cmt_class = getClass('projects.commits', $ct_db);
  85
    $cmt_class->push($prj_id, $rev, $prev_rev, $log, $author, $datetime);
  86

                                    
68 87
    // Delete cache for subversion browser
69  
    require($basedir.'/inc/globalFunctions.php');
70  
    deleteCacheVersion('/project/'.$project.'/svn', TRUE);
  88
    deleteCacheVersion('/project/'.$project.'/browse', TRUE);
  89
    deleteCacheVersion('/index');
71 90
}
72 91
?>
73 92

                                        

 

Old New Code
19 19
# ***** END LICENSE BLOCK *****
20 20

                                        
21 21
# Restart Apache
22  
/etc/init.d/apache2 restart
  22
/etc/init.d/apache2 force-reload
23 23