本文整理汇总了PHP中loadSettings函数的典型用法代码示例。如果您正苦于以下问题:PHP loadSettings函数的具体用法?PHP loadSettings怎么用?PHP loadSettings使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadSettings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initSettings
/**
* Initialisation des paramètres de PWD
*/
function initSettings()
{
global $gSettings;
$gSettings = loadSettings();
if ($gSettings === FALSE) {
$gSettings = array();
$gSettings['options']['groupes']['groupe'] = array();
$gSettings['sites']['site'] = array();
saveSettings($gSettings);
}
}
示例2: __construct
/**
* Initialise une authentification en utilisant les paramêtre renseignés dans gepi
*
* @param string|NULL $auth The authentication source. Si non précisé, utilise la source configurée dans gepi.
*/
public function __construct($auth = null) {
if ($auth == null) {
if (isset($_SESSION['utilisateur_saml_source'])) {
//on prend la source précisée précedemment en session.
//Cela sert si le mode d'authentification a changé au cours de la session de l'utilisateur
$auth = $_SESSION['utilisateur_saml_source'];
} else {
//on va sélectionner la source d'authentification gepi
$path = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))));
include_once("$path/secure/connect.inc.php");
// Database connection
require_once("$path/lib/mysql.inc");
require_once("$path/lib/settings.inc");
// Load settings
if (!loadSettings()) {
die("Erreur chargement settings");
}
$auth = getSettingValue('auth_simpleSAML_source');
}
}
$config = SimpleSAML_Configuration::getOptionalConfig('authsources.php');
$sources = $config->getOptions();
if (!count($sources)) {
echo 'Erreur simplesaml : Aucune source configurée dans le fichier authsources.php';
die;
}
if (!in_array($auth, $sources)) {
//si la source précisée n'est pas trouvée, utilisation par défaut d'une source proposant tout les choix possible
//(voir le fichier authsources.php)
if ($auth == 'unset') {
//l'admin a réglé la source à unset, ce n'est pas la peine de mettre un message d'erreur
} else {
echo 'Erreur simplesaml : source '.$auth.' non configurée. Utilisation par défaut de la source : «Authentification au choix entre toutes les sources configurees».';
}
$auth = 'Authentification au choix entre toutes les sources configurees';
}
//on utilise une variable en session pour se souvenir quelle est la source utilisé pour cette session. Utile pour le logout, si entretemps l'admin a changé la source d'authentification.
$_SESSION['utilisateur_saml_source'] = $auth;
//print_r($config);die;
$this->authSourceConfig = $config->getArray($auth);
assert('is_string($auth)');
$this->authSource = $auth;
parent::__construct($auth);
}
示例3: loadBehaviors
function loadBehaviors($type)
{
$settings = loadSettings();
$files = array();
if ($handle = opendir($settings['base_game'] . '/scripts/behaviors/' . $type . '/')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$files[] = substr($entry, 0, -3);
}
}
closedir($handle);
}
return $files;
}
示例4: InitializeConfig
function InitializeConfig()
{
global $config_db_name, $config_db, $version;
// Configuration Database
$config_db_name = dirname(__FILE__) . '/rest.config.sqlite3';
try {
$config_db = new PDO("sqlite:{$config_db_name}");
$config_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $ex) {
// Print PDOException message
die($ex->getMessage());
}
// Check for configuration DB
if (file_exists($config_db_name)) {
// $this->showMessage("DB Found");
// Check for Versioning Table
if (!checkTable('version')) {
// $this->showMessage("Versioning Table Missing");
createVersionTable();
}
// Check Table Version
$tblVer = checkTableVersion('version', $version);
if ($tblVer === false) {
// $this->showMessage('Adding Version Details');
addVersionRecord('version');
}
if ($tblVer === -99) {
// $this->showMessage('Updating Version Details');
updateVersionRecord('version');
}
// Check Users Table
if (!checkTable('users')) {
createUsersTable();
} else {
// Check Version
$tblVer = checkTableVersion('users', $version);
}
// Load Database Configurations
loadDBConnections();
// Load Published Tables
loadPublishedTables();
// Load System Settings
loadSettings();
} else {
die("Sorry, system cannot be setup configuration file....");
}
}
示例5: setUp
/**
* This is run before each unit test; it empties the database.
*/
protected function setUp()
{
GepiDataPopulator::depopulate($this->con);
mysqli_query($GLOBALS["mysqli"], 'delete from setting');
mysqli_query($GLOBALS["mysqli"], 'delete from droits');
mysqli_query($GLOBALS["mysqli"], 'delete from droits_aid');
mysqli_query($GLOBALS["mysqli"], 'delete from aid_productions');
mysqli_query($GLOBALS["mysqli"], 'delete from edt_setting');
mysqli_query($GLOBALS["mysqli"], 'delete from lettres_tcs');
mysqli_query($GLOBALS["mysqli"], 'delete from etiquettes_formats');
mysqli_query($GLOBALS["mysqli"], 'delete from lettres_types');
mysqli_query($GLOBALS["mysqli"], 'delete from lettres_cadres');
mysqli_query($GLOBALS["mysqli"], 'delete from ct_types_documents');
mysqli_query($GLOBALS["mysqli"], 'delete from absences_motifs');
mysqli_query($GLOBALS["mysqli"], 'delete from model_bulletin');
mysqli_query($GLOBALS["mysqli"], 'delete from absences_actions');
$fd = fopen(dirname(__FILE__) ."/../../../../sql/data_gepi.sql", "r");
if (!$fd) {
echo "Erreur : fichier sql/data_gepi.sql non trouve\n";
die;
}
while (!feof($fd)) {
$query = fgets($fd, 5000);
$query = trim($query);
if((substr($query,-1)==";")&&(substr($query,0,3)!="-- ")) {
$reg = mysqli_query($GLOBALS["mysqli"], $query);
if (!$reg) {
echo "ERROR : '$query' \n";
echo "Erreur retournée : ".mysqli_error($GLOBALS["mysqli"])."\n";
$result_ok = 'no';
}
}
}
fclose($fd);
loadSettings();
AbsenceEleveSaisiePeer::disableAgregation();
AbsenceEleveTraitementPeer::disableAgregation();
parent::setUp();
}
示例6: or
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
*******************************************************************************/
// prevent direct invocation
if (!isset($cfg['user']) || isset($_REQUEST['cfg'])) {
@ob_end_clean();
@header("location: ../../../index.php");
exit;
}
/******************************************************************************/
// load global settings + overwrite per-user settings
loadSettings('tf_settings');
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.admin.indexSettings.tmpl");
// set template-vars
tmplSetIndexPageFormVars();
//
tmplSetTitleBar("Administration - Index Settings");
tmplSetAdminMenu();
tmplSetFoot();
tmplSetIidVars();
// parse template
$tmpl->pparse();
示例7: loadLinks
</div>
</div>
<div class="clear">
</div>
<div id="footer">
<div id="btm_cont">
</div>
<div id="ft_btm"> <?php
loadLinks('footer');
?>
<?php
loadSettings('copyright');
?>
<?php
BsocketB('public-xhtml-footer');
?>
<br />
<!--Credits -->
<a href="http://ramblingsoul.com">CSS Template</a> by Rambling Soul<br />
Images from<a href="http://sxc.hu"> sxc.hu</a>
<!--/Credits -->
</div>
</div>
示例8: login
/**
* Attempt to log in using the given username and password.
*
* On a successful login, this function should return the users attributes. On failure,
* it should throw an exception. If the error was caused by the user entering the wrong
* username or password, a SimpleSAML_Error_Error('WRONGUSERPASS') should be thrown.
*
* Note that both the username and the password are UTF-8 encoded.
*
* @param string $username The username the user wrote.
* @param string $password The password the user wrote.
* @param string $organization The id of the organization the user chose.
* @return array Associative array with the users attributes.
*/
protected function login($username, $password, $organization) {
assert('is_string($username)');
assert('is_string($password)');
assert('is_string($organization)');
if ($organization != '') {
//$organization contient le numéro de rne
setcookie('RNE', $organization, null, '/');
}
$path = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
require_once("$path/secure/connect.inc.php");
// Database connection
require_once("$path/lib/mysql.inc");
require_once("$path/lib/mysqli.inc.php");
require_once("$path/lib/settings.inc");
require_once("$path/lib/settings.inc.php");
require_once("$path/lib/old_mysql_result.php");
// Load settings
if (!loadSettings()) {
die("Erreur chargement settings");
}
// Global configuration file
require_once("$path/lib/global.inc.php");
// Libraries
include "$path/lib/share.inc.php";
// Session related functions
require_once("$path/lib/Session.class.php");
$session_gepi = new Session();
# L'instance de Session permettant de gérer directement les authentifications
# SSO, on ne s'embête pas :
$auth = $session_gepi->authenticate_gepi($username, $password);
if ($auth != "1") {
# Echec d'authentification.
$session_gepi->record_failed_login($username);
session_write_close();
SimpleSAML_Logger::error('gepiauth:' . $this->authId .
': not authenticated. Probably wrong username/password.');
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
}
SimpleSAML_Logger::info('gepiauth:' . $this->authId . ': authenticated');
# On interroge la base de données pour récupérer des attributs qu'on va retourner
$query = mysqli_query($GLOBALS["mysqli"], "SELECT nom, prenom, email, statut FROM utilisateurs WHERE (login = '".$username."')");
$row = mysqli_fetch_object($query);
//on vérifie le status
if ($this->requiredStatut != null) {
if ($this->requiredStatut != $row->statut) {
# Echec d'authentification pour ce statut
$session_gepi->close('2');
session_write_close();
SimpleSAML_Logger::error('gepiauth:' . $this->authId .
': not authenticated. Statut is wrong.');
throw new SimpleSAML_Error_Error('WRONGUSERPASS');
}
}
$attributes = array();
$attributes['login_gepi'] = array($username);
$attributes['nom'] = array($row->nom);
$attributes['prenom'] = array($row->prenom);
$attributes['statut'] = array($row->statut);
$attributes['email'] = array($row->email);
$sql = "SELECT id_matiere FROM j_professeurs_matieres WHERE (id_professeur = '" . $username . "') ORDER BY ordre_matieres LIMIT 1";
$matiere_principale = sql_query1($sql);
$attributes['matieres'] = array($matiere_principale);
SimpleSAML_Logger::info('gepiauth:' . $this->authId . ': Attributes: ' .
implode(',', array_keys($attributes)));
return $attributes;
}
示例9: rest_get
//.........这里部分代码省略.........
$ismanager = $array_user[9];
$haspf = $array_user[10];
// Empty user
if (mysqli_escape_string($link, htmlspecialchars_decode($login)) == "") {
rest_error('USERLOGINEMPTY');
}
// Check if user already exists
$data = DB::query("SELECT id, fonction_id, groupes_interdits, groupes_visibles FROM " . prefix_table("users") . "\n WHERE login LIKE %ss", mysqli_escape_string($link, stripslashes($login)));
if (DB::count() == 0) {
try {
// find AdminRole code in DB
$resRole = DB::queryFirstRow("SELECT id\n FROM " . prefix_table("roles_title") . "\n WHERE title LIKE %ss", mysqli_escape_string($link, stripslashes($adminby)));
// get default language
$lang = DB::queryFirstRow("SELECT `valeur` FROM " . prefix_table("misc") . " WHERE type = %s AND intitule = %s", "admin", "default_language");
// prepare roles list
$rolesList = "";
foreach (explode(',', $roles) as $role) {
//echo $role."-";
$tmp = DB::queryFirstRow("SELECT `id` FROM " . prefix_table("roles_title") . " WHERE title = %s", $role);
if (empty($rolesList)) {
$rolesList = $tmp['id'];
} else {
$rolesList .= ";" . $tmp['id'];
}
}
// Add user in DB
DB::insert(prefix_table("users"), array('login' => $login, 'name' => $name, 'lastname' => $lastname, 'pw' => bCrypt(stringUtf8Decode($password), COST), 'email' => $email, 'admin' => intval($isadmin), 'gestionnaire' => intval($ismanager), 'read_only' => intval($isreadonly), 'personal_folder' => intval($haspf), 'user_language' => $lang['valeur'], 'fonction_id' => $rolesList, 'groupes_interdits' => '0', 'groupes_visibles' => '0', 'isAdministratedByRole' => empty($resRole) ? '0' : $resRole['id']));
$new_user_id = DB::insertId();
// Create personnal folder
if (intval($haspf) == 1) {
DB::insert(prefix_table("nested_tree"), array('parent_id' => '0', 'title' => $new_user_id, 'bloquer_creation' => '0', 'bloquer_modification' => '0', 'personal_folder' => '1'));
}
// load settings
loadSettings();
// Send email to new user
@sendEmail($LANG['email_subject_new_user'], str_replace(array('#tp_login#', '#tp_pw#', '#tp_link#'), array(" " . addslashes($login), addslashes($password), $_SESSION['settings']['email_server_url']), $LANG['email_new_user_mail']), $email, "");
// update LOG
logEvents('user_mngt', 'at_user_added', 'api - ' . $GLOBALS['apikey'], $new_user_id, "");
echo '{"status":"user added"}';
} catch (PDOException $ex) {
echo '<br />' . $ex->getMessage();
}
} else {
rest_error('USERALREADYEXISTS');
}
}
} elseif ($GLOBALS['request'][0] == "auth") {
/*
** FOR SECURITY PURPOSE, it is mandatory to use SSL to connect your teampass instance. The user password is not encrypted!
**
**
** Expected call format: .../api/index.php/auth/<PROTOCOL>/<URL>/<login>/<password>?apikey=<VALID API KEY>
** Example: https://127.0.0.1/teampass/api/index.php/auth/http/www.zadig-tge.adp.com/U1/test/76?apikey=chahthait5Aidood6johh6Avufieb6ohpaixain
** RESTRICTIONS:
** - <PROTOCOL> ==> http|https|ftp|...
** - <URL> ==> encode URL without protocol (example: http://www.teampass.net becomes www.teampass.net)
** - <login> ==> user's login
** - <password> ==> currently clear password
**
** RETURNED ANSWER:
** - format sent back is JSON
** - Example: {"<item_id>":{"label":"<pass#1>","login":"<login#1>","pw":"<pwd#1>"},"<item_id>":{"label":"<pass#2>","login":"<login#2>","pw":"<pwd#2>"}}
**
*/
// get user credentials
if (isset($GLOBALS['request'][3]) && isset($GLOBALS['request'][4])) {
示例10: getdb
TorrentFlux is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TorrentFlux; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// ADODB support.
require_once 'db.php';
require_once "settingsfunctions.php";
// Create Connection.
$db = getdb();
loadSettings();
session_start("TorrentFlux");
require_once "config.php";
include "themes/" . $cfg["default_theme"] . "/index.php";
global $cfg;
if (isset($_SESSION['user'])) {
header("location: index.php");
exit;
}
ob_start();
// authentication
switch ($cfg['auth_type']) {
case 3:
/* Basic-Passthru */
/* Basic-Passthru */
case 2:
示例11: define
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'admin');
/**
* Include our init.php, which manages Sessions, Language etc.
*/
$need_db_sql_data = true;
$need_root_db_sql_data = true;
require "./lib/init.php";
if (($page == 'settings' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings($settings_data, $db);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
$_part = isset($_POST['part']) ? $_POST['part'] : '';
}
if ($_part != '') {
if ($_part == 'all') {
$settings_all = true;
$settings_part = false;
} else {
$settings_all = false;
$settings_part = true;
}
$only_enabledisable = false;
} else {
示例12: send
send('<font color="red"><strong>Error</strong></font><br>');
send('database-config-file <em>' . _DIR . _FILE_DBCONF . '</em> missing. setup cannot continue.');
}
} elseif (isset($_REQUEST["3"])) {
// 3 - rename files and dirs
sendHead(" - Rename Files and Dirs");
send("<h1>" . _TITLE . "</h1>");
send("<h2>Rename Files and Dirs</h2>");
if (is_file(_FILE_DBCONF)) {
require_once _FILE_DBCONF;
$dbCon = getAdoConnection($cfg["db_type"], $cfg["db_host"], $cfg["db_user"], $cfg["db_pass"], $cfg["db_name"]);
if (!$dbCon) {
send('<font color="red"><strong>Error</strong></font><br>');
send("cannot connect to database.<p>");
} else {
$tf_settings = loadSettings("tf_settings");
// close ado-connection
$dbCon->Close();
if ($tf_settings !== false) {
$path = $tf_settings["path"];
$pathExists = false;
$renameOk = false;
$allDone = true;
if (@is_dir($path) === true && @is_dir($path . ".torrents") === true) {
$pathExists = true;
send('<ul>');
// transfers-dir
send('<li><em>' . $path . ".torrents -> " . $path . ".transfers" . '</em> : ');
$renameOk = rename($path . ".torrents", $path . ".transfers");
if ($renameOk === true) {
send('<font color="green">Ok</font></li>');
示例13: define
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
define('AREA', 'admin');
/**
* Include our init.php, which manages Sessions, Language etc.
*/
$need_db_sql_data = true;
$need_root_db_sql_data = true;
require "./lib/init.php";
if (($page == 'settings' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings(&$settings_data, &$db);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (processForm(&$settings_data, &$_POST, array('filename' => $filename, 'action' => $action, 'page' => $page))) {
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
}
} else {
$fields = buildForm(&$settings_data);
eval("echo \"" . getTemplate("settings/settings") . "\";");
}
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1');
inserttask('4');
inserttask('5');
redirectTo('admin_index.php', array('s' => $s));
示例14: foreach
// Some other requires
require_once "{$IP}/includes/Defines.php";
require_once MWInit::compiledPath('includes/DefaultSettings.php');
foreach (get_defined_vars() as $key => $var) {
if (!array_key_exists($key, $GLOBALS)) {
$GLOBALS[$key] = $var;
}
}
global $wgAutoloadClasses;
$wgAutoloadClasses = array();
if (defined('MW_CONFIG_CALLBACK')) {
# Use a callback function to configure MediaWiki
MWFunction::call(MW_CONFIG_CALLBACK);
} else {
// Require the configuration (probably LocalSettings.php)
require loadSettings();
}
// Some last includes
require_once MWInit::compiledPath('includes/Setup.php');
// Much much faster startup than creating a title object
$wgTitle = null;
require_once $IP . '/tests/TestsAutoLoader.php';
function loadSettings()
{
global $wgCommandLineMode, $IP;
$settingsFile = "{$IP}/LocalSettings.php";
if (!is_readable($settingsFile)) {
$this->error("A copy of your installation's LocalSettings.php\n" . "must exist and be readable in the source directory.\n" . "Use --conf to specify it.", true);
}
$wgCommandLineMode = true;
return $settingsFile;
示例15: die
<?php
// check for admin access to this function library //
if (!$_SESSION['adminLogIn']) {
die("Access Denied");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php
loadSettings('sitename');
?>
- ADMIN</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="theme/default_css.css" />
<link rel="shortcut icon" href="theme/images/favicon.ico" type="image/x-icon"/>
<?php
BsocketB('admin-xhtml-head');
?>
</head>
<body>
<div id="brace">
<div id="pageframe">
<div id="pageframer">
<div id="headermid">
<div id="headerr">
<div id="header">
<h1>razorCMS <span class='redtext'><?php