mambax7 /
extcal
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Contains the Calendar_Factory class. |
||
| 7 | * |
||
| 8 | * PHP versions 4 and 5 |
||
| 9 | * |
||
| 10 | * LICENSE: Redistribution and use in source and binary forms, with or without |
||
| 11 | * modification, are permitted provided that the following conditions are met: |
||
| 12 | * 1. Redistributions of source code must retain the above copyright |
||
| 13 | * notice, this list of conditions and the following disclaimer. |
||
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
||
| 15 | * notice, this list of conditions and the following disclaimer in the |
||
| 16 | * documentation and/or other materials provided with the distribution. |
||
| 17 | * 3. The name of the author may not be used to endorse or promote products |
||
| 18 | * derived from this software without specific prior written permission. |
||
| 19 | * |
||
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED |
||
| 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||
| 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
| 23 | * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY |
||
| 24 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
| 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
| 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
| 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
| 30 | * |
||
| 31 | * @category Date and Time |
||
| 32 | * |
||
| 33 | * @author Harry Fuecks <[email protected]> |
||
| 34 | * @author Lorenzo Alberton <[email protected]> |
||
| 35 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton |
||
| 36 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
||
| 37 | * |
||
| 38 | * @link http://pear.php.net/package/Calendar |
||
| 39 | */ |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Allows Calendar include path to be redefined. |
||
| 43 | * |
||
| 44 | * @ignore |
||
| 45 | */ |
||
| 46 | if (!defined('CALENDAR_ROOT')) { |
||
| 47 | define('CALENDAR_ROOT', 'Calendar/'); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Load Calendar base class. |
||
| 52 | */ |
||
| 53 | require_once CALENDAR_ROOT . 'Calendar.php'; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Contains a factory method to return a Singleton instance of a class |
||
| 57 | * implementing the Calendar_Engine_Interface.<br> |
||
| 58 | * For Month objects, to control type of month returned, use CALENDAR_MONTH_STATE |
||
| 59 | * constact e.g.; |
||
| 60 | * <code> |
||
| 61 | * require_once __DIR__ . '/Calendar/Factory.php'; |
||
| 62 | * define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays |
||
| 63 | * // define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks |
||
| 64 | * // define('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month |
||
| 65 | * </code> |
||
| 66 | * It defaults to building Calendar_Month objects.<br> |
||
| 67 | * Use the constract CALENDAR_FIRST_DAY_OF_WEEK to control the first day of the week |
||
| 68 | * for Month or Week objects (e.g. 0 = Sunday, 6 = Saturday). |
||
| 69 | * |
||
| 70 | * @category Date and Time |
||
| 71 | * |
||
| 72 | * @author Harry Fuecks <[email protected]> |
||
| 73 | * @author Lorenzo Alberton <[email protected]> |
||
| 74 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton |
||
| 75 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) |
||
| 76 | * |
||
| 77 | * @link http://pear.php.net/package/Calendar |
||
| 78 | */ |
||
| 79 | class Calendar_Factory |
||
| 80 | { |
||
| 81 | /** |
||
| 82 | * Creates a calendar object given the type and units. |
||
| 83 | * |
||
| 84 | * @param string $type class of calendar object to create |
||
| 85 | * @param int $y year |
||
| 86 | * @param int $m month |
||
| 87 | * @param int $d day |
||
| 88 | * @param int $h hour |
||
| 89 | * @param int $i minute |
||
| 90 | * @param int $s second |
||
| 91 | * |
||
| 92 | * @return object subclass of Calendar |
||
| 93 | * @static |
||
| 94 | */ |
||
| 95 | public static function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0) |
||
| 96 | { |
||
| 97 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
||
| 98 | switch ($type) { |
||
| 99 | case 'Day': |
||
| 100 | require_once CALENDAR_ROOT . 'Day.php'; |
||
| 101 | |||
| 102 | return new Calendar_Day($y, $m, $d); |
||
| 103 | case 'Month': |
||
| 104 | // Set default state for which month type to build |
||
| 105 | if (!defined('CALENDAR_MONTH_STATE')) { |
||
| 106 | define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
||
| 107 | } |
||
| 108 | switch (CALENDAR_MONTH_STATE) { |
||
| 109 | case CALENDAR_USE_MONTH_WEEKDAYS: |
||
| 110 | require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
||
| 111 | $class = 'Calendar_Month_Weekdays'; |
||
| 112 | break; |
||
| 113 | case CALENDAR_USE_MONTH_WEEKS: |
||
| 114 | require_once CALENDAR_ROOT . 'Month/Weeks.php'; |
||
| 115 | $class = 'Calendar_Month_Weeks'; |
||
| 116 | break; |
||
| 117 | case CALENDAR_USE_MONTH: |
||
| 118 | default: |
||
| 119 | require_once CALENDAR_ROOT . 'Month.php'; |
||
| 120 | $class = 'Calendar_Month'; |
||
| 121 | break; |
||
| 122 | } |
||
| 123 | |||
| 124 | return new $class($y, $m, $firstDay); |
||
| 125 | case 'Week': |
||
| 126 | require_once CALENDAR_ROOT . 'Week.php'; |
||
| 127 | |||
| 128 | return new Calendar_Week($y, $m, $d, $firstDay); |
||
| 129 | case 'Hour': |
||
| 130 | require_once CALENDAR_ROOT . 'Hour.php'; |
||
| 131 | |||
| 132 | return new Calendar_Hour($y, $m, $d, $h); |
||
| 133 | case 'Minute': |
||
| 134 | require_once CALENDAR_ROOT . 'Minute.php'; |
||
| 135 | |||
| 136 | return new Calendar_Minute($y, $m, $d, $h, $i); |
||
| 137 | case 'Second': |
||
| 138 | require_once CALENDAR_ROOT . 'Second.php'; |
||
| 139 | |||
| 140 | return new Calendar_Second($y, $m, $d, $h, $i, $s); |
||
| 141 | case 'Year': |
||
| 142 | require_once CALENDAR_ROOT . 'Year.php'; |
||
| 143 | |||
| 144 | return new Calendar_Year($y); |
||
| 145 | default: |
||
| 146 | require_once __DIR__ . '/PEAR.php'; |
||
| 147 | PEAR::raiseError('Calendar_Factory::create() unrecognised type: ' . $type, null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
||
|
0 ignored issues
–
show
|
|||
| 148 | |||
| 149 | return false; |
||
|
0 ignored issues
–
show
|
|||
| 150 | } |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * Creates an instance of a calendar object, given a type and timestamp. |
||
| 155 | * |
||
| 156 | * @param string $type type of object to create |
||
| 157 | * @param mixed $stamp timestamp (depending on Calendar engine being used) |
||
| 158 | * |
||
| 159 | * @return object subclass of Calendar |
||
| 160 | * @static |
||
| 161 | */ |
||
| 162 | public static function &createByTimestamp($type, $stamp) |
||
| 163 | { |
||
| 164 | $cE = &Calendar_Engine_Factory::getEngine(); |
||
| 165 | $y = $cE->stampToYear($stamp); |
||
| 166 | $m = $cE->stampToMonth($stamp); |
||
| 167 | $d = $cE->stampToDay($stamp); |
||
| 168 | $h = $cE->stampToHour($stamp); |
||
| 169 | $i = $cE->stampToMinute($stamp); |
||
| 170 | $s = $cE->stampToSecond($stamp); |
||
| 171 | $cal = self::create($type, $y, $m, $d, $h, $i, $s); |
||
| 172 | |||
| 173 | return $cal; |
||
| 174 | } |
||
| 175 | } |
||
| 176 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths