Browse the code

 

Differences between 607 and 608 on /.
Number of edited files: 5 (1 added, 0 deleted and 4 modified)
Revision 608

About 10 months and 27 days ago.

* Changed the versionning of project's bug reports: the identifier is now attached to the project (prior, it was general)
* Added the update script to make this work with an existing version of the forge
Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
18
18
 * mercurial         http://mercurial.selenic.com
19
19
 * php               http://www.php.net (>= 5)
20
20
 * php-cli           http://www.php.net/features.commandline
 
21
 * php-mbstring	     http://php.net/manual/en/book.mbstring.php
 
22
 * php-xml	     http://php.net/manual/en/book.simplexml.php
21
23
 * subversion        http://subversion.tigris.org
22
24

                                        
23
25
Database layer:
40
42

                                        
41
43
Also, this software include some files and libraries, modified or not:
42
44

                                        
43
 
                                      ----                                     
 
45
                                      ----
44
46

                                        
45
47
Using icons from these themes:
46
48

                                        
51
53
              clarity, based on black color.
52
54
 Version: 2.0 (09/09/2011)
53
55

                                        
54
 
                                      ----                                     
 
56
                                      ----
55
57

                                        
56
58
Included in CodingTeam:
57
59

                                        
58
60

                                        

 

Old New Code
16
16

                                        
17
17
class Bugs {
18
18
    private $ct_db;
19
 
    public $id, $projectid, $name, $text, $unregistered_nick, $registered_id,
20
 
           $author_ip, $version, $milestone, $priority, $type, $status,
21
 
           $assignedid, $datetime;
 
19
    public $id, $uniqueprojectid, $projectid, $name, $text, $unregistered_nick,
 
20
           $registered_id, $author_ip, $version, $milestone, $priority, $type,
 
21
           $status, $assignedid, $datetime;
22
22

                                        
23
23
    function __construct($db)
24
24
    {
66
66
            if (isset($bugs[$author]))
67
67
                $bugs[$author] = $bugs[$author] + 1;
68
68
            else
69
 
                $bugs[$author] = 1; 
 
69
                $bugs[$author] = 1;
70
70
        }
71
71

                                        
72
72
        return $bugs;
527
527
            if (count($req) == 1)
528
528
            {
529
529
                $this->id = $req[0]['id'];
 
530
                $this->uniqueprojectid = $req[0]['id_projectunique'];
530
531
                $this->projectid = $req[0]['projectid'];
531
532
                $this->name = $req[0]['name'];
532
533
                $this->text = $req[0]['text'];
550
551
        }
551
552
    }
552
553

                                        
 
554

                                    
 
555
    /**
 
556
     * Load by project
 
557
     *
 
558
     * Load a bug from a particular project according to the project's ID.
 
559
     * @param $bug_id_project
 
560
     *   The unique bug's identifier inside the given project.
 
561
     * @param $project_id
 
562
     *   The unique project's identifier.
 
563
     * @return
 
564
     *   TRUE if loaded.
 
565
     */
 
566
    function load_by_project($bug_id_project, $project_id)
 
567
    {
 
568
        if ($this->loaded)
 
569
            return TRUE;
 
570
        else
 
571
        {
 
572
            $req = $this->ct_db->select('projects_bugs',
 
573
                                array('id_projectunique' => $bug_id_project,
 
574
                                      'projectid'        => $project_id),
 
575
                                '*', 'LIMIT 1');
 
576

                                    
 
577
            if (count($req) == 1)
 
578
            {
 
579
                $this->id = $req[0]['id'];
 
580
                $this->uniqueprojectid = $req[0]['id_projectunique'];
 
581
                $this->projectid = $req[0]['projectid'];
 
582
                $this->name = $req[0]['name'];
 
583
                $this->text = $req[0]['text'];
 
584
                $this->allow_nl2br = $req[0]['allow_nl2br'];
 
585
                $this->unregistered_nick = $req[0]['unregistered_nick'];
 
586
                $this->registered_id = $req[0]['registered_id'];
 
587
                $this->author_ip = $req[0]['author_ip'];
 
588
                $this->version = $req[0]['version'];
 
589
                $this->priority = $req[0]['priority'];
 
590
                $this->type = $req[0]['type'];
 
591
                $this->status = $req[0]['status'];
 
592
                $this->milestone = $req[0]['milestone'];
 
593
                $this->assignedid = $req[0]['assignedid'];
 
594
                $this->datetime = $req[0]['datetime'];
 
595

                                    
 
596
                $this->loaded = TRUE;
 
597
                return TRUE;
 
598
            }
 
599
            else
 
600
                return FALSE;
 
601
        }
 
602
    }
 
603

                                    
 
604

                                    
553
605
    function delete()
554
606
    {
555
607
        if (isset($this->id))
648
700
        $this->id = $id;
649
701
    }
650
702

                                        
 
703
    function getUniqueProjectid()
 
704
    {
 
705
        if ($this->loaded)
 
706
            return $this->uniqueprojectid;
 
707
    }
 
708

                                    
 
709
    function setUniqueProjectid($uniqueprojectid)
 
710
    {
 
711
        $this->updateField('id_projectunique', $uniqueprojectid);
 
712
        $this->uniqueprojectid = $uniqueprojectid;
 
713
    }
 
