本文整理汇总了PHP中ConfigHelper类的典型用法代码示例。如果您正苦于以下问题:PHP ConfigHelper类的具体用法?PHP ConfigHelper怎么用?PHP ConfigHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigHelper类的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: 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();
}
}
示例3: 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);
}
示例4: SetLanguage
protected function SetLanguage($aLanguages)
{
if (ConfigHelper::Get('/languages/switch') == 'host') {
$sLanguage = substr($_SERVER['SERVER_NAME'], 0, 2);
if (array_key_exists($sLanguage, $aLanguages) && substr($_SERVER['SERVER_NAME'], 2, 1) == '.') {
$this->sLanguage = $sLanguage;
} else {
$this->sLanguage = 'en';
}
} else {
// check for request to change language
// if not present check for cookie specifiying language
// finally fall back to english
if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $aLanguages)) {
$this->sLanguage = $_GET['lang'];
setcookie('lang', $this->sLanguage, time() + 60 * 60 * 24 * 365, '/');
header('Location: /');
exit;
} elseif (isset($_COOKIE['lang']) && array_key_exists($_COOKIE['lang'], $aLanguages)) {
$this->sLanguage = $_COOKIE['lang'];
} else {
$this->sLanguage = 'en';
}
}
}
示例5: 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'])));
}
示例6: 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');
}
示例7: tla_ads
function tla_ads()
{
// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;
// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = ConfigHelper::Get('/cache/tla/dir') . ConfigHelper::Get('/cache/tla/file');
if (!file_exists($LOCAL_XML_FILENAME)) {
die("Script error: {$LOCAL_XML_FILENAME} does not exist. Please create a blank file named {$LOCAL_XML_FILENAME}.");
}
if (!is_writable($LOCAL_XML_FILENAME)) {
die("Script error: {$LOCAL_XML_FILENAME} is not writable. Please set write permissions on {$LOCAL_XML_FILENAME}.");
}
if (filemtime($LOCAL_XML_FILENAME) < time() - 3600 || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=Z73AUCI0OTG7DAHAYCKP&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}
$xml = tla_getLocalXML($LOCAL_XML_FILENAME);
$arr_xml = tla_decodeXML($xml);
if (is_array($arr_xml)) {
echo "\n<ul id=\"text-links\">\n";
for ($i = 0; $i < count($arr_xml['URL']); $i++) {
if (isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0) {
continue;
}
echo "<li>" . $arr_xml['BeforeText'][$i] . " <a href=\"" . $arr_xml['URL'][$i] . "\">" . $arr_xml['Text'][$i] . "</a> " . $arr_xml['AfterText'][$i] . "</li>\n";
}
echo "</ul>";
}
}
示例8: 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;
}
示例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: 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');
}
示例11: __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));
}
}
示例12: 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);
}
示例13: GetMenuUrl
public function GetMenuUrl($sAppRoot, $sSection)
{
if ($sSection != 'home') {
if (ConfigHelper::Get('/urls/rewritten')) {
return $sAppRoot . "section/{$sSection}";
} else {
return $sAppRoot . "?view={$sSection}";
}
}
return $sAppRoot;
}
示例14: 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);
}
示例15: 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;
}
}