$notifications[$type]['message'] = ConfigHelper::getConfig($config_section . '.' . $type . '_message', $type . ' notification'); $notifications[$type]['subject'] = ConfigHelper::getConfig($config_section . '.' . $type . '_subject', $type . ' notification'); $notifications[$type]['days'] = intval(ConfigHelper::getConfig($config_section . '.' . $type . '_days', 0)); $notifications[$type]['file'] = ConfigHelper::getConfig($config_section . '.' . $type . '_file', '/etc/rc.d/' . $type . '.sh'); $notifications[$type]['header'] = ConfigHelper::getConfig($config_section . '.' . $type . '_header', "#!/bin/bash\n\nipset flush {$type}\n"); $notifications[$type]['rule'] = ConfigHelper::getConfig($config_section . '.' . $type . '_rule', "ipset add {$type} %i\n"); $notifications[$type]['footer'] = ConfigHelper::getConfig($config_section . '.' . $type . '_footer', ''); } if (in_array('mail', $channels) && empty($mail_from)) { die("Fatal error: mailfrom unset! Can't continue, exiting." . PHP_EOL); } if (!empty($auth) && !preg_match('/^LOGIN|PLAIN|CRAM-MD5|NTLM$/i', $auth)) { die("Fatal error: smtp_auth setting not supported! Can't continue, exiting." . PHP_EOL); } //$currtime = localtime2() + $timeoffset; $currtime = localtime2(); //$daystart = intval($currtime / 86400) * 86400 - $timeoffset; $daystart = intval($currtime / 86400) * 86400; $dayend = $daystart + 86399; $deadline = ConfigHelper::getConfig('payments.deadline', ConfigHelper::getConfig('invoices.paytime', 0)); // Include required files (including sequence is important) require_once LIB_DIR . DIRECTORY_SEPARATOR . 'language.php'; include_once LIB_DIR . DIRECTORY_SEPARATOR . 'definitions.php'; require_once LIB_DIR . DIRECTORY_SEPARATOR . 'unstrip.php'; require_once LIB_DIR . DIRECTORY_SEPARATOR . 'common.php'; if (ConfigHelper::checkConfig('phpui.logging') && class_exists('SYSLOG')) { $SYSLOG = new SYSLOG($DB); } else { $SYSLOG = null; } // Initialize Session, Auth and LMS classes
define('DISPOSABLE', 0); // Tariff types define('TARIFF_INTERNET', 1); define('TARIFF_HOSTING', 2); define('TARIFF_SERVICE', 3); define('TARIFF_PHONE', 4); define('TARIFF_TV', 5); define('TARIFF_OTHER', -1); $TARIFFTYPES = array(TARIFF_INTERNET => ConfigHelper::getConfig('tarifftypes.internet', trans('internet')), TARIFF_HOSTING => ConfigHelper::getConfig('tarifftypes.hosting', trans('hosting')), TARIFF_SERVICE => ConfigHelper::getConfig('tarifftypes.service', trans('service')), TARIFF_PHONE => ConfigHelper::getConfig('tarifftypes.phone', trans('phone')), TARIFF_TV => ConfigHelper::getConfig('tarifftypes.tv', trans('tv')), TARIFF_OTHER => ConfigHelper::getConfig('tarifftypes.other', trans('other'))); $fakedate = array_key_exists('fakedate', $options) ? $options['fakedate'] : NULL; $currtime = strftime("%s", localtime2()); $month = intval(strftime("%m", localtime2())); $dom = intval(strftime("%d", localtime2())); $year = strftime("%Y", localtime2()); $weekday = strftime("%u", localtime2()); $yearday = strftime("%j", localtime2()); if (is_leap_year($year) && $yearday > 31 + 28) { $yearday -= 1; } if (!empty($fakedate)) { $today = $currtime; } else { $today = mktime(0, 0, 0, $month, $dom, $year); } if ($month == 1 || $month == 4 || $month == 7 || $month == 10) { $quarter = $dom; } elseif ($month == 2 || $month == 5 || $month == 8 || $month == 11) { $quarter = $dom + 100; } else { $quarter = $dom + 200; }
global $fakedate; if (!empty($fakedate)) { $date = explode("/", $fakedate); return mktime(0, 0, 0, intval($date[1]), intval($date[2]), intval($date[0])); } else { return time(); } } $ftype = 'text/html'; $fext = 'html'; if ($filetype == 'pdf') { $ftype = 'application/pdf'; $fext = 'pdf'; } $timeoffset = date('Z'); $currtime = localtime2() + $timeoffset; $month = intval(date('m', $currtime)); $day = intval(date('d', $currtime)); $year = intval(date('Y', $currtime)); $daystart = intval($currtime / 86400) * 86400 - $timeoffset; $dayend = $daystart + 86399; $from = $sender_email; if (!empty($sender_name)) { $from = "{$sender_name} <{$from}>"; } // prepare customergroups in sql query $customergroups = " AND EXISTS (SELECT 1 FROM customergroups g, customerassignments ca \n\tWHERE c.id = ca.customerid \n\tAND g.id = ca.customergroupid \n\tAND (%groups)) "; $groupnames = ConfigHelper::getConfig('sendinvoices.customergroups'); $groupsql = ""; $groups = preg_split("/[[:blank:]]+/", $groupnames, -1, PREG_SPLIT_NO_EMPTY); foreach ($groups as $group) {
invoice_body_v2(); } else { invoice_body(); } } $pdf->output($output, 'F'); } require_once LIB_DIR . '/tcpdf.php'; require_once MODULES_DIR . '/invoice_tcpdf.inc.php'; require_once MODULES_DIR . '/invoice_tcpdf_v2.inc.php'; //$DB->debug = true; $fakedate = array_key_exists('fakedate', $options) ? $options['fakedate'] : NULL; $currtime = strftime("%s", localtime2()); $month = intval(strftime("%m", localtime2())); $dom = intval(strftime("%d", localtime2())); $year = strftime("%Y", localtime2()); $month = sprintf('%02.d', $month); $dom = sprintf('%02.d', $dom); if (array_key_exists('docid', $options)) { // generowanie pliku na podstawie id faktury $docid = intval($options['docid']); $doc = $DB->GetRow('SELECT d.type, d.customerid, d.number, d.numberplanid, d.cdate, d.version, d.templatetype, d.fullnumber, n.template FROM documents d JOIN numberplans n ON (n.id = d.numberplanid) WHERE d.id = ? AND d.templatetype = ? AND (d.version = 1 OR d.version = 2) AND (d.type = ? OR d.type = ?' . ($proforma ? ' OR d.type=' . DOC_INVOICE_PRO . ' ' : '') . ') LIMIT 1;', array($docid, 'pdf', DOC_CNOTE, DOC_INVOICE)); if (!$doc) { if (!$quiet) { print "Nie odnaleziono faktury o ID : " . $docid . ", lub dokument nie spełnia kryteriów\n"; }