714

                                    
651
715
    function getProjectid()
652
716
    {
653
717
        if ($this->loaded)
654
718

                                        

 

Old New Code
185
185
        {
186
186
            $construct['milestone_tickets'] ++;
187
187
            $report = array('title' => map_str(htmlspecialchars($ticket['name']), 90),
188
 
                            'id' => $ticket['id'],
 
188
                            'id' => $ticket['id_projectunique'],
189
189
                            'priority' => $this->priority[$ticket['priority']],
190
190
                            'priority_color' => $pr_color[$ticket['priority']],
191
191
                            'status' => $this->status[$ticket['status']],
192
 
                            'status_color' => $st_color[$ticket['status']],
193
192
                            'date' => i18nDate($ticket['datetime'], $this->lang, TRUE));
194
193

                                        
195
194
            switch ($ticket['status'])
196
195

                                        

 

Old New Code
32
32
        {
33
33
            Header ('Status: 301 Moved Permanently', false, 301);
34
34
            Header ('Location: '.CT_BASEURL.'projects');
35
 
            exit(); 
 
35
            exit();
36
36
        }
37
37

                                        
38
38
        if (!mb_ereg("^[0-9a-z_-]+$", $this->page[2]))
64
64
        if (!empty($this->page[4]) && $this->page[4] == 'show' && !empty($this->page[5]) && mb_ereg("^[0-9]+$", $this->page[5]))
65
65
        {
66
66
            $this->bugid = $this->page[5];
67
 
            $bug = $this->project_bugs->load($this->bugid);
 
67

                                    
 
68
            $bug = $this->project_bugs->load_by_project($this->bugid,
 
69
                                                        $this->id);
68
70
            if (!$bug)
69
 
                $this->error->displayError(i18n('No bug report found for this id number.'), 0);
 
71
            {
 
72
                $bug = $this->project_bugs->load($this->bugid);
 
73
                if (!$bug)
 
74
                    $this->error->displayError(i18n('No bug report found for this id number.'), 0);
 
75
                else
 
76
                {
 
77
                    if ($this->id != $this->project_bugs->getProjectid())
 
78
                                    exit('Error.');
70
79

                                        
71
 
            if ($this->id != $this->project_bugs->getProjectid())
72
 
                exit('Error.');
 
80
                    // It could be a bug with the old identifier (prior to 10th january 2018)
 
81
                    if (convertDate('2018-01-10 18:42:42', 'datetime', 'timestamp') > convertDate($this->project_bugs->getDatetime(), 'datetime', 'timestamp'))
 
82
                    {
 
83
                        http_response_code(301);
 
84
                        Header('Location: '.CT_BASEURL.'project/'.$this->dbname.'/bugs/show/'.$this->project_bugs->getUniqueProjectid());
 
85
                    }
 
86
                    else
 
87
                        exit('Error.');
 
88
                }
 
89
            }
73
90

                                        
74
91
            $title = i18n('Show #%(bugid)d - Bug tracking - %(name)s',
75
92
                          array('bugid' => $this->bugid,
158
175
                $feed_array['threads'][$i]['link'] = CT_BASEURL.'project/'.$this->dbname.'/bugs/show/'.$bug['id'];
159
176
                $feed_array['threads'][$i]['dc:creator'] = $nick;
160
177
                $feed_array['threads'][$i]['description'] = htmlspecialchars($bug['text']);
161
 
                
 
178

                                    
162
179
                $i ++;
163
180
            }
164
181
        }
378
395

                                        
379
396
                            Header('Location: '.CT_BASEURL.'project/'.$this->dbname.'/bugs');
380
397
                        }
381
 
                    }  
 
398
                    }
382
399
                    else
383
400
                        $this->error->displayError(i18n('Insufficient granted powers.'), 0);
384
401
            }
480
497
                            }
481
498
                            else
482
499
                            {
483
 
                                $this->project_bugs->setAssignedid(0);                            
 
500
                                $this->project_bugs->setAssignedid(0);
484
501
                            }
485
502
                        }
486
503
                        else
1128
1145
        elseif (empty($this->page[4]))
1129
1146
        {
1130
1147
            // Browse bugs
1131
 
            $construct['__tpl__'] = 'bugs-all.tpl';   
 
1148
            $construct['__tpl__'] = 'bugs-all.tpl';
1132
1149

                                        
1133
1150
            $construct['_dbname'] = $this->dbname;
1134
1151
            $construct['_priority'] = $this->priority;
1334
1351
                    case 'working':
1335
1352
                    case 'confirmed':
1336
1353
                        $st_color = '5F9EA0';
1337
 
                    break;                        
 
1354
                    break;
1338
1355

                                        
1339
1356
                    case 'resolved':
1340
1357
                        $st_color = '228B22';
1346
1363
                }
1347
1364

                                        
1348
1365
                array_push($construct['bugs'],
1349
 
                         array('id'               => $bug['id'],
 
1366
                         array('id'               => $bug['id_projectunique'],
1350
1367
                               'type'             => $bug['type'],
1351
1368
                               'has_attachements' => $has_attachements,
1352
1369
                               'status'           => $bug['status'],
1353
1370