Completed
Branch master (c921ab)
by Michael
109:50 queued 98:29
created

Extcal_2_21   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 2
1
<?php
2
/**
3
 * extcal module.
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright           XOOPS Project (http://xoops.org)
13
 * @license             http://www.fsf.org/copyleft/gpl.html GNU public license
14
 *
15
 * @since               2.2
16
 *
17
 * @author              JJDai <http://xoops.kiolo.com>
18
 **/
19
//----------------------------------------------------
20
class Extcal_2_21
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
21
{
22
    //----------------------------------------------------
23
24
    /**
25
     * @param XoopsModule $module
26
     * @param             $options
27
     */
28
    public function __construct(XoopsModule $module, $options)
0 ignored issues
show
Unused Code introduced by
The parameter $module is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        global $xoopsDB;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
31
32
        // Create eXtcal upload directory if don't exist
33
        $dir = XOOPS_ROOT_PATH . '/uploads/extcal';
34
        if (!is_dir($dir)) {
35
            mkdir($dir);
36
37
            // Copy index.html files on uploads folders
38
            $indexFile = __DIR__ . '/index.html';
39
            copy($indexFile, XOOPS_ROOT_PATH . '/uploads/extcal/index.html');
40
        }
41
42
        // Create who's not going table to fix bug. If the table exist, the query will faile
43
        $sql = 'CREATE TABLE `' . $xoopsDB->prefix('extcal_eventnotmember')
44
               . "` (`eventnotmember_id` int(11) NOT NULL auto_increment,`event_id` int(11) NOT NULL default '0',`uid` int(11) NOT NULL default '0',PRIMARY KEY  (`eventnotmember_id`),UNIQUE KEY `eventnotmember` (`event_id`,`uid`)) COMMENT='eXtcal By Zoullou' ;";
45
        $xoopsDB->query($sql);
46
    }
47
48
    //-----------------------------------------------------------------
49
}   // fin de la classe
50