本文整理汇总了PHP中ConfigHelper::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigHelper::getConfig方法的具体用法?PHP ConfigHelper::getConfig怎么用?PHP ConfigHelper::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigHelper
的用法示例。
在下文中一共展示了ConfigHelper::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MessageAdd
function MessageAdd($msg, $headers, $files = NULL)
{
global $DB, $LMS;
$time = time();
$head = '';
if ($headers) {
foreach ($headers as $idx => $header) {
$head .= $idx . ": " . $header . "\n";
}
}
$DB->Execute('INSERT INTO rtmessages (ticketid, createtime, subject, body, userid, customerid, mailfrom, inreplyto, messageid, replyto, headers)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($msg['ticketid'], $time, $msg['subject'], preg_replace("/\r/", "", $msg['body']), $msg['userid'], $msg['customerid'], $msg['mailfrom'], $msg['inreplyto'], $msg['messageid'], isset($msg['replyto']) ? $msg['replyto'] : $headers['Reply-To'], $head));
$mail_dir = ConfigHelper::getConfig('rt.mail_dir');
if (!empty($files) && !empty($mail_dir)) {
$id = $DB->GetLastInsertId('rtmessages');
$dir = $mail_dir . sprintf('/%06d/%06d', $msg['ticketid'], $id);
@mkdir($mail_dir . sprintf('/%06d', $msg['ticketid']), 0700);
@mkdir($dir, 0700);
foreach ($files as $file) {
$newfile = $dir . '/' . $file['name'];
if (@rename($file['tmp_name'], $newfile)) {
$DB->Execute('INSERT INTO rtattachments (messageid, filename, contenttype)
VALUES (?,?,?)', array($id, $file['name'], $file['type']));
}
}
}
}
示例2: module_setup
function module_setup()
{
global $SMARTY, $DB, $USERPANEL, $layout, $LMS;
$layout['pagetitle'] = trans('Userpanel Configuration');
$SMARTY->assign('page_header', ConfigHelper::getConfig('userpanel.page_header', ''));
$SMARTY->assign('company_logo', ConfigHelper::getConfig('userpanel.company_logo', ''));
$SMARTY->assign('stylelist', getdir(USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style', '^[a-z0-9]*$'));
$SMARTY->assign('style', ConfigHelper::getConfig('userpanel.style', 'default'));
$SMARTY->assign('hint', ConfigHelper::getConfig('userpanel.hint', 'modern'));
$SMARTY->assign('hide_nodes_modules', ConfigHelper::getConfig('userpanel.hide_nodes_modules', 0));
$SMARTY->assign('reminder_mail_sender', ConfigHelper::getConfig('userpanel.reminder_mail_sender', ''));
$SMARTY->assign('reminder_mail_subject', ConfigHelper::getConfig('userpanel.reminder_mail_subject', trans('credential reminder')));
$SMARTY->assign('reminder_mail_body', ConfigHelper::getConfig('userpanel.reminder_mail_body', "ID: %id\nPIN: %pin"));
$SMARTY->assign('reminder_sms_body', ConfigHelper::getConfig('userpanel.reminder_sms_body', "ID: %id, PIN: %pin"));
$SMARTY->assign('auth_type', ConfigHelper::getConfig('userpanel.auth_type', 1));
$SMARTY->assign('force_ssl', ConfigHelper::getConfig('userpanel.force_ssl', ConfigHelper::getConfig('phpui.force_ssl', 1)));
$enabled_modules = ConfigHelper::getConfig('userpanel.enabled_modules', null, true);
if (is_null($enabled_modules)) {
$enabled_modules = array();
if (!empty($USERPANEL->MODULES)) {
foreach ($USERPANEL->MODULES as $module) {
$enabled_modules[] = $module['module'];
}
}
$DB->Execute("INSERT INTO uiconfig (section, var, value) VALUES (?, ?, ?)", array('userpanel', 'enabled_modules', implode(',', $enabled_modules)));
} else {
$enabled_modules = explode(',', $enabled_modules);
}
$SMARTY->assign('enabled_modules', $enabled_modules);
$SMARTY->assign('total', sizeof($USERPANEL->MODULES));
$SMARTY->display('file:' . USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'setup.html');
}
示例3: main_form
protected function main_form($x, $y)
{
$balance = $this->data['balance'] < 0 ? -$this->data['balance'] : $this->data['balance'];
$font_size = 14;
$lineh = 25;
$x += ConfigHelper::getConfig('finances.leftmargin', 0, true);
$y += ConfigHelper::getConfig('finances.bottommargin', 0, true);
$y += 275;
$this->backend->addText($x, $y, $font_size, $this->data['d_name']);
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trim($this->data['d_zip'] . ' ' . $this->data['d_city'] . ' ' . $this->data['d_address']));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, format_bankaccount(bankaccount($this->data['id'], $this->data['account'])));
$y -= $lineh;
$this->backend->addText($x + 220, $y, $font_size, sprintf('%.2f', $balance));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trans('$a dollars $b cents', to_words(floor($balance)), to_words(round(($balance - floor($balance)) * 100))));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, $this->truncate($this->data['customername']));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, $this->truncate(trim($this->data['zip'] . ' ' . $this->data['city'] . ' ' . $this->data['address'])));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, ConfigHelper::getConfig('finances.pay_title', trans('Not set')));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trans('Customer ID: $a', sprintf('%04d', $this->data['id'])));
}
示例4: invoice_body
function invoice_body()
{
global $invoice, $pdf;
if (isset($invoice['invoice'])) {
$template = ConfigHelper::getConfig('invoices.cnote_template_file');
} else {
$template = ConfigHelper::getConfig('invoices.template_file');
}
switch ($template) {
case "standard":
invoice_body_standard();
break;
case "FT-0100":
invoice_body_ft0100();
break;
default:
if (file_exists($template)) {
require $template;
} else {
//go to LMS modules directory
require MODULES_DIR . '/' . $template;
}
}
if (!isset($invoice['last'])) {
new_page();
}
}
示例5: note_recipient
public function note_recipient()
{
$oldy = $this->backend->GetY();
$recipient = '<b>' . trans('Note recipient:') . '</b><br>';
$recipient .= $this->data['name'] . '<br>';
$recipient .= $this->data['address'] . '<br>';
$recipient .= $this->data['zip'] . ' ' . $this->data['city'] . '<br>';
if ($this->data['ten']) {
$recipient .= trans('TEN') . ': ' . $this->data['ten'] . '<br>';
} elseif ($this->data['ssn']) {
$recipient .= trans('SSN') . ': ' . $this->data['ssn'] . '<br>';
}
$this->backend->SetFont('arial', '', 10);
$this->backend->writeHTMLCell(80, '', 125, 50, $recipient, 0, 1, 0, true, 'L');
$y = $this->backend->GetY();
if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_bankaccount', true))) {
$bankaccount = trans('Bank account:') . ' <b>' . format_bankaccount(bankaccount($this->data['customerid'], $this->data['account'])) . '</b>';
$this->backend->SetFont('arial', 'B', 8);
$this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy - 8) / 2), $bankaccount, 0, 1, 0, true, 'L');
}
if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_credentials', true))) {
$pin = '<b>' . trans('Customer ID: $a', sprintf('%04d', $this->data['customerid'])) . '</b><br>';
$pin .= '<b>PIN: ' . sprintf('%04d', $this->data['customerpin']) . '</b><br>';
$this->backend->SetFont('arial', 'B', 8);
$this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy) / 2), $pin, 0, 1, 0, true, 'L');
}
$this->backend->SetY($y);
}
示例6: WriteToBrowser
public function WriteToBrowser($filename = null)
{
$this->PrepareFullContents();
header('Content-Type: ' . ConfigHelper::getConfig($this->config_section . '.content_type'));
if (!is_null($filename)) {
header('Content-Disposition: inline; filename=' . $filename);
}
echo $this->contents;
}
示例7: module_setup
function module_setup()
{
global $SMARTY, $LMS;
$SMARTY->assign('disable_transferform', ConfigHelper::getConfig('userpanel.disable_transferform'));
$SMARTY->assign('disable_invoices', ConfigHelper::getConfig('userpanel.disable_invoices'));
$SMARTY->assign('invoice_duplicate', ConfigHelper::getConfig('userpanel.invoice_duplicate'));
$SMARTY->assign('show_tariffname', ConfigHelper::getConfig('userpanel.show_tariffname'));
$SMARTY->assign('show_speeds', ConfigHelper::getConfig('userpanel.show_speeds'));
$SMARTY->display('module:finances:setup.html');
}
示例8: __construct
public function __construct(&$DB, &$SESSION)
{
// ustawia zmienne klasy
$this->DB =& $DB;
$this->SESSION =& $SESSION;
$module_order = ConfigHelper::getConfig('userpanel.module_order', '', true);
if (strlen($module_order)) {
$this->module_order = array_flip(explode(',', $module_order));
}
}
示例9: Draw
public function Draw($data)
{
parent::Draw($data);
$template_file = ConfigHelper::getConfig('notes.template_file');
if (!$this->smarty->templateExists($template_file)) {
$template_file = 'note' . DIRECTORY_SEPARATOR . $template_file;
}
$this->smarty->assign('note', $this->data);
$this->contents .= $this->smarty->fetch($template_file);
}
示例10: pngdrawtext
function pngdrawtext($image, $font, $x, $y, $text, $color, $bgcolor)
{
if (ConfigHelper::getConfig('phpui.gd_translate_to')) {
$text = iconv('UTF-8', ConfigHelper::getConfig('phpui.gd_translate_to'), $text);
}
imagestring($image, $font, $x + 1, $y + 1, $text, $bgcolor);
imagestring($image, $font, $x + 1, $y - 1, $text, $bgcolor);
imagestring($image, $font, $x - 1, $y + 1, $text, $bgcolor);
imagestring($image, $font, $x - 1, $y - 1, $text, $bgcolor);
imagestring($image, $font, $x, $y, $text, $color);
}
示例11: Draw
public function Draw($data)
{
parent::Draw($data);
$template_file = ConfigHelper::getConfig('receipts.template_file');
if (!$this->smarty->templateExists('file:' . $template_file)) {
$template_file = 'receipt' . DIRECTORY_SEPARATOR . $template_file;
}
$this->smarty->assign('type', $this->data['which']);
$this->smarty->assign('receipt', $this->data);
$this->contents .= $this->smarty->fetch('file:' . $template_file);
}
示例12: module_get_timestamp
function module_get_timestamp($tpl_name, &$tpl_timestamp, $smarty_obj)
{
global $LMS;
$template = explode(':', $tpl_name);
$template_path = ConfigHelper::getConfig('directories.userpanel_dir') . '/modules/' . $template[0] . '/templates/' . $template[1];
if (file_exists($template_path)) {
$tpl_timestamp = filectime($template_path);
return true;
} else {
return false;
}
}
示例13: smartyCashImportOKBS
public function smartyCashImportOKBS(Smarty $hook_data)
{
$template_dirs = $hook_data->getTemplateDir();
$plugin_templates = PLUGINS_DIR . DIRECTORY_SEPARATOR . LMSCustomersAgePlugin::PLUGIN_DIRECTORY_NAME . DIRECTORY_SEPARATOR . 'templates';
$custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir');
if (!empty($custom_templates_dir) && file_exists($plugin_templates . DIRECTORY_SEPARATOR . $custom_templates_dir) && !is_file($plugin_tempaltes . DIRECTORY_SEPARATOR . $custom_templates_dir)) {
$plugin_templates = PLUGINS_DIR . DIRECTORY_SEPARATOR . LMSCustomersAgePlugin::PLUGIN_DIRECTORY_NAME . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $custom_templates_dir;
}
array_unshift($template_dirs, $plugin_templates);
$hook_data->setTemplateDir($template_dirs);
return $hook_data;
}
示例14: __construct
/**
* Loads plugins
*
* @throws Exception Throws exception if plugin not found
*/
public function __construct()
{
$dirs = getdir(PLUGINS_DIR, '^[0-9a-zA-Z]+$');
if (empty($dirs)) {
return;
}
asort($dirs);
$plugins_config = ConfigHelper::getConfig('phpui.plugins');
$plugins_tuples = empty($plugins_config) ? array() : preg_split('/[;,\\s\\t\\n]+/', $plugins_config, -1, PREG_SPLIT_NO_EMPTY);
$plugin_priorities = array();
foreach ($plugins_tuples as $idx => $plugin_tuple) {
$plugin_props = explode(':', $plugin_tuple);
$plugin_priorities[$plugin_props[0]] = count($plugin_props) == 2 ? intval($plugin_props[1]) : SubjectInterface::LAST_PRIORITY;
$plugins_tuples[$idx] = $plugin_props[0];
}
foreach ($dirs as $plugin_name) {
if (class_exists($plugin_name)) {
$plugin_name::loadLocales();
$plugin_info = array('name' => $plugin_name, 'enabled' => false, 'new_style' => true, 'dbcurrschversion' => null, 'dbschversion' => defined($plugin_name . '::PLUGIN_DBVERSION') ? constant($plugin_name . '::PLUGIN_DBVERSION') : null, 'fullname' => defined($plugin_name . '::PLUGIN_NAME') ? trans(constant($plugin_name . '::PLUGIN_NAME')) : null, 'description' => defined($plugin_name . '::PLUGIN_DESCRIPTION') ? trans(constant($plugin_name . '::PLUGIN_DESCRIPTION')) : null, 'author' => defined($plugin_name . '::PLUGIN_AUTHOR') ? constant($plugin_name . '::PLUGIN_AUTHOR') : null);
if (array_key_exists($plugin_name, $plugin_priorities)) {
$plugin = new $plugin_name();
if (!$plugin instanceof LMSPlugin) {
throw new Exception("Plugin object must be instance of LMSPlugin class");
}
$plugin_info = array_merge($plugin_info, array('enabled' => true, 'priority' => $plugin_priorities[$plugin_name], 'dbcurrschversion' => $plugin->getDbSchemaVersion()));
$this->registerObserver($plugin, $plugin_info['priority']);
}
$this->new_style_plugins[$plugin_name] = $plugin_info;
} else {
writesyslog("Unknown plugin {$plugin_name} at position {$position}", LOG_ERR);
continue;
}
}
$files = getdir(LIB_DIR . DIRECTORY_SEPARATOR . 'plugins', '^[0-9a-zA-Z_\\-]+\\.php$');
if (empty($files)) {
return;
}
asort($files);
$old_plugins = array_diff($plugins_tuples, array_keys($this->new_style_plugins));
foreach ($files as $plugin_name) {
if (!is_readable(LIB_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $plugin_name)) {
continue;
}
$plugin_name = str_replace('.php', '', $plugin_name);
$plugin_info = array('name' => $plugin_name, 'enabled' => false, 'new_style' => false);
if (array_key_exists($plugin_name, $plugin_priorities)) {
$plugin_info['enabled'] = true;
}
$this->old_style_plugins[$plugin_name] = $plugin_info;
}
}
示例15: DBLoad
function DBLoad($filename = NULL)
{
global $DB, $SYSLOG;
if (!$filename) {
return FALSE;
}
$finfo = pathinfo($filename);
$ext = $finfo['extension'];
if ($ext == 'gz' && extension_loaded('zlib')) {
$file = gzopen($filename, 'r');
} else {
$file = fopen($filename, 'r');
}
if (!$file) {
return FALSE;
}
$DB->BeginTrans();
// przyspieszmy działanie jeżeli baza danych obsługuje transakcje
while (!feof($file)) {
$line = fgets($file, 8192);
if ($line != '') {
$line = str_replace(";\n", '', $line);
$DB->Execute($line);
}
}
$DB->CommitTrans();
if (extension_loaded('zlib') && $ext == 'gz') {
gzclose($file);
} else {
fclose($file);
}
// Okej, zróbmy parę bzdurek db depend :S
// Postgres sux ! (warden)
// Tak, a łyżka na to 'niemożliwe' i poleciała za wanną potrącając bannanem musztardę (lukasz)
switch (ConfigHelper::getConfig('database.type')) {
case 'postgres':
// actualize postgres sequences ...
foreach ($DB->ListTables() as $tablename) {
// ... where we have *_id_seq
if (!in_array($tablename, array('rtattachments', 'dbinfo', 'invoicecontents', 'receiptcontents', 'documentcontents', 'stats', 'eventassignments', 'sessions'))) {
$DB->Execute("SELECT setval('" . $tablename . "_id_seq',max(id)) FROM " . $tablename);
}
}
break;
}
if ($SYSLOG) {
$SYSLOG->AddMessage(SYSLOG_RES_DBBACKUP, SYSLOG_OPER_DBBACKUPRECOVER, array('filename' => $filename), null);
}
}