本文整理汇总了PHP中chkconfig函数的典型用法代码示例。如果您正苦于以下问题:PHP chkconfig函数的具体用法?PHP chkconfig怎么用?PHP chkconfig使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chkconfig函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_conf
function check_conf($name)
{
global $CONFIG;
list($section, $name) = explode('.', $name, 2);
if (empty($name)) {
return false;
}
if ($section == 'privileges' && !empty($CONFIG['privileges']['superuser'])) {
return preg_match('/^hide/', $name) ? false : true;
}
if (!array_key_exists($section, $CONFIG)) {
return false;
}
if (!array_key_exists($name, $CONFIG[$section])) {
return false;
}
return chkconfig($CONFIG[$section][$name]);
}
示例2: define
define('UPLOADFILES_DIR', $CONFIG['directories']['uploadfiles_dir']);
define('MODULES_DIR', $CONFIG['directories']['modules_dir']);
define('SMARTY_COMPILE_DIR', $CONFIG['directories']['smarty_compile_dir']);
define('SMARTY_TEMPLATES_DIR', $CONFIG['directories']['smarty_templates_dir']);
define('PLUG_DIR', $CONFIG['directories']['plug_dir']);
define('INVOICE_DIR', $CONFIG['directories']['invoice_dir']);
// Do some checks and load config defaults
//require_once(LIB_DIR.'/checkdirs.php');
require_once LIB_DIR . '/config.php';
// Init database
$_DBTYPE = $CONFIG['database']['type'];
$_DBHOST = $CONFIG['database']['host'];
$_DBUSER = $CONFIG['database']['user'];
$_DBPASS = $CONFIG['database']['password'];
$_DBNAME = $CONFIG['database']['database'];
$_DBDEBUG = isset($CONFIG['database']['debug']) ? chkconfig($CONFIG['database']['debug']) : FALSE;
require LIB_DIR . '/LMSDB.php';
$DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME, $_DBDEBUG);
if (!$DB) {
// can't working without database
die;
}
// Call any of upgrade process before anything else
require_once LIB_DIR . '/upgradedb.php';
// Initialize templates engine (must be before locale settings)
require_once LIB_DIR . '/Smarty/Smarty.class.php';
$SMARTY = new Smarty();
// test for proper version of Smarty
if (defined('Smarty::SMARTY_VERSION')) {
$ver_chunks = preg_split('/[- ]/', Smarty::SMARTY_VERSION);
} else {
示例3: NetDevAdd
function NetDevAdd($data)
{
$data = $this->exechook('lms_netdev_add_before', $data);
if ($this->DB->Execute('INSERT INTO netdevices (name, location,
location_city, location_street, location_house, location_flat,
description, producer, model, serialnumber,
ports, purchasetime, guaranteeperiod, shortname,
nastype, clients, secret, community, channelid,
longitude, latitude, monit_nastype, monit_login, monit_passwd, monit_port, networknodeid, server, coaport,
devtype, managed, sharing, modular, backbone_layer, distribution_layer, access_layer, typeofdevice, netdevicemodelid,
invprojectid, status, login, passwd, ebgp, ibgp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?)', array($data['name'], $data['location'] ? $data['location'] : '', $data['location_city'] ? $data['location_city'] : null, $data['location_street'] ? $data['location_street'] : null, $data['location_house'] ? $data['location_house'] : null, $data['location_flat'] ? $data['location_flat'] : null, $data['description'] ? $data['description'] : '', $data['producer'] ? $data['producer'] : '', $data['model'] ? $data['model'] : '', $data['serialnumber'] ? $data['serialnumber'] : '', $data['ports'] ? $data['ports'] : 0, $data['purchasetime'] ? $data['purchasetime'] : 0, $data['guaranteeperiod'] ? $data['guaranteeperiod'] : 0, $data['shortname'] ? $data['shortname'] : '', $data['nastype'] ? $data['nastype'] : 0, $data['clients'] ? $data['clients'] : 0, $data['secret'] ? $data['secret'] : '', $data['community'] ? $data['community'] : '', !empty($data['channelid']) ? $data['channelid'] : NULL, !empty($data['longitude']) ? str_replace(',', '.', $data['longitude']) : NULL, !empty($data['latitude']) ? str_replace(',', '.', $data['latitude']) : NULL, $data['monit_nastype'] ? $data['monit_nastype'] : 0, $data['monit_login'] ? $data['monit_login'] : '', $data['monit_passwd'] ? $data['monit_passwd'] : '', $data['monit_port'] ? $data['monit_port'] : NULL, $data['networknode'] ? $data['networknode'] : 0, $data['server'] ? $data['server'] : '', $data['coaport'] ? $data['coaport'] : NULL, $data['devtype'] ? 1 : 0, $data['managed'] ? 1 : 0, $data['sharing'] ? 1 : 0, $data['modular'] ? 1 : 0, $data['backbone_layer'] ? 1 : 0, $data['distribution_layer'] ? 1 : 0, $data['access_layer'] ? 1 : 0, $data['typeofdevice'] ? $data['typeofdevice'] : 0, $data['netdevicemodelid'] ? $data['netdevicemodelid'] : NULL, $data['invprojectid'] ? $data['invprojectid'] : NULL, $data['status'] ? $data['status'] : 0, $data['login'] ? $data['login'] : NULL, $data['passwd'] ? $data['passwd'] : NULL, $data['ebgp'] ? $data['ebgp'] : 0, $data['ibgp'] ? $data['ibgp'] : 0))) {
$id = $this->DB->GetLastInsertID('netdevices');
// EtherWerX support (devices have some limits)
// We must to replace big ID with smaller (first free)
if ($id > 99999 && chkconfig($this->CONFIG['phpui']['ewx_support'])) {
$this->DB->BeginTrans();
$this->DB->LockTables('ewx_channels');
if ($newid = $this->DB->GetOne('SELECT n.id + 1 FROM ewx_channels n
LEFT OUTER JOIN ewx_channels n2 ON n.id + 1 = n2.id
WHERE n2.id IS NULL AND n.id <= 99999
ORDER BY n.id ASC LIMIT 1')) {
$this->DB->Execute('UPDATE ewx_channels SET id = ? WHERE id = ?', array($newid, $id));
$id = $newid;
}
$this->DB->UnLockTables();
$this->DB->CommitTrans();
}
$data['id'] = $id;
$this->exechook('lms_netdev_add_after', $data);
return $id;
} else {
return FALSE;
}
}
示例4: commit_cashimport
function commit_cashimport()
{
global $DB, $LMS, $CONFIG;
$imports = $DB->GetAll('SELECT i.*, f.idate
FROM cashimport i
LEFT JOIN sourcefiles f ON (f.id = i.sourcefileid)
WHERE i.closed = 0 AND i.customerid <> 0');
if (!empty($imports)) {
$idate = isset($CONFIG['finances']['cashimport_use_idate']) && chkconfig($CONFIG['finances']['cashimport_use_idate']);
$icheck = isset($CONFIG['finances']['cashimport_checkinvoices']) && chkconfig($CONFIG['finances']['cashimport_checkinvoices']);
foreach ($imports as $import) {
$DB->BeginTrans();
$balance['time'] = $idate ? $import['idate'] : $import['date'];
$balance['type'] = 1;
$balance['value'] = $import['value'];
$balance['customerid'] = $import['customerid'];
$balance['comment'] = $import['description'];
$balance['importid'] = $import['id'];
$balance['sourceid'] = $import['sourceid'];
$balance['userid'] = 0;
if ($import['value'] > 0 && $icheck) {
if ($invoices = $DB->GetAll('SELECT d.id,
(SELECT SUM(value*count) FROM invoicecontents WHERE docid = d.id) +
COALESCE((SELECT SUM((a.value+b.value)*(a.count+b.count)) - SUM(b.value*b.count)
FROM documents dd
JOIN invoicecontents a ON (a.docid = dd.id)
JOIN invoicecontents b ON (dd.reference = b.docid AND a.itemid = b.itemid)
WHERE dd.reference = d.id
GROUP BY dd.reference), 0) AS value
FROM documents d
WHERE d.customerid = ? AND d.type = ? AND d.closed = 0
GROUP BY d.id, d.cdate ORDER BY d.cdate', array($balance['customerid'], DOC_INVOICE))) {
foreach ($invoices as $inv) {
$sum += $inv['value'];
}
$bval = $LMS->GetCustomerBalance($balance['customerid']);
$value = f_round($bval + $import['value'] + $sum);
foreach ($invoices as $inv) {
$inv['value'] = f_round($inv['value']);
if ($inv['value'] > $value) {
break;
} else {
// close invoice and assigned credit notes
$DB->Execute('UPDATE documents SET closed = 1
WHERE id = ? OR reference = ?', array($inv['id'], $inv['id']));
$value -= $inv['value'];
}
}
}
}
$DB->Execute('UPDATE cashimport SET closed = 1 WHERE id = ?', array($import['id']));
$LMS->AddBalance($balance);
$DB->CommitTrans();
}
}
}
示例5: explode
list($d,$m) = explode('/',$a['at']);
}
if(!$error)
{
if($d>30 || $d<1 || ($d>28 && $m==2))
$error['at'] = trans('This month doesn\'t contain specified number of days');
if($m>6 || $m<1)
$error['at'] = trans('Incorrect month number (max.6)!');
$at = ($m-1) * 100 + $d;
}
break;
case YEARLY:
if(chkconfig($CONFIG['phpui']['use_current_payday']) && !$a['at'])
{
$d = date('j', time());
$m = date('n', time());
$a['at'] = $d.'/'.$m;
}
elseif(!preg_match('/^[0-9]{2}\/[0-9]{2}$/', $a['at']))
{
$error['at'] = trans('Incorrect date format! Enter date in DD/MM format!');
}
else
{
list($d,$m) = explode('/',$a['at']);
}
if(!$error)
示例6: LMSTV
}
} else {
$voip = NULL;
}
if (get_conf('sms.service') == 'serwersms') {
require_once LIB_DIR . '/SerwerSMS_api.php';
}
if (get_conf('jambox.enabled', 0)) {
require_once LIB_DIR . '/LMS.tv.class.php';
$LMSTV = new LMSTV($DB, $AUTH, $CONFIG);
}
// Set some template and layout variables
$SMARTY->setTemplateDir(NULL);
$SMARTY->addTemplateDir(array(SMARTY_TEMPLATES_DIR . '/custom', SMARTY_TEMPLATES_DIR));
$SMARTY->compile_dir = SMARTY_COMPILE_DIR;
$SMARTY->debugging = isset($CONFIG['phpui']['smarty_debug']) ? chkconfig($CONFIG['phpui']['smarty_debug']) : FALSE;
$SMARTY->use_sub_dirs = TRUE;
//$SMARTY->error_reporting = false;
$SMARTY->error_unassigned = false;
$my_security_policy = new Smarty_Security($SMARTY);
$my_security_policy->allow_php_tag = true;
$my_security_policy->php_functions = array();
$my_security_policy->php_handling = Smarty::PHP_PASSTHRU;
$my_security_policy->php_modifier = array();
$my_security_policy->modifiers = array();
$SMARTY->assignByRef('layout', $layout);
$SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
$SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
$SMARTY->assignByRef('_language', $LMS->lang);
$SMARTY->assignByRef('global_warning', $SESSION->global_warning);
$error = NULL;
示例7: array
$message['ticketid'] = $_GET['ticketid'];
$message['customerid'] = $DB->GetOne('SELECT customerid FROM rttickets WHERE id = ?', array($message['ticketid']));
if (isset($_GET['id'])) {
$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']);
}
$message['subject'] = 'Re: ' . $reply['subject'];
$message['inreplyto'] = $reply['id'];
$message['references'] = $reply['messageid'];
if (isset($CONFIG['phpui']['helpdesk_reply_body']) && chkconfig($CONFIG['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->display('rtmessageadd.html');
示例8: NetDevAdd
function NetDevAdd($data)
{
if ($this->DB->Execute('INSERT INTO netdevices (name, location,
location_city, location_street, location_house, location_flat,
description, producer, model, serialnumber,
ports, purchasetime, guaranteeperiod, shortname,
nastype, clients, secret, community, channelid,
longitude, latitude)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($data['name'], $data['location'], $data['location_city'] ? $data['location_city'] : null, $data['location_street'] ? $data['location_street'] : null, $data['location_house'] ? $data['location_house'] : null, $data['location_flat'] ? $data['location_flat'] : null, $data['description'], $data['producer'], $data['model'], $data['serialnumber'], $data['ports'], $data['purchasetime'], $data['guaranteeperiod'], $data['shortname'], $data['nastype'], $data['clients'], $data['secret'], $data['community'], !empty($data['channelid']) ? $data['channelid'] : NULL, !empty($data['longitude']) ? str_replace(',', '.', $data['longitude']) : NULL, !empty($data['latitude']) ? str_replace(',', '.', $data['latitude']) : NULL))) {
$id = $this->DB->GetLastInsertID('netdevices');
// EtherWerX support (devices have some limits)
// We must to replace big ID with smaller (first free)
if ($id > 99999 && chkconfig($this->CONFIG['phpui']['ewx_support'])) {
$this->DB->BeginTrans();
$this->DB->LockTables('ewx_channels');
if ($newid = $this->DB->GetOne('SELECT n.id + 1 FROM ewx_channels n
LEFT OUTER JOIN ewx_channels n2 ON n.id + 1 = n2.id
WHERE n2.id IS NULL AND n.id <= 99999
ORDER BY n.id ASC LIMIT 1')) {
$this->DB->Execute('UPDATE ewx_channels SET id = ? WHERE id = ?', array($newid, $id));
$id = $newid;
}
$this->DB->UnLockTables();
$this->DB->CommitTrans();
}
return $id;
} else {
return FALSE;
}
}
示例9: foreach
if ($part->type == 3 && strpos($part->dparameters[0]->value, '.7z')) {
$attachments[$partid][filename] = $part->dparameters[0]->value;
$attachments[$partid][bytes] = $part->bytes;
$attachments[$partid][pos] = $partid + 1;
$attachments[$partid][id] = $postid;
}
}
}
}
if ($attachments) {
foreach ($attachments as $attachment) {
$filename = '/tmp/' . $attachment[filename];
$filelist[] = str_replace('7z', 'xml', $filename);
$file = fopen($filename, 'w');
stream_filter_append($file, 'convert.base64-decode', STREAM_FILTER_WRITE);
if (chkconfig($cashimport['use_seen_flag'])) {
imap_savebody($ih, $file, $attachment[id], $attachment[pos]);
} else {
imap_savebody($ih, $file, $attachment[id], $attachment[pos], FT_PEEK);
}
exec('7za e ' . $filename . ' -p' . $cashimport['7zpasswd'] . ' -o/tmp -y', $debug);
fclose($file);
}
}
}
}
imap_close($ih);
}
if (!empty($filelist)) {
$count = sizeof($filelist);
$cash = array();
示例10: die
$ver_chunks = NULL;
}
if (count($ver_chunks) != 2 || version_compare('3.0', $ver_chunks[1]) > 0) {
die('<B>Wrong version of Smarty engine! We support only Smarty-3.x greater than 3.0.</B>');
}
define('SMARTY_VERSION', $ver_chunks[1]);
// system localization
require_once LIB_DIR . '/language.php';
// Read configuration of LMS-UI from database
if ($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) {
foreach ($cfg as $row) {
$CONFIG[$row['section']][$row['var']] = $row['value'];
}
}
// Redirect to SSL
$_FORCE_SSL = isset($CONFIG['phpui']['force_ssl']) ? chkconfig($CONFIG['phpui']['force_ssl']) : FALSE;
if ($_FORCE_SSL && $_SERVER['HTTPS'] != 'on') {
header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit(0);
}
// EXPERIMENTAL CODE! USE WITH CAUTION ;-)
$_LMSDIR = dirname(__FILE__);
require_once LIB_DIR . '/ExecStack.class.php';
$ExecStack = new ExecStack($_LMSDIR . '/modules/', isset($_GET['m']) ? $_GET['m'] : NULL, isset($_GET['a']) ? $_GET['a'] : NULL);
// don't use foreach() below, because privileges checking action
// will probably need to remove some actions from stack
// Note: that action should be executed first
while (list(, $execute) = each($ExecStack->_EXECSTACK['actions'])) {
// do include once, because testing that language for executed module has been already loaded
// will take some time, so let's PHP decide if we already loaded it or what...
@(include_once $_LMSDIR . '/modules/' . $execute['module'] . '/lang/' . $_language . '.php');
示例11: intval
$marks[$idx] = intval($id);
}
}
if (!empty($marks)) {
$imports = $DB->GetAll('SELECT i.*, f.idate
FROM cashimport i
LEFT JOIN sourcefiles f ON (f.id = i.sourcefileid)
WHERE i.id IN ('.implode(',', $marks).')');
}
if (!empty($imports)) {
$idate = isset($CONFIG['finances']['cashimport_use_idate'])
&& chkconfig($CONFIG['finances']['cashimport_use_idate']);
$icheck = isset($CONFIG['finances']['cashimport_checkinvoices'])
&& chkconfig($CONFIG['finances']['cashimport_checkinvoices']);
foreach ($imports as $import) {
$DB->BeginTrans();
$balance['time'] = $idate ? $import['idate'] : $import['date'];
$balance['type'] = 1;
$balance['value'] = $import['value'];
$balance['customerid'] = $customers[$import['id']];
$balance['comment'] = $import['description'];
$balance['importid'] = $import['id'];
$balance['sourceid'] = $import['sourceid'];
if ($import['value'] > 0 && $icheck)
{
示例12: isset
$SESSION->remove('notenewerror');
if (isset($_GET['print'])) {
$SESSION->save('noteprint', $nid);
}
$SESSION->redirect('?m=noteadd&action=init');
}
break;
}
$SESSION->save('note', $note);
$SESSION->save('notecontents', isset($contents) ? $contents : NULL);
$SESSION->save('notecustomer', isset($customer) ? $customer : NULL);
$SESSION->save('notenewerror', isset($error) ? $error : NULL);
if ($action) {
// redirect needed because we don't want to destroy contents of note in order of page refresh
$SESSION->redirect('?m=noteadd');
}
if (!isset($CONFIG['phpui']['big_networks']) || !chkconfig($CONFIG['phpui']['big_networks'])) {
$SMARTY->assign('customers', $LMS->GetCustomerNames());
}
if ($newnote = $SESSION->get('noteprint')) {
$SMARTY->assign('newnoteid', $newnote);
$SESSION->remove('noteprint');
}
$layout['pagetitle'] = trans('New Debit Note<!long>');
$SMARTY->assign('error', $error);
$SMARTY->assign('contents', $contents);
$SMARTY->assign('customer', $customer);
$SMARTY->assign('note', $note);
$SMARTY->assign('numberplanlist', $LMS->GetNumberPlans(DOC_DNOTE, date('Y/m', $note['cdate'])));
//$SMARTY->assign('taxeslist', $taxeslist);
$SMARTY->display('noteadd.html');