| 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 https://xoops.org/ XOOPS Project} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @package      efqdirectory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @since | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @author       Martijn Hertog (aka wtravel) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @author       XOOPS Development Team, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class efqSubscription extends XoopsObject | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         //Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * Function durationArray: creates array of options for duration selbox: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * months, weeks, year, days etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * @return array $arr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public static function durationArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         $arr = array('0' => '---', '1' => _MD_DAYS, '2' => _MD_WEEKS, '3' => _MD_MONTHS, '4' => _MD_QUARTERS, '5' => _MD_YEARS); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         return $arr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * Function durationArray: creates array of options for duration selbox: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * single items like: month, week, year, day etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @return array $arr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     public function durationSingleArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $arr = array('0' => '---', '1' => _MD_DAY, '2' => _MD_WEEK, '3' => _MD_MONTH, '4' => _MD_QUARTER, '5' => _MD_YEAR); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         return $arr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * Function currencyArray: creates array of options for currency selbox | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @return array $arr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     public function currencyArray() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         //create array of options for duration selbox: months, weeks, year, days etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $arr = array('0' => '---', 'USD' => _MD_CURR_USD, 'AUD' => _MD_CURR_AUD, 'EUR' => _MD_CURR_EUR, 'GBP' => _MD_CURR_GBP, 'YEN' => _MD_CURR_YEN); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         return $arr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * Function notifyExpireWarning | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * Notify user of a subscription order that is about to expire. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      * @param int|string $orderid - Default: '0' - Order ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |      * @param int|string $userid  - Default: '0' - User ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     public function notifyExpireWarning($orderid = '0', $userid = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         global $xoopsConfig, $moddir; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         require_once XOOPS_ROOT_PATH . '/class/mail/xoopsmultimailer.php'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         $xoopsMailer = new XoopsMailer(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $xoopsMailer->useMail(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         $template_dir = XOOPS_URL . '/modules/' . $moddir . '/language/' . $xoopsConfig['language'] . '/mail_template/'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         $template     = 'expirewarning.tpl'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         $subject      = _MD_LANG_EXPIREWARNING_SUBJECT; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         $xoopsMailer->setTemplateDir($template_dir); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $xoopsMailer->setTemplate($template); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         $xoopsMailer->setToUsers($userid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         $xoopsMailer->setFromName($xoopsConfig['sitename']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         $xoopsMailer->setSubject($subject); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $success = $xoopsMailer->send(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  * Class efqSubscriptionHandler | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | class efqSubscriptionHandler extends XoopsObjectHandler | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         //Instantiate class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $this->db = XoopsDatabaseFactory::getDatabaseConnection(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      * Function delete: Delete subscription order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @param int|string|XoopsObject $orderid - Default: '0' - Order ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * @return array|bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     public function delete(XoopsObject $orderid = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         if ($orderid !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             $sql = 'DELETE FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_orders') . ' WHERE orderid=' . (int)$orderid . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      * Function createOrder: Create subscription order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |      * @author    EFQ Consultancy <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      * @copyright EFQ Consultancy (c) 2007 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      * @version   1.0.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * @param   int $itemid - Default: '0' - Item ID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * @return int $orderid - Newly created order id | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     public function createOrder($itemid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         $orderid = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         if ($itemid != 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             if (isset($_POST['typeofferid'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |                 $typeofferid = explode('_', $_POST['typeofferid']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |                 $typeid      = $typeofferid[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |                 $offerid     = $typeofferid[1]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |                 return false; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             $submitter = (int)$_POST['uid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             $startdate = strtotime($_POST['startdate']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             //TO DO: Add Auto renew functionality. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             //$autorenew = $_POST['autorenew']; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             $newid = $this->db->genId($this->db->prefix($module->getVar('dirname', 'n') . '_subscr_orders') . '_orderid_seq'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |             $sql   = 'INSERT INTO ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_orders') . " | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |                 (orderid, uid, offerid, typeid, startdate, status, itemid, autorenew) VALUES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |                 ($newid, $submitter, $offerid, $typeid, '$startdate', '0' , $itemid, '0')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |             $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             if ($newid == 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 $orderid = $this->db->getInsertId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         return $orderid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     /*function renewOrder($itemid = '0', $orderid='0') { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     //Renew order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     global $xoopsDB, $eh; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     //$orderid = '0'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     if ($itemid != '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |     //Billto date needs to be updated, will be done on succesful payment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     //Payment form needs to be created | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     if ( isset( $_POST['typeofferid'] ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     $typeofferid =explode("_",$_POST['typeofferid']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     $typeid = $typeofferid[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |     $offerid = $typeofferid[1]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     $submitter = $_POST['uid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     $startdate = strtotime($_POST['startdate']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     //TO DO: Add Auto renew functionality. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     //$autorenew = $_POST['autorenew']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     $newid = $xoopsDB->genId($xoopsDB->prefix("efqdiralpha1_subscr_orders")."_orderid_seq"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     $sql = "INSERT INTO ".$xoopsDB->prefix("efqdiralpha1_subscr_orders")." | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     (orderid, uid, offerid, typeid, startdate, status, itemid, autorenew) VALUES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |     ($newid, $submitter, $offerid, $typeid, '$startdate', '0' , $itemid, '0')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |     $xoopsDB->query($sql) or $eh->show("0013"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |     if ($newid == 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     $orderid = $xoopsDB->getInsertId(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     return $orderid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     }*/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |      * @param int $offerid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |     public function getOrderItemName($offerid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |         $sql     = 'SELECT o.offerid, o.duration, o.count, o.price, o.currency, o.descr, t.typeid, t.typename FROM ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |                    . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_offers') | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |                    . ' o, ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |                    . $this->db->prefix($module->getVar('dirname', 'n') . '_itemtypes') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |                    . " t WHERE o.typeid=t.typeid AND o.offerid='$offerid' ORDER BY t.typename ASC"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |         while (list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |             if ($count == '1') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |                 $duration_arr = $this->durationSingleArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                 $duration_arr = $this->durationArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |             $durationname = $duration_arr['' . $duration . '']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |             $itemname     = $typename . ' - ' . $count . ' ' . $durationname . ' - ' . $price . ' ' . $currency; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |         return $itemname; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |      * @param string $orderid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * @param string $status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      * @param string $startdate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |      * @param string $billto | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |     public function updateOrder($orderid = '0', $status = '1', $startdate = '0', $billto = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         $ordervars = $this->getOrderVars($orderid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         $typeid    = $ordervars['typeid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |         $itemid    = $ordervars['itemid']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         $sql       = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_orders') . " SET status='$status'"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |         if ($startdate != '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             $sql .= ", startdate='$startdate'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         if ($billto != '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |             $sql .= ", billto='$billto'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |         $sql .= ' WHERE orderid=' . (int)$orderid . ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         $this->db->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         if ($startdate > time()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             $this->updateScheduler('add', $itemid, $typeid, $startdate); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |             $this->updateItem($itemid, $typeid); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |      * @param string $orderid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |     public function getOrderVars($orderid = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         $sql     = 'SELECT ord.uid, ord.billto, ord.startdate, ord.typeid, ord.status, ord.itemid, ord.offerid FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_orders') . ' ord WHERE ord.orderid=' . (int)$orderid . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |         $arr     = $this->db->fetchArray($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |         while (list($uid, $billto, $startdate, $typeid, $status, $itemid, $offerid) = $this->db->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |             $arr['uid']       = $uid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |             $arr['billto']    = $billto; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |             $arr['startdate'] = $startdate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |             $arr['typeid']    = $typeid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |             $arr['status']    = $status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |             $arr['itemid']    = $itemid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |             $arr['offerid']   = $offerid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |         return $arr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |      * @param string $offerid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |      * @param string $showactive | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |      * @return array | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 301 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 302 |  |  |     public function getOfferVars($offerid = '0', $showactive = '1') | 
            
                                                                        
                            
            
                                    
            
            
                | 303 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 304 |  |  |         $sql = 'SELECT count, duration FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_offers') . ' WHERE offerid=' . (int)$offerid . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 305 |  |  |         if ($showactive == '1') { | 
            
                                                                        
                            
            
                                    
            
            
                | 306 |  |  |             $sql .= " AND activeyn='1'"; | 
            
                                                                        
                            
            
                                    
            
            
                | 307 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 308 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                        
                            
            
                                    
            
            
                | 309 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 310 |  |  |         $arr     = array(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 311 |  |  |         $arr     = $this->db->fetchArray($result); | 
            
                                                                        
                            
            
                                    
            
            
                | 312 |  |  |         while (list($count, $duration) = $this->db->fetchRow($result)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 313 |  |  |             $arr['count']    = $count; | 
            
                                                                        
                            
            
                                    
            
            
                | 314 |  |  |             $arr['duration'] = $duration; | 
            
                                                                        
                            
            
                                    
            
            
                | 315 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 316 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 317 |  |  |         return $arr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     /* function updateScheduler( $func='add', $itemid='0', $typeid='0', $startdate='0' ) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |     global $xoopsDB, $eh; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     if ($func='add') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |     $newid = $xoopsDB->genId($xoopsDB->prefix("efqdiralpha1_subscr_scheduler")."_id_seq"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     $sql = "INSERT INTO ".$xoopsDB->prefix("efqdiralpha1_subscr_scheduler")." | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |     (id, startdate, itemid, newtypeid, status) VALUES | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     ($newid, $startdate, $itemid, $typeid, '0')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |     $xoopsDB->queryF($sql) or $eh->show("0013"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     }*/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * @param string $itemid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      * @param string $typeid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |     public function updateItem($itemid = '0', $typeid = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |         if ($itemid != '0' && $typeid != '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |             $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . " SET typeid='" . (int)$typeid . '\' WHERE itemid=' . (int)$itemid . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |             $this->db->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |             return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |      * @param string $offerid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |     public function getNewBillto($offerid = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |      * @param int $itemid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |      * @param int $itemtype | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     public function changeItemType($itemid = 0, $itemtype = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |         global $xoopsDB, $eh; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |         $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . " SET typeid=$itemtype WHERE itemid=(int)($itemid)"; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |         $this->db->queryF($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |      * @param string $dashes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |      * @param string $showactive | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |     public function durationPriceArray($dashes = '0', $showactive = '1') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         $sql = 'SELECT o.offerid, o.duration, o.count, o.price, o.currency, o.descr, t.typeid, t.typename FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_subscr_offers') . ' o, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_itemtypes') . ' t WHERE o.typeid=t.typeid'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         if ($showactive == '1') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |             $sql .= " AND activeyn='1'"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |         $sql     .= ' ORDER BY t.typelevel ASC, t.typename ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |         if ($dashes == '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |             $arr = array('0' => '---'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         while (list($offerid, $duration, $count, $price, $currency, $descr, $typeid, $typename) = $this->db->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |             if ($count == '1') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |                 $duration_arr = $this->durationSingleArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |                 $duration_arr = $this->durationArray(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |             $durationname                  = $duration_arr['' . $duration . '']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |             $arr[$typeid . '_' . $offerid] = $typename . ' - ' . $count . ' ' . $durationname . ' - ' . $price . ' ' . $currency; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |         return $arr; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @param string $selname | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |      * @param bool   $none | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |      * @param int    $preselected | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     public function itemsSelBox($selname = '', $none = false, $preselected = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         $sql     = 'SELECT typeid, typename FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_itemtypes') . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         echo "<select name='" . $selname . '\''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |         echo ">\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |         $result = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |         if ($none) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |             echo "<option value='0'>----</option>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |         while (list($typeid, $typename) = $this->db->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             if ($preselected == $typeid) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                 $sel = ' selected'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |                 $sel = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |             echo "<option value='$typeid'>$typename</option>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |         echo "</select>\n"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |      * @param string $dashes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |     public function itemTypesArray($dashes = '0') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         global $xoopsModule; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |         $sql     = 'SELECT typeid, typename FROM ' . $this->db->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . ' ORDER BY typelevel ASC'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         $result  = $this->db->query($sql) or $eh->show('0013'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         $numrows = $this->db->getRowsNum($result); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         $result  = $this->db->query($sql); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |         if ($dashes == '0') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |             $arr = array('0' => '---'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |         while (list($typeid, $typename) = $this->db->fetchRow($result)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |             $arr[$typeid] = $typename; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |         return $arr; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |      * @param int $typeid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |     public function countSubscriptionsForType($typeid = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |         $sql = 'SELECT COUNT(itemid) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE typeid=' . (int)$typeid . ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         if (!$result = $this->db->query($sql)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         list($ret) = $this->db->fetchRow($result); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 461 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 462 |  |  |  | 
            
                        
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