search.inc.php ➔ apcal_search_base()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 6
dl 0
loc 28
rs 9.472
c 0
b 0
f 0
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright   {@link http://xoops.org/ XOOPS Project}
14
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team,
18
 * @author       GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/)
19
 * @author       Antiques Promotion (http://www.antiquespromotion.ca)
20
 */
21
22
defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined');
23
24
$moduleDirName = basename(dirname(__DIR__));
25
if (!preg_match('/^(\D+)(\d*)$/', $moduleDirName, $regs)) {
26
    die('invalid dirname: ' . htmlspecialchars($moduleDirName));
27
}
28
$mydirnumber = $regs[2] === '' ? '' : (int)$regs[2];
29
30
eval('
31
32
function apcal' . $mydirnumber . '_search( $keywords , $andor , $limit , $offset , $uid )
33
{
34
    return apcal_search_base( "' . $moduleDirName . '" , $keywords , $andor , $limit , $offset , $uid ) ;
35
}
36
37
');
38
39
if (!function_exists('apcal_search_base')) {
40
    /**
41
     * @param $moduleDirName
42
     * @param $keywords
43
     * @param $andor
44
     * @param $limit
45
     * @param $offset
46
     * @param $uid
47
     * @return array
48
     */
49
    function apcal_search_base($moduleDirName, $keywords, $andor, $limit, $offset, $uid)
50
    {
51
        global $xoopsConfig, $xoopsDB, $xoopsUser;
52
53
        // setting physical & virtual paths
54
        $mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
55
        $mod_url  = XOOPS_URL . "/modules/$moduleDirName";
56
57
        // defining class of APCal
58
        if (!class_exists('APCal_xoops')) {
59
            require_once "$mod_path/class/APCal.php";
60
            require_once "$mod_path/class/APCal_xoops.php";
61
        }
62
63
        // creating an instance of APCal
64
        $cal                = new APCal_xoops('', $xoopsConfig['language'], true);
65
        $cal->use_server_TZ = true;
66
67
        // setting properties of APCal
68
        $cal->conn = $GLOBALS['xoopsDB']->conn;
69
        include "$mod_path/include/read_configs.php";
70
        $cal->images_url  = "$mod_url/assets/images/$skin_folder";
0 ignored issues
show
Bug introduced by
The variable $skin_folder does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
71
        $cal->images_path = "$mod_path/assets/images/$skin_folder";
72
73
        $ret = $cal->get_xoops_search_result($keywords, $andor, $limit, $offset, $uid);
74
75
        return $ret;
76
    }
77
}
78