本文整理汇总了PHP中ConfigHelper::checkConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigHelper::checkConfig方法的具体用法?PHP ConfigHelper::checkConfig怎么用?PHP ConfigHelper::checkConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigHelper
的用法示例。
在下文中一共展示了ConfigHelper::checkConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: note_drawer
public function note_drawer()
{
$this->backend->SetFont('arial', '', 10);
$drawer = '<b>' . trans('Note drawer:') . '</b><br>';
$tmp = $this->data['division_header'];
$accounts = array(bankaccount($this->data['customerid'], $this->data['account']));
if (ConfigHelper::checkConfig('invoices.show_all_accounts')) {
$accounts = array_merge($accounts, $this->data['bankaccounts']);
}
foreach ($accounts as &$account) {
$account = format_bankaccount($account);
}
$tmp = str_replace('%bankaccount', implode("\n", $accounts), $tmp);
$tmp = preg_split('/\\r?\\n/', $tmp);
foreach ($tmp as $line) {
$drawer .= $line . '<br>';
}
$this->backend->Ln(0);
$this->backend->writeHTMLCell(80, '', '', 45, $drawer, 0, 1, 0, true, 'L');
}
示例2: simple_fill_mip
protected function simple_fill_mip($x, $y, $scale)
{
if (ConfigHelper::checkConfig('finances.control_lines')) {
$this->backend->line(7 * $scale + $x, 180 * $scale + $y, 7 * $scale + $x, 210 * $scale + $y);
$this->backend->line(7 * $scale + $x, 180 * $scale + $y, 37 * $scale + $x, 180 * $scale + $y);
$this->backend->line(370 * $scale + $x, 180 * $scale + $y, 370 * $scale + $x, 210 * $scale + $y);
$this->backend->line(370 * $scale + $x, 180 * $scale + $y, 340 * $scale + $x, 180 * $scale + $y);
$this->backend->line(7 * $scale + $x, 726 * $scale + $y, 7 * $scale + $x, 696 * $scale + $y);
$this->backend->line(7 * $scale + $x, 726 * $scale + $y, 37 * $scale + $x, 726 * $scale + $y);
$this->backend->line(370 * $scale + $x, 726 * $scale + $y, 370 * $scale + $x, 696 * $scale + $y);
$this->backend->line(370 * $scale + $x, 726 * $scale + $y, 340 * $scale + $x, 726 * $scale + $y);
}
$this->backend->addtext(15 * $scale + $x, 560 * $scale + $y, 30 * $scale, $this->data['d_shortname']);
$this->backend->addtext(15 * $scale + $x, 525 * $scale + $y, 30 * $scale, $this->data['d_address']);
$this->backend->addtext(15 * $scale + $x, 490 * $scale + $y, 30 * $scale, $this->data['d_zip'] . ' ' . $this->data['d_city']);
$this->backend->addtext(15 * $scale + $x, 680 * $scale + $y, 30 * $scale, substr(bankaccount($this->data['id'], $this->data['account']), 0, 17));
$this->backend->addtext(15 * $scale + $x, 620 * $scale + $y, 30 * $scale, substr(bankaccount($this->data['id'], $this->data['account']), 18, 200));
$this->backend->addtext(15 * $scale + $x, 435 * $scale + $y, 30 * $scale, '**' . number_format($this->data['total'], 2, ',', '') . '**');
// $this->backend->addtext(15 * $scale + $x, 310 * $scale+$y, 30 * $scale, $this->data['name']);
$font_size = 30;
while ($this->backend->getTextWidth($font_size * $scale, $this->data['name']) > 135) {
$font_size -= 1;
}
$this->backend->addtext(15 * $scale + $x, 310 * $scale + $y, $font_size * $scale, $this->data['name']);
$font_size = 30;
while ($this->backend->getTextWidth($font_size * $scale, $this->data['address']) > 135) {
$font_size -= 1;
}
$this->backend->addtext(15 * $scale + $x, 275 * $scale + $y, $font_size * $scale, $this->data['address']);
$this->backend->addtext(15 * $scale + $x, 240 * $scale + $y, 30 * $scale, $this->data['zip'] . ' ' . $this->data['city']);
$font_size = 30;
while ($this->backend->getTextWidth($font_size * $scale, trans('Invoice No. $a', $this->data['t_number'])) > 135) {
$font_size -= 1;
}
$this->backend->addtext(15 * $scale + $x, 385 * $scale + $y, $font_size * $scale, trans('Invoice No. $a', $this->data['t_number']));
}
示例3: foreach
if (sizeof($_POST['marks'])) {
foreach ($_POST['marks'] as $id => $mark) {
$ilm[$id] = $mark;
}
}
if (sizeof($ilm)) {
foreach ($ilm as $mark) {
$ids[] = $mark;
}
}
if (sizeof($ids)) {
foreach ($ids as $invoiceid) {
list($cid, $closed) = array_values($DB->GetRow('SELECT customerid, closed FROM documents
WHERE id = ?', array($invoiceid)));
// add payment
if (ConfigHelper::checkConfig('phpui.invoice_check_payment') && $cid && !$closed) {
$value = $DB->GetOne('SELECT CASE reference WHEN 0 THEN SUM(a.value*a.count)
ELSE SUM((a.value+b.value)*(a.count+b.count)) - SUM(b.value*b.count) END
FROM documents d
JOIN invoicecontents a ON (a.docid = d.id)
LEFT JOIN invoicecontents b ON (d.reference = b.docid AND a.itemid = b.itemid)
WHERE d.id = ? GROUP BY d.reference', array($invoiceid));
if ($value != 0) {
$LMS->AddBalance(array('type' => 1, 'time' => time(), 'value' => $value, 'customerid' => $cid, 'comment' => trans('Accounted')));
}
}
if ($SYSLOG) {
$args = array(SYSLOG::RES_DOC => $invoiceid, SYSLOG::RES_CUST => $cid, 'closed' => intval(!$closed));
$SYSLOG->AddMessage(SYSLOG::RES_DOC, SYSLOG::OPER_UPDATE, $args);
}
$DB->Execute('UPDATE documents SET closed =
示例4: die
}
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
$AUTH = NULL;
$LMS = new LMS($DB, $AUTH, $SYSLOG);
$LMS->ui_lang = $_ui_language;
$LMS->lang = $_language;
if (!empty($mail_fname)) {
$mail_from = qp_encode($mail_fname) . ' <' . $mail_from . '>';
}
//include(LIB_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'mtsms.php');
function parse_customer_data($data, $row)
{
示例5: unset
$listdata['customer'] = $c;
$listdata['numberplan'] = $p;
$listdata['from'] = $from;
$listdata['to'] = $to;
$listdata['status'] = $s;
unset($documentlist['total']);
unset($documentlist['order']);
unset($documentlist['direction']);
$pagelimit = ConfigHelper::getConfig('phpui.documentlist_pagelimit');
$page = !isset($_GET['page']) ? ceil($listdata['total'] / $pagelimit) : intval($_GET['page']);
$start = ($page - 1) * $pagelimit;
$layout['pagetitle'] = trans('Documents List');
$SESSION->save('backto', $_SERVER['QUERY_STRING']);
if ($docid = $SESSION->get('documentprint')) {
$SMARTY->assign('docid', $docid);
$SESSION->remove('documentprint');
}
if ($listdata['total']) {
$SMARTY->assign('docrights', $DB->GetAllByKey('SELECT doctype, rights
FROM docrights WHERE userid = ? AND rights > 1', 'doctype', array($AUTH->id)));
}
if (!ConfigHelper::checkConfig('phpui.big_networks')) {
$SMARTY->assign('customers', $LMS->GetCustomerNames());
}
$SMARTY->assign('numberplans', $LMS->GetNumberPlans(array('doctype' => array(DOC_CONTRACT, DOC_ANNEX, DOC_PROTOCOL, DOC_ORDER, DOC_SHEET, -6, -7, -8, -9, -99, DOC_PRICELIST, DOC_PROMOTION, DOC_WARRANTY, DOC_REGULATIONS, DOC_OTHER))));
$SMARTY->assign('documentlist', $documentlist);
$SMARTY->assign('pagelimit', $pagelimit);
$SMARTY->assign('page', $page);
$SMARTY->assign('start', $start);
$SMARTY->assign('listdata', $listdata);
$SMARTY->display('document/documentlist.html');
示例6: intval
if (!isset($_GET['d'])) {
$SESSION->restore('cld', $d);
} else {
$d = $_GET['d'];
}
$SESSION->save('cld', $d);
if (!isset($_GET['page'])) {
$SESSION->restore('clp', $_GET['page']);
}
$page = !$_GET['page'] ? 1 : intval($_GET['page']);
$per_page = intval(ConfigHelper::getConfig('phpui.customerlist_pagelimit', 100));
$offset = ($page - 1) * $per_page;
$summary = $LMS->GetCustomerList($o, $s, $n, $g, NULL, NULL, 'AND', $ng, $d, null, null, true);
$total = intval($summary['total']);
$customerlist = $LMS->GetCustomerList($o, $s, $n, $g, NULL, NULL, 'AND', $ng, $d, $per_page, $offset);
$pagination = LMSPaginationFactory::getPagination($page, $total, $per_page, ConfigHelper::checkConfig('phpui.short_pagescroller'));
$listdata['below'] = $summary['below'];
$listdata['over'] = $summary['over'];
$listdata['total'] = $customerlist['total'];
$listdata['order'] = $customerlist['order'];
$listdata['direction'] = $customerlist['direction'];
$listdata['network'] = $n;
$listdata['nodegroup'] = $ng;
$listdata['customergroup'] = $g;
$listdata['division'] = $d;
$listdata['state'] = $s;
$SESSION->save('clp', $page);
unset($customerlist['total']);
unset($customerlist['state']);
unset($customerlist['order']);
unset($customerlist['below']);
示例7: preg_replace
$reply = $LMS->GetMessage($_GET['id']);
if ($reply['replyto']) {
$message['destination'] = preg_replace('/^.* <(.+@.+)>/', '\\1', $reply['replyto']);
} else {
$message['destination'] = preg_replace('/^.* <(.+@.+)>/', '\\1', $reply['mailfrom']);
}
if (!$message['destination'] && !$reply['userid']) {
$message['destination'] = $LMS->GetCustomerEmail($message['customerid']);
if (!empty($message['destination'])) {
$message['destination'] = implode(',', $message['destination']);
}
}
$message['subject'] = 'Re: ' . $reply['subject'];
$message['inreplyto'] = $reply['id'];
$message['references'] = $reply['messageid'];
if (ConfigHelper::checkConfig('phpui.helpdesk_reply_body')) {
$body = explode("\n", textwrap(strip_tags($reply['body']), 74));
foreach ($body as $line) {
$message['body'] .= '> ' . $line . "\n";
}
}
if (!preg_match('/\\[RT#[0-9]{6}\\]/i', $message['subject'])) {
$message['subject'] .= sprintf(' [RT#%06d]', $message['ticketid']);
}
}
}
$layout['pagetitle'] = trans('New Message');
$SESSION->save('backto', $_SERVER['QUERY_STRING']);
$SMARTY->assign('message', $message);
$SMARTY->assign('error', $error);
$SMARTY->assign('userlist', $LMS->GetUserNames());
示例8: isset
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* $Id$
*/
if (!ConfigHelper::checkConfig('privileges.superuser') && !ConfigHelper::checkConfig('privileges.reports')) {
access_denied();
}
$type = isset($_GET['type']) ? $_GET['type'] : '';
switch ($type) {
case 'stats':
/******************************************/
$days = !empty($_GET['days']) ? intval($_GET['days']) : intval($_POST['days']);
$times = !empty($_GET['times']) ? intval($_GET['times']) : intval($_POST['times']);
$queue = !empty($_GET['queue']) ? intval($_GET['queue']) : intval($_POST['queue']);
$categories = !empty($_GET['categories']) ? $_GET['categories'] : $_POST['categories'];
if ($queue) {
$where[] = 'queueid = ' . $queue;
}
if ($days) {
$where[] = 'rttickets.createtime > ' . mktime(0, 0, 0, date('n'), date('j') - $days);
示例9: isset
$plugin_manager->executeHook('userpanel_lms_initialized', $LMS);
$plugin_manager->executeHook('userpanel_smarty_initialized', $SMARTY);
if($SESSION->islogged)
{
$module = isset($_GET['m']) ? $_GET['m'] : '';
if (isset($USERPANEL->MODULES[$module])) $USERPANEL->MODULES[$module]['selected'] = true;
// Userpanel rights module
$rights = $USERPANEL->GetCustomerRights($SESSION->id);
$SMARTY->assign('rights', $rights);
if(ConfigHelper::checkConfig('userpanel.hide_nodes_modules'))
{
if(!$DB->GetOne('SELECT COUNT(*) FROM nodes WHERE ownerid = ? LIMIT 1', array($SESSION->id)))
{
unset($USERPANEL->MODULES['notices']);
unset($USERPANEL->MODULES['stats']);
}
}
// Userpanel popup for urgent notice
$res = $LMS->ExecHook('userpanel_module_call_before', array('module' => $USERPANEL->MODULES['notices']));
$LMS->executeHook('userpanel_' . $module . '_on_load');
$module_dir = null;
foreach ($modules_dirs as $suspected_module_dir)
示例10: invoice_footnote
protected function invoice_footnote($x, $y, $width, $font_size)
{
if (!empty($this->data['division_footer'])) {
$y = $y - $this->backend->getFontHeight($font_size);
//$y = $y - $this->backend->text_align_left($x, $y, $font_size, '<b>' . trans('Notes:') . '</b>');
$tmp = $this->data['division_footer'];
$accounts = array(bankaccount($this->data['customerid'], $this->data['account']));
if (ConfigHelper::checkConfig('invoices.show_all_accounts')) {
$accounts = array_merge($accounts, $this->data['bankaccounts']);
}
foreach ($accounts as &$account) {
$account = format_bankaccount($account);
}
$tmp = str_replace('%bankaccount', implode("\n", $accounts), $tmp);
$tmp = preg_split('/\\r?\\n/', $tmp);
foreach ($tmp as $line) {
$y = $this->backend->text_wrap($x, $y, $width, $font_size, $line, "full");
}
}
}
示例11: list
*
* $Id$
*/
$LMS->executeHook('welcome_on_load');
@(include LIB_DIR . '/locale/' . $_language . '/fortunes.php');
$layout['pagetitle'] = 'LAN Management System';
$layout['dbversion'] = $DB->GetDBVersion();
$layout['dbtype'] = ConfigHelper::getConfig('database.type');
if (ConfigHelper::checkConfig('privileges.superuser')) {
$content = $LMS->CheckUpdates();
if (isset($content['newer_version'])) {
list($v, ) = preg_split('/\\s+/', $LMS->_version);
if (version_compare($content['newer_version'], $v) > 0) {
$SMARTY->assign('newer_version', $content['newer_version']);
}
}
$SMARTY->assign('regdata', $LMS->GetRegisterData());
}
$SMARTY->assign('_dochref', is_dir('doc/html/' . $LMS->ui_lang) ? 'doc/html/' . $LMS->ui_lang . '/' : 'doc/html/en/');
$SMARTY->assign('rtstats', $LMS->RTStats());
if (!ConfigHelper::checkConfig('privileges.hide_sysinfo')) {
$SI = new Sysinfo();
$SMARTY->assign('sysinfo', $SI->get_sysinfo());
}
if (!ConfigHelper::checkConfig('privileges.hide_summaries')) {
$SMARTY->assign('customerstats', $LMS->CustomerStats());
$SMARTY->assign('nodestats', $LMS->NodeStats());
}
$template_file = 'welcome.html';
$template_file = $LMS->executeHook('welcome_before_display', $template_file);
$SMARTY->display($template_file);
示例12: isset
if (isset($_GET['o'])) {
$o = $_GET['o'];
} else {
$SESSION->restore('dnlo', $o);
}
$SESSION->save('dnlo', $o);
if (isset($_POST['cat'])) {
$c = $_POST['cat'];
} else {
$SESSION->restore('dnlc', $c);
}
$SESSION->save('dnlc', $c);
if (isset($_POST['search'])) {
$h = isset($_POST['hideclosed']);
} elseif (($h = $SESSION->get('dnlh')) === NULL) {
$h = ConfigHelper::checkConfig('notes.hide_closed');
}
$SESSION->save('dnlh', $h);
if (isset($_POST['group'])) {
$g = $_POST['group'];
$ge = isset($_POST['groupexclude']) ? $_POST['groupexclude'] : NULL;
} else {
$SESSION->restore('dnlg', $g);
$SESSION->restore('dnlge', $ge);
}
$SESSION->save('dnlg', $g);
$SESSION->save('dnlge', $ge);
if ($c == 'cdate' && $s && preg_match('/^[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}$/', $s)) {
list($year, $month, $day) = explode('/', $s);
$s = mktime(0, 0, 0, $month, $day, $year);
} elseif ($c == 'month' && $s && preg_match('/^[0-9]{4}\\/[0-9]{2}$/', $s)) {
示例13: LmsSwekeyIntegration
$LMS->setPluginManager($plugin_manager);
// Initialize Swekey class
if (ConfigHelper::checkConfig('phpui.use_swekey')) {
require_once LIB_DIR . '/swekey/lms_integration.php';
$LMS_SWEKEY = new LmsSwekeyIntegration($DB, $AUTH, $LMS);
$SMARTY->assign('lms_swekey', $LMS_SWEKEY->GetIntegrationScript($AUTH->id));
}
// Set some template and layout variables
$SMARTY->setTemplateDir(null);
$custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir');
if (!empty($custom_templates_dir) && file_exists(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir) && !is_file(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir)) {
$SMARTY->AddTemplateDir(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir);
}
$SMARTY->AddTemplateDir(array(SMARTY_TEMPLATES_DIR . '/default', SMARTY_TEMPLATES_DIR));
$SMARTY->setCompileDir(SMARTY_COMPILE_DIR);
$SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug');
$layout['logname'] = $AUTH->logname;
$layout['logid'] = $AUTH->id;
$layout['lmsdbv'] = $DB->GetVersion();
$layout['smarty_version'] = SMARTY_VERSION;
$layout['hostname'] = hostname();
$layout['lmsv'] = '1.11-git';
//$layout['lmsvr'] = $LMS->_revision.'/'.$AUTH->_revision;
$layout['lmsvr'] = '';
$layout['dberrors'] = $DB->GetErrors();
$layout['dbdebug'] = $_DBDEBUG;
$layout['popup'] = isset($_GET['popup']) ? true : false;
$SMARTY->assignByRef('layout', $layout);
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
示例14: trans
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
* $Id$
*/
global $LMS, $SESSION, $SMARTY, $invoice, $layout, $type;
$type = ConfigHelper::checkConfig('userpanel.invoice_duplicate') ? trans('DUPLICATE') : trans('ORIGINAL');
if (strtolower(ConfigHelper::getConfig('invoices.type')) == 'pdf') {
include 'invoice_pdf.php';
die;
}
header('Content-Type: ' . ConfigHelper::getConfig('invoices.content_type'));
if (ConfigHelper::getConfig('invoices.attachment_name') != '') {
header('Content-Disposition: attachment; filename=' . ConfigHelper::getConfig('invoices.attachment_name'));
}
$SMARTY->assign('css', file(ConfigHelper::getConfig('directories.sys_dir') . '/img/style_print.css'));
// use LMS templates directory
define('SMARTY_TEMPLATES_DIR', ConfigHelper::getConfig('directories.smarty_templates_dir', ConfigHelper::getConfig('directories.sys_dir') . '/templates'));
$SMARTY->setTemplateDir(null);
$custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir');
if (!empty($custom_templates_dir) && file_exists(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir) && !is_file(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir)) {
$SMARTY->AddTemplateDir(SMARTY_TEMPLATES_DIR . '/' . $custom_templates_dir);
示例15: SendSMS
public function SendSMS($number, $message, $messageid = 0, $script_service = null)
{
$msg_len = mb_strlen($message);
if (!$msg_len) {
return trans('SMS message is empty!');
}
$debug_phone = ConfigHelper::getConfig('sms.debug_phone');
if (!empty($debug_phone)) {
$number = ConfigHelper::getConfig('sms.debug_phone');
}
$prefix = ConfigHelper::getConfig('sms.prefix', '');
$number = preg_replace('/[^0-9]/', '', $number);
$number = preg_replace('/^0+/', '', $number);
// add prefix to the number if needed
if ($prefix && substr($number, 0, strlen($prefix)) != $prefix) {
$number = $prefix . $number;
}
// message ID must be unique
if (!$messageid) {
$messageid = '0.' . time();
}
$message = preg_replace("/\r/", "", $message);
if (ConfigHelper::checkConfig('sms.transliterate_message')) {
$message = iconv('UTF-8', 'ASCII//TRANSLIT', $message);
}
$max_length = ConfigHelper::getConfig('sms.max_length');
if (!empty($max_length) && intval($max_length) > 6 && $msg_len > intval($max_length)) {
$message = mb_substr($message, 0, $max_length - 6) . ' [...]';
}
$service = ConfigHelper::getConfig('sms.service');
if ($script_service) {
$service = $script_service;
} elseif (empty($service)) {
return trans('SMS "service" not set!');
}
$errors = array();
foreach (explode(',', $service) as $service) {
$data = array('number' => $number, 'message' => $message, 'messageid' => $messageid, 'service' => $service);
// call external SMS handler(s)
$data = $this->ExecHook('send_sms_before', $data);
$data = $this->executeHook('send_sms_before', $data);
if ($data['abort']) {
if (is_string($data['result'])) {
$errors[] = $data['result'];
continue;
} else {
return $data['result'];
}
}
$number = $data['number'];
$message = $data['message'];
$messageid = $data['messageid'];
if (in_array($service, array('smscenter', 'serwersms', 'smsapi'))) {
if (!function_exists('curl_init')) {
$errors[] = trans('Curl extension not loaded!');
continue;
}
$username = ConfigHelper::getConfig('sms.username');
if (empty($username)) {
$errors[] = trans('SMSCenter username not set!');
continue;
}
$password = ConfigHelper::getConfig('sms.password');
if (empty($password)) {
$errors[] = trans('SMSCenter username not set!');
continue;
}
$from = ConfigHelper::getConfig('sms.from');
if (empty($from)) {
$errors[] = trans('SMS "from" not set!');
continue;
}
if (strlen($number) > 16 || strlen($number) < 4) {
$errors[] = trans('Wrong phone number format!');
continue;
}
}
switch ($service) {
case 'smscenter':
if ($msg_len < 160) {
$type_sms = 'sms';
} else {
if ($msg_len <= 459) {
$type_sms = 'concat';
} else {
$errors[] = trans('SMS Message too long!');
continue 2;
}
}
$type = ConfigHelper::getConfig('sms.smscenter_type', 'dynamic');
$message .= $type == 'static' ? "\n\n" . $from : '';
$args = array('user' => ConfigHelper::getConfig('sms.username'), 'pass' => ConfigHelper::getConfig('sms.password'), 'type' => $type_sms, 'number' => $number, 'text' => $message, 'from' => $from);
$encodedargs = array();
foreach (array_keys($args) as $thiskey) {
array_push($encodedargs, urlencode($thiskey) . "=" . urlencode($args[$thiskey]));
}
$encodedargs = implode('&', $encodedargs);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://api.statsms.net/send.php');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//.........这里部分代码省略.........