/** * Initialize ThemeConfig */ public function init() { // Initialize configurator $configurator = Configurator::getInstance(); // Initialize settings new Settings($configurator->all()); do_action('wp_theme_config_loaded'); }
protected function __construct() { $SH = SocketHandler::getInstance(); $config = Configurator::getInstance(); $bind = explode(":", $config->bind); $listener = $SH->createListener($bind[0], $bind[1], array($this, 'addClient')); }
private function __construct() { $config = Configurator::getInstance()->getConfig(__CLASS__); try { $this->pdo = new PDO(sprintf('%s:host=%s;dbname=%s', $config->getMandatoryKey('driver'), $config->getMandatoryKey('host'), $config->getMandatoryKey('name')), $config->getMandatoryKey('user'), $config->getMandatoryKey('password'), array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8; SET CHARACTER SET utf8;')); } catch (Exception $ex) { throw new Exception('Cannot connect to database.'); } }
protected function __construct() { $config = Configurator::getInstance(); if (isset($GLOBALS['logfile'])) $this->logfile = $GLOBALS['logfile']; else { $this->logfile = $config->logfile; } $this->logfile = "log/".basename($this->logfile); $this->fd = fopen($this->logfile, 'a+'); }
public static function init() { if (class_exists('Configurator')) { $config = Configurator::getInstance()->getConfig(__CLASS__); if (!file_exists(self::$logPath = $config->getKey('logPath', self::$logPath))) { file_put_contents(self::$logPath, "Log file created.\n", FILE_APPEND | LOCK_EX); } self::$logPath = realpath(self::$logPath); self::$debugMode = $config->getKey('debugMode', self::$debugMode); self::$processName = $config->getKey('processName', self::$processName); self::$sendEmail = $config->getKey('sendEmail', self::$sendEmail); self::$mailTo = $config->getKey('mailTo', self::$mailTo); self::$timeFormat = $config->getKey('timeFormat', self::$timeFormat); self::$historyLength = $config->getKey('historyLength', self::$historyLength); } self::$logHistory = array(); }
private function loadServers() { $c = Configurator::getInstance(); if ((isset($c->config['server'])) && (is_array($c->config['server']))) foreach ($c->config['server'] AS $key => $entry) { $keyinfo = explode(":", $key); $type = 'Server_' . $keyinfo[0]; $name = (isset($keyinfo[1])) ? $keyinfo[1] : ""; if (file_exists($GLOBALS['serversdir'] . $type . '.php')) { require_once($GLOBALS['serversdir'] . $type . '.php'); $server = new $type($name, $c->config['client'][$key]); } else _log(L_WARNING, 'Loader: could not find %s', $type); } }
function signal_handler ($signo) { switch ($signo) { case SIGINT: _log(L_INFO, "Received SIGINT. Stopping..."); $SH = SocketHandler::getInstance(); $SH->interrupt(); break; case SIGTERM: _log(L_INFO, "Received SIGTERM. Stopping..."); $SH = SocketHandler::getInstance(); $SH->interrupt(); break; case SIGHUP: _log(L_INFO, "Received SIGHUP. Rehashing."); $config = Configurator::getInstance(); $config->rehash(); break; default: } }
public function SendEmail($email_address_array, $from_email, $from_name, $email_data, $subject, $template, &$send_message) { global $smarty; $send_result = 0; $send_message = ''; if (is_array($email_address_array) && sizeof($email_address_array) > 0 && '' != trim($from_email) && '' != trim($from_name) && '' != trim($subject) && '' != $template) { try { $mail = new PHPMailer(true); $mail->IsSMTP(true); $mail->SMTPDebug = false; $mail->IsHTML(true); $mail->Host = Configurator::getInstance()->getSettings("phpmailer_smtp"); $mail->SMTPAuth = true; $mail->Username = Configurator::getInstance()->getSettings("mailer_username"); $mail->Password = Configurator::getInstance()->getSettings("mailer_password"); //$mail->AddAttachment('images/phpmailer.gif'); // attachment //$mail->AddAttachment('images/phpmailer_mini.gif'); // attachment $mail->ClearAddresses(); for ($x = 0; $x < sizeof($email_address_array); $x++) { $mail->AddAddress(trim($email_address_array[$x])); } $smarty->assign('site_url', Configurator::getInstance()->getSettings("site_url")); $smarty->assign('email_data', $email_data); $mail->From = $from_email; $mail->FromName = $from_name; $mail->Subject = $subject; $mail->Body = $smarty->fetch($template); // echo $smarty->fetch( $template ); //exit(); if (!$mail->Send()) { } else { $send_result = 1; } } catch (phpmailerException $e) { //$send_message = $e->errorMessage(); } catch (Exception $e) { $send_message = $e->getMessage(); } } else { $send_message = 'Data missing'; } echo ' error message=>: ' . $send_message; //exit; return $send_result; }
protected function __construct() { Configurator::getInstance(); }
<?php //check user is authenticated if (!isset($_SESSION[$backend_ID]['ADMIN_ID'])) { $fileUrl = "?referrer=" . $_SERVER['SCRIPT_NAME'] . (isset($_SERVER['QUERY_STRING']) && trim($_SERVER['QUERY_STRING']) != '' ? '?' . trim($_SERVER['QUERY_STRING']) : ''); header("Location: " . Configurator::getInstance()->getSettings("site_url") . "/admin/index" . $fileUrl); exit; } if ($entity != 'dashboard' && $adminUserObj->accessControl($entity) == false) { header("Location: /admin/dashboard"); exit; } //print_r($_SESSION);
public function SendConfirmationSignupEmail($email_address, $email_data) { $email_result = 0; if ('' != trim($email_address) && sizeof($email_data) > 0) { $subject = "Sign up Confirmation"; $template = 'templates/mailer/send_confirmation_register.tpl'; $from_email = Configurator::getInstance()->getSettings("mailer_address_from"); $from_name = Configurator::getInstance()->getSettings("mailer_address_servername"); $email_address_array = array($email_address); $email_result = $this->SendEmail($email_address_array, $from_email, $from_name, $email_data, $subject, $template, $send_message); } return $email_result; }
<?php ob_start(); /* ====================================================== Diderson Baka - www.diderson.com ------------------------------------------------------ NOTE: This code is intellectual property of Diderson Baka and may not be reproduced or used without prior permission. ------------------------------------------------------ Copyright 2013 ====================================================== */ // Start session session_start(); require_once 'includes/config/configurator.class.php'; //Include Smarty require_once 'includes/config/smarty.config.php'; Configurator::getInstance()->smarty = $smarty; //Common if (strrpos($_SERVER['SCRIPT_NAME'], '/admin/') === false) { require_once 'includes/common.php'; } else { require_once 'includes/common.admin.php'; }
} else { $smartyEnabled = true; } global $smarty; if ($smartyEnabled) { // Setup Smarty require_once 'components/smarty/Smarty.class.php'; $smarty = new Smarty(); // Config smarty debug build setup. $smarty->debugging = false; // Set smarty cache settings $smarty->caching = false; $smarty->compile_check = true; //don't check for dependent file changes // Set smarty folders $smarty->template_dir = array('./templates/', '.', Configurator::getInstance()->getSettings('site_root') . '/templates/'); $smarty->compile_dir = Configurator::getInstance()->getSettings('site_root') . '/cache/smarty_compile/'; $smarty->config_dir = array('.', Configurator::getInstance()->getSettings('site_root') . '/components/smarty/config/'); $smarty->cache_dir = Configurator::getInstance()->getSettings('site_root') . '/cache/smarty_cache/'; $smarty->plugins_dir = array(Configurator::getInstance()->getSettings('site_root') . '/components/smarty/plugins/', Configurator::getInstance()->getSettings('site_root') . '/components/smarty_plugins/', Configurator::getInstance()->getSettings('site_root') . '/components/smarty/plugins-diderson/'); // Set in compile always more for dev only!! if (strpos($_SERVER['HTTP_HOST'], 'diderson') !== false) { //$smarty->force_compile = true; } // Generic variables assisgned in smarty $smarty->assign('siteUrl', Configurator::getInstance()->getSettings('site_url')); $smarty->assign('siteRoot', Configurator::getInstance()->getSettings('site_root')); $smarty->assign('googleAnalytics', Configurator::getInstance()->getSettings('google_analytics')); $smarty->assign('siteType', Configurator::getInstance()->getSettings('site_type')); $smarty->assign('fileUrl', basename($_SERVER['SCRIPT_NAME']) . (isset($_SERVER['QUERY_STRING']) && trim($_SERVER['QUERY_STRING']) != '' ? '?' . trim($_SERVER['QUERY_STRING']) : '')); }
public function SendQuickContactEmail($email_address, $email_data) { $email_result = 0; if ('' != trim($email_address) && sizeof($email_data) > 0) { $subject = 'Medicament.cd Contact Rapide'; $template = '../templates/mailer/send_quick_email.tpl'; $from_email = Configurator::getInstance()->getSettings("mailer_address_from"); $from_name = Configurator::getInstance()->getSettings("mailer_address_servername"); //$email_address_array = array( $email_address ); $email_address_array = array(Configurator::getInstance()->getSettings("mailer_address_to")); $email_result = $this->SendEmail($email_address_array, $from_email, $from_name, $email_data, $subject, $template, $send_message); } return $email_result; }