function get() { $settings = new Settings(); $atlantis = array('lat' => doubleval($settings->getSettings('Atlantis', 'lat')), 'long' => doubleval($settings->getSettings('Atlantis', 'long'))); $bdd = getBDD(); $req = $bdd->query('SELECT arr.*, IFNULL(arr2.nom, at_users.nom) nom FROM (SELECT t1.* FROM at_geo t1 LEFT JOIN at_geo t2 ON (t1.mac = t2.mac AND t1.timestamp < t2.timestamp) WHERE t2.timestamp IS NULL AND t1.date = CURDATE()) AS arr LEFT JOIN (SELECT at_devices.mac, at_users.nom FROM at_devices INNER JOIN at_users ON at_devices.username = at_users.id) AS arr2 ON arr.mac = arr2.mac LEFT JOIN at_users ON arr.mac = at_users.cle'); $result = $req->fetchAll(PDO::FETCH_ASSOC); $req->closeCursor(); http_response_code(202); $output = array('atlantis' => $atlantis, 'positions' => $result); return $output; }
function __construct() { $settings = new Settings(); $this->oc = $settings->getSettings('ownCloud', 'path'); $this->admin_username = $settings->getSettings('ownCloud', 'username'); $this->admin_password = $settings->getSettings('ownCloud', 'password'); }
function get() { $pid = (new Settings())->getSettings('Daemon', 'pid'); if ($pid == -1) { $daemon = false; } else { exec("ps -p {$pid}", $result); if (count($result) > 1) { $result = $result[1]; $result = preg_replace("/\\s+/", " ", $result); $data = explode(" ", $result); if ($data[count($data) - 1] == 'php') { $daemon = true; } else { $daemon = false; } } else { $daemon = false; } } $free_disk = disk_free_space('/') / disk_total_space('/'); $settings = new Settings(); $output = array('daemon' => $daemon, 'free_hdd' => $free_disk, 'nightFrom' => $settings->getSettings('Mode', 'nightFrom'), 'nightTo' => $settings->getSettings('Mode', 'nightTo'), 'nightAuto' => $settings->getSettings('Mode', 'nightAuto')); return $output; }
public function __construct($local = null) { $settings = new Settings(); $this->url = $settings->getSettings("Zwave", "IP"); $this->port = $settings->getSettings("Zwave", "Port"); $this->username = $settings->getSettings("Zwave", "username"); $this->password = $settings->getSettings("Zwave", "password"); if ($local == null) { $this->rawData = null; } else { $this->rawData = $this->loadRawData(); } }
function saveSettings() { global $error; global $obj_smarty; // add the checkbox fields here $arr_submit = array(array('show_description_field', 'string', false, 'off'), array('show_location_field', 'string', false, 'off'), array('show_phone_field', 'string', false, 'off'), array('show_url_field', 'string', false, 'off'), array('show_am_pm', 'string', false, 'off'), array('show_delete_confirm_dialog', 'string', false, 'off'), array('truncate_title', 'string', false, 'off'), array('show_notallowed_messages', 'string', false, 'off'), array('show_weeknumbers', 'string', false, 'off'), array('show_public_and_private_separately', 'string', false, 'off')); $int_user_id = $_POST['user_id']; foreach ($_POST as $key => $param) { if (!empty($key) && $key != 'save-settings' && $key != 'user_id') { $arr_submit[] = array($key, 'string', false, $param); $_REQUEST[$key] = $param; } } unset($_REQUEST['params']); $frm_submitted = validate_var($arr_submit); $arr_user = User::getUser(); if (!$error) { if ($int_user_id == $arr_user['user_id']) { unset($frm_submitted['user_id']); Settings::saveSettings($frm_submitted, '', $arr_user['user_id']); $obj_smarty->assign('save_settings_success', 'Saved succesfully'); //header('location: '.FULLCAL_URL.'/admin/settings'); //exit; } else { $obj_smarty->assign('save_settings_error', 'NO rights to do that'); } } else { $obj_smarty->assign('save_settings_error', $error); } $obj_smarty->assign('active', 'settings'); $obj_smarty->assign('settings', Settings::getSettings($arr_user['user_id'])); $obj_smarty->display(FULLCAL_DIR . '/view/user_panel.tpl'); exit; }
public function getConfigurationEntries($tprefix) { require_once 'Settings.php'; $obj_sett = new Settings(); $arr_config = $obj_sett->getSettings($tprefix); return $arr_config; }
/** * @static * @return Connection */ public static function get() { if (self::$inst == null) { self::$inst = new self(Settings::getSettings()); } return self::$inst; }
/** * Constructor to create a new Template object * @param JPHPFramework $registry the frameworks registry */ public function __construct() { $this->name = 'login'; $this->version = 0.1; $this->author = 'José E. Villena'; $this->translate = Settings::getSettings('DEFAULT_LANG'); parent::__construct(); }
function message($arr) { light_notification(false); $settings = new Settings(); if ($settings->getSettings('CallNotifier', 'voice')) { (new Player())->sound(Player::NOTIFICATION); (new Player())->sound(Player::INCOMING_MESSAGE); } }
function __construct($city = 'rennes') { $settings = new Settings(); $this->city = $city; $this->appid = $settings->getSettings('Weather', 'appid'); $result = $this->fetchURL($city, 7); if ($result->cod != null && $result->cod == '200') { $this->data = $result; } }
/** * */ public static function init() { static::$settings = array('sorter' => array(), 'listing' => array(), 'translation' => array()); if (class_exists('Chansig\\DirectoryIndex\\Settings')) { static::$settings = array_replace_recursive(static::$settings, Settings::getSettings()); } Listing::setup(static::$settings['listing']); Sorter::setup(static::$settings['sorter']); Translation::setup(static::$settings['sorter']); Theme::setup(static::$settings['sorter']); }
/** * Constructor to create a new Template object */ public function __construct() { $this->moduleName = 'loginForm'; $this->version = 1.0; $this->author = 'José E. Villena'; $this->translate = Settings::getSettings('DEFAULT_LANG'); self::setTranslateModule($this->translate, $this->moduleName); self::setMedia(); self::setView(); parent::__construct(); }
public function checkSMSStatus() { $flag = false; require_once 'Settings.php'; $obj_settings = new Settings(); $obj_arr = $obj_settings->getSettings(); $status = $obj_arr["sms_status"]; if ($status == "enabled") { $flag = true; } else { $this->obj_misc->alert('You are unable to Send SMS ,Please Contact Administrator'); } return $flag; }
public function plugins_loaded() { $db = new Database(MARKETCHECK_DBNAME); $userManagement = new UserManagement($db); $fields = new Settings\Fields(); $settings = new Settings($fields); $setup = new Setup\Setup(MARKETCHECK_DBNAME); $registerForm = new SignUp($userManagement); $currentDB = get_option('marketcheck_version'); if ($currentDB != MARKETCHECK_DB_VERSION) { register_activation_hook(__FILE__, array($setup, 'install')); $setup->install(); update_option("marketcheck_version", MARKETCHECK_DB_VERSION); } do_action("marketcheck/register-market", $fields, $settings->getSettings(), $registerForm, $db); }
public function testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled() { $original = Settings::getSettings(); $settings = $original; $settings['errors']['verbose'] = false; Settings::setFromArray($settings); try { $this->request->dispatch("/notfound"); } catch (Exception $e) { $handler = new ErrorHandler(); $handler->setRequest($this->request); $handler->handleError($e); $this->assertResponseCode(404, $handler->getResponse()); $this->assertBodyHasContents("Oops! That’s a 404", $handler->getResponse()); $this->assertBodyHasContents("It looks like the page you’re after doesn’t exist", $handler->getResponse()); } Settings::setFromArray($original); }
function __construct() { $settings = new Settings(); $this->mail = new PHPMailer(); $this->mail->isSMTP(); $fromName = $settings->getSettings('SMTP', 'fromName'); $fromMail = $settings->getSettings('SMTP', 'fromMail'); $this->mail->setFrom($fromMail, $fromName); $this->mail->Subject = 'Atlantis'; $this->mail->Host = $settings->getSettings('SMTP', 'server'); $this->mail->Port = $settings->getSettings('SMTP', 'port'); $security = $settings->getSettings('SMTP', 'security'); if ($security != 'no') { $this->mail->SMTPSecure = $security; } if ($settings->getSettings('SMTP', 'auth')) { $this->mail->SMTPAuth = true; $this->mail->Username = $settings->getSettings('SMTP', 'username'); $this->mail->Password = $settings->getSettings('SMTP', 'password'); } }
header('Access-Control-Allow-Headers: origin, x-requested-with, content-type, accept'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); require_once __DIR__ . '/classes/connexion.php'; require_once __DIR__ . '/classes/checkAPI.php'; require_once __DIR__ . '/classes/Settings.php'; require_once __DIR__ . '/classes/Alarm.php'; require_once __DIR__ . '/classes/Mode.php'; require_once __DIR__ . '/classes/VigilanceMeteo.php'; require_once __DIR__ . '/classes/Weather.php'; $page_level = 1; $settings = new Settings(); $vigilance = new VigilanceMeteo(); if (isset($_REQUEST['api']) && checkAPI($_REQUEST['api'], $page_level)) { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': $alarm = $settings->getSettings('Alarm', 'status'); http_response_code(202); echo json_encode(array('alarm' => $alarm, 'weather' => getWeather(), 'rooms' => getRooms(), 'mode' => (new Mode())->getMode())); break; case 'PUT': echo json_encode(update($_REQUEST)); break; } } else { if ($argc > 1) { switch ($argv[1]) { case 'weather': setWeather(); break; } } else {
public function testNotificationEmailsRespectSiteBaseHrefSetting() { self::loadFixture(); $originalSettings = Settings::getSettings(); $settings = $originalSettings; $settings['site']['base_href'] = 'http://fake.domain/'; Settings::setFromArray($settings); $this->doLogin("*****@*****.**", "t3stp4ss"); TestEmailHandler::resetSentEmails(); $this->request->setMethod("POST")->setParams(array("approved" => "1"))->dispatch("/admin/posts/3/comments/edit/3"); $emails = TestEmailHandler::getSentEmails(); $this->assertTrue(strpos($emails[0]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[1]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[1]['body'], "http://fake.domain/comment-unsubscribe/") !== false); $this->assertTrue(strpos($emails[2]['body'], "http://fake.domain/2011/09/another-test-post") !== false); $this->assertTrue(strpos($emails[2]['body'], "http://fake.domain/comment-unsubscribe/") !== false); Settings::setFromArray($originalSettings); }
include_once "config/config.php"; // include setting file include_once "class/settings.php"; // include library file include_once "class/lib.php"; // include article file include_once "class/article.php"; // include page file include_once "class/page.php"; // include auth file include_once "class/auth.php"; // include template file include_once "class/template.php"; session_start(); $getSettings = new Settings($config_setting_file_path); $cpsub = $getSettings->getSettings(); $getLib = new Lib($cpsub['filter'], $cpsub['stripslashes']); $getAuth = new Auth($config_account_data, $getLib); $getTmp = new Template($config_current_version); // check file status $getLib->checkFileStatus($config_default_folder); $getLib->checkFileStatus($config_article_file_path); // get page val $p = $getLib->setFilter($_GET['p']); if (!$getLib->checkVal($p)) { $p = "about"; } // check auth $getAuth->checkAuth($_COOKIE, $_SESSION, $p); // get page folder $include_path = $getLib->checkAdminPath($p);
public function __construct() { $settings = new Settings(); $this->ip = $settings->getSettings("Hue", "ip"); $this->user = $settings->getSettings("Hue", "user"); }
<?php require_once "library.php"; Core::init(); // if need be, redirect to the install instructions page Utils::maybeShowInstallationPage(); if (!Core::checkIsLoggedIn() && !Core::checkAllowMultiUserAnonymousUse()) { header("location: login.php#t1"); exit; } // start piecing together all the various info we need to pass to the page $pageParams = array(); $settings = Settings::getSettings(); $exportTypes = Core::$exportTypePlugins; $exportTypeAdditionalSettings = ExportTypePluginHelper::getExportTypeAdditionalSettingsHTML($exportTypes); $dataTypes = DataTypePluginHelper::getDataTypeList(Core::$dataTypePlugins); $exportTypeJSModules = ExportTypePluginHelper::getExportTypeJSResources($exportTypes, "string"); $exportTypeCssIncludes = ExportTypePluginHelper::getExportTypeCSSIncludes($exportTypes); $dataTypeJSModules = DataTypePluginHelper::getDataTypeJSResources($dataTypes, "string"); $dataTypeCssIncludes = DataTypePluginHelper::getDataTypeCSSIncludes($dataTypes); $cssIncludes = $exportTypeCssIncludes . "\n" . $dataTypeCssIncludes; // used in the settings page $pageParams["allCountryPlugins"] = Core::$countryPlugins; $pageParams["allExportTypes"] = $exportTypes; $pageParams["groupedDataTypes"] = Core::$dataTypePlugins; $pageParams["allDataTypes"] = $dataTypes; $pageParams["allTranslations"] = Core::$translations->getList(); $useMinifiedResources = Core::isUsingMinifiedResources(); $pageParams["useMinifiedResources"] = $useMinifiedResources; if ($useMinifiedResources) { $pageParams["minifiedResourcePaths"] = Minification::getMinifiedResourcePaths();
public function showTabContent() { $arSettings = $this->_Settings->getSettings(); $idPrefix = 'sett_' . str_replace('.', '_', $this->getSettingModuleID()) . '_'; foreach ($this->_tabOptionGroups as $arGroup) { ?> <?php if (!empty($arGroup['NAME']) && !empty($arGroup['ITEMS'])) { ?> <tr class="heading"> <td colspan="2"><b><?php echo $arGroup['NAME']; ?> </b></td> </tr> <?php } ?> <?php foreach ($arGroup['ITEMS'] as $optionCode => $optionSort) { $arOption =& $arSettings[$optionCode]; $bWithDescription = strlen(trim($arOption['DESCRIPTION'])) > 0 ? true : false; $bWithHint = strlen(trim($arOption['HINT'])) > 0 ? true : false; ?> <tr> <td width="<?php echo $this->_tableLeftColumnWidth; ?> %"<?php if ($bWithDescription) { ?> style="vertical-align: top;"<?php } ?> > <label for="<?php echo $idPrefix . $optionCode; ?> "><?php echo $arOption['NAME']; ?> </label> <?php if (strlen($arOption['DESCRIPTION']) > 0) { ?> <br /><small><?php echo $arOption['DESCRIPTION']; ?> </small> <?php } ?> </td> <td<?php if ($bWithDescription) { ?> style="vertical-align: top;"<?php } ?> > <?php echo $this->_Settings->getOptionInput($optionCode, array('id' => $idPrefix . $optionCode)); ?> <?php if ($bWithHint) { ?> <img src="/bitrix/js/main/core/images/hint.gif" onmouseover="BX.hint(this, '<?php echo $arOption['HINT']; ?> ')" /> <?php } ?> </td> </tr> <?php } } }
function getSettings() { global $obj_smarty; $arr_user = User::getUser(); echo json_encode(array('success' => true, 'user_id' => $arr_user['user_id'], 'settings' => Settings::getSettings($arr_user['user_id']))); exit; }
function checkModeHours() { $settings = new Settings(); if ($settings->getSettings('Mode', 'nightAuto')) { $mode = new Mode(); $from = $settings->getSettings('Mode', 'nightFrom'); $to = $settings->getSettings('Mode', 'nightTo'); if (time() > strtotime($from) && $mode->getMode() == Mode::DAY) { $mode->setMode(Mode::NIGHT); } else { if (time() < strtotime($from) && time() > strtotime($to) && $mode->getMode() == Mode::NIGHT) { $mode->setMode(Mode::DAY); } } } }
<?php require_once __DIR__ . '/../classes/Settings.php'; require_once __DIR__ . '/../classes/Log.php'; $settings = new Settings(); if ($settings->getSettings('DDNS', 'on')) { $ip = urlencode(file_get_contents('http://nawrasg.fr/ip.php')); $last_ip = $settings->getSettings('DDNS', 'last_ip'); if ($ip == $last_ip) { (new Log())->log(Log::DEBUG, __FILE__, "No IP Change {$ip}"); } else { $host = $settings->getSettings('DDNS', 'host'); $username = $settings->getSettings('DDNS', 'username'); $password = $settings->getSettings('DDNS', 'password'); $hosts = explode(';', $host); foreach ($hosts as $item) { $response = updateDNS($item, $ip, $username, $password); (new Log())->log(Log::INFO, __FILE__, "{$item} - {$response}"); } $settings->setSettings('DDNS', 'last_ip', $ip); } } function updateDNS($host, $ip, $username, $password) { $host = urlencode($host); $url = "http://www.ovh.com/nic/update?system=dyndns&hostname={$host}&myip={$ip}"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}"); curl_setopt($ch, CURLOPT_TIMEOUT, 30);
require_once "library.php"; Core::init(); // if need be, redirect to the install instructions page Utils::maybeShowInstallationPage(); if (!Core::checkIsLoggedIn()) { header("location: login.php#t1"); exit; } $pageParams = array(); if (isset($_POST["updateSettings"])) { list($success, $message) = Settings::updateSettings($_POST); $pageParams["success"] = $success; $pageParams["message"] = $message; } $exportTypes = Core::$exportTypePlugins; $exportTypeAdditionalSettings = ExportTypePluginHelper::getExportTypeAdditionalSettingsHTML($exportTypes); $dataTypes = DataTypePluginHelper::getDataTypeList(Core::$dataTypePlugins); $exportTypeJSModules = ExportTypePluginHelper::getExportTypeJSResources($exportTypes); $exportTypeCssIncludes = ExportTypePluginHelper::getExportTypeCSSIncludes($exportTypes); $dataTypeJSModules = DataTypePluginHelper::getDataTypeJSResources($dataTypes); $dataTypeCssIncludes = DataTypePluginHelper::getDataTypeCSSIncludes($dataTypes); $cssIncludes = $exportTypeCssIncludes . "\n" . $dataTypeCssIncludes; $pageParams["dataTypeJSModules"] = $dataTypeJSModules; $pageParams["exportTypeJSModules"] = $exportTypeJSModules; $pageParams["exportTypeAdditionalSettings"] = $exportTypeAdditionalSettings; $pageParams["settings"] = Settings::getSettings(); $pageParams["cssIncludes"] = $cssIncludes; $pageParams["codeMirrorIncludes"] = ExportTypePluginHelper::getExportTypeCodeMirrorModes($exportTypes); $pageParams["defaultExportType"] = Core::getDefaultExportType(); $pageParams["accountType"] = Core::$user->getAccountType(); Templates::displayPage("resources/templates/index.tpl", $pageParams);
function __construct() { $settings = new Settings(); $this->apiKey = $settings->getSettings("Notification", "key"); }
<?php require 'include/config.php'; require 'include/class.settings.php'; $n = new Settings($db); $sets = $n->getSettings(); include 'include/top.php'; ?> <table class="tablesorter"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Value</th> <th>Description</th> </tr> </thead> <tbody> <?php foreach ($sets as $s) { ?> <tr> <td><?php echo $s['id']; ?> </td> <td><a href="settings_edit.php?id=<?php echo $s['id']; ?>
<?php require_once __DIR__ . '/../classes/connexion.php'; require_once __DIR__ . '/../classes/Settings.php'; $settings = new Settings(); $photos_number = $settings->getSettings('Security', 'photosNumber'); $photos_interval = $settings->getSettings('Security', 'photosSeconds'); $cameras = array(); $bdd = getBDD(); $req = $bdd->query('SELECT * FROM at_cameras'); while ($data = $req->fetch()) { $cameras[] = array('id' => $data['id'], 'ip' => $data['ip'], 'image' => $data['image'], 'username' => $data['username'], 'password' => $data['password']); } $size = count($cameras); for ($i = 0; $i < $photos_number; $i++) { for ($j = 0; $j < $size; $j++) { saveImage($cameras[$j]); } sleep($photos_interval); } function saveImage($arr) { if (isset($arr['ip'], $arr['image'])) { $url = 'http://' . $arr['ip'] . '/' . $arr['image']; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); if (isset($arr['username'], $arr['password'])) { $username = $arr['username']; $password = $arr['password'];
findMusic($musicPath); break; case 'sync': folderToPlaylist(); break; } } if (isset($_REQUEST['api']) && checkAPI($_REQUEST['api'], $page_level)) { switch ($_SERVER['REQUEST_METHOD']) { case 'POST': if (isset($_REQUEST['playlist'])) { $playlist = createPlaylist($_REQUEST); echo json_encode($playlist); } else { $settings = new Settings(); $musicPath = $settings->getSettings('Files', 'music'); findMusic($musicPath); http_response_code(202); } break; case 'GET': echo json_encode(get($_REQUEST)); break; case 'PUT': update($_REQUEST); break; case 'DELETE': delete($_REQUEST); break; } }