本文整理汇总了PHP中jAuth::loadConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP jAuth::loadConfig方法的具体用法?PHP jAuth::loadConfig怎么用?PHP jAuth::loadConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jAuth
的用法示例。
在下文中一共展示了jAuth::loadConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareTpl
protected function _prepareTpl()
{
$config = new \Jelix\JCommunity\Config();
$this->_tpl->assign('canRegister', $config->isRegistrationEnabled());
$this->_tpl->assign('canResetPassword', $config->isResetPasswordEnabled());
if (jAuth::isConnected()) {
$this->_tpl->assign('login', jAuth::getUserSession()->login);
} else {
$conf = jAuth::loadConfig();
$this->_tpl->assign('persistance_ok', jAuth::isPersistant());
$form = jForms::get("jcommunity~login");
if (!$form) {
$form = jForms::create("jcommunity~login");
}
$this->_tpl->assign('form', $form);
$this->_tpl->assign('url_return', '');
if ($conf['enable_after_login_override']) {
$req = jApp::coord()->request;
if ($req->getParam('auth_url_return')) {
$this->_tpl->assign('url_return', $req->getParam('auth_url_return'));
} else {
if ($this->param('as_main_content')) {
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && $_SERVER['HTTP_REFERER'] != jUrl::getCurrentUrl(false, true)) {
$this->_tpl->assign('url_return', $_SERVER['HTTP_REFERER']);
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') {
$this->_tpl->assign('url_return', jUrl::getCurrentUrl(false, true));
}
}
}
}
}
}
示例2: install
function install()
{
//if ($this->entryPoint->type == 'cmdline')
// return;
$authconfig = $this->config->getValue('auth', 'coordplugins');
if ($authconfig && $this->firstExec($authconfig)) {
// a config file for the auth plugin exists, so we can install
// the module, else we ignore it
$conf = new \Jelix\IniFile\IniModifier(jApp::configPath($authconfig));
$driver = $conf->getValue('driver');
if ($driver == '') {
$driver = 'Db';
$conf->setValue('driver', 'Db');
$conf->setValue('dao', 'jauthdb~jelixuser', 'Db');
$conf->save();
} else {
if ($driver != 'Db') {
return;
}
}
$this->useDbProfile($conf->getValue('profile', 'Db'));
// FIXME: should use the given dao to create the table
$daoName = $conf->getValue('dao', 'Db');
if ($daoName == 'jauthdb~jelixuser' && $this->firstDbExec()) {
$this->execSQLScript('install_jauth.schema');
if ($this->getParameter('defaultuser')) {
require_once JELIX_LIB_PATH . 'auth/jAuth.class.php';
require_once JELIX_LIB_PATH . 'plugins/auth/db/db.auth.php';
$confIni = parse_ini_file(jApp::configPath($authconfig), true);
$authConfig = jAuth::loadConfig($confIni);
$driver = new dbAuthDriver($authConfig['Db']);
$passwordHash = $driver->cryptPassword('admin');
$cn = $this->dbConnection();
$cn->exec("INSERT INTO " . $cn->prefixTable('jlx_user') . " (usr_login, usr_password, usr_email ) VALUES\n ('admin', " . $cn->quote($passwordHash) . " , 'admin@localhost.localdomain')");
}
}
}
}
示例3: form
/**
* Shows the login form
*/
function form()
{
$conf = jAuth::loadConfig();
if (jAuth::isConnected()) {
if ($conf['after_login'] != '') {
if (!($conf['enable_after_login_override'] && ($url_return = $this->param('auth_url_return')))) {
$url_return = jUrl::get($conf['after_login']);
}
$rep = $this->getResponse('redirectUrl');
$rep->url = $url_return;
return $rep;
}
}
$rep = $this->getResponse('htmlauth');
$rep->title = jLocale::get('auth.titlePage.login');
$rep->bodyTpl = 'jauth~index';
$zp = array('login' => $this->param('login'), 'failed' => $this->param('failed'), 'showRememberMe' => jAuth::isPersistant());
if ($conf['enable_after_login_override']) {
$zp['auth_url_return'] = $this->param('auth_url_return');
}
$rep->body->assignZone('MAIN', 'jauth~loginform', $zp);
return $rep;
}
示例4: install
function install()
{
$lizmapConfFile = jApp::configPath('lizmapConfig.ini.php');
if (!file_exists($lizmapConfFile)) {
$lizmapConfFileDist = jApp::configPath('lizmapConfig.ini.php.dist');
if (file_exists($lizmapConfFileDist)) {
copy($lizmapConfFileDist, $lizmapConfFile);
} else {
$this->copyFile('config/lizmapConfig.ini.php', $lizmapConfFile);
}
}
$localConfig = jApp::configPath('localconfig.ini.php');
if (!file_exists($localConfig)) {
$localConfigDist = jApp::configPath('localconfig.ini.php.dist');
if (file_exists($localConfigDist)) {
copy($localConfigDist, $localConfig);
} else {
file_put_contents($localConfig, ';<' . '?php die(\'\');?' . '>');
}
}
$ini = new jIniFileModifier($localConfig);
$ini->setValue('lizmap', 'lizmapConfig.ini.php', 'coordplugins');
$ini->save();
if ($this->firstDbExec()) {
// Add log table
$this->useDbProfile('lizlog');
$this->execSQLScript('sql/lizlog');
// Add geobookmark table
$this->useDbProfile('jauth');
$this->execSQLScript('sql/lizgeobookmark');
}
if ($this->firstExec('acl2') && $this->getParameter('demo')) {
$this->useDbProfile('auth');
// create group
jAcl2DbUserGroup::createGroup('lizadmins');
jAcl2DbUserGroup::createGroup('Intranet demos group', 'intranet');
// create user in jAuth
require_once JELIX_LIB_PATH . 'auth/jAuth.class.php';
require_once JELIX_LIB_PATH . 'plugins/auth/db/db.auth.php';
$authconfig = $this->config->getValue('auth', 'coordplugins');
$confIni = parse_ini_file(jApp::configPath($authconfig), true);
$authConfig = jAuth::loadConfig($confIni);
$driver = new dbAuthDriver($authConfig['Db']);
$passwordHash1 = $driver->cryptPassword('lizadmin');
$passwordHash2 = $driver->cryptPassword('logintranet');
$cn = $this->dbConnection();
$cn->exec("INSERT INTO " . $cn->prefixTable('jlx_user') . " (usr_login, usr_password, usr_email ) VALUES\n ('lizadmin', " . $cn->quote($passwordHash1) . " , 'lizadmin@nomail.nomail')");
$cn->exec("INSERT INTO " . $cn->prefixTable('jlx_user') . " (usr_login, usr_password, usr_email ) VALUES\n ('logintranet', " . $cn->quote($passwordHash2) . " , 'logintranet@nomail.nomail')");
// declare users in jAcl2
jAcl2DbUserGroup::createUser('lizadmin', true);
jAcl2DbUserGroup::createUser('logintranet', true);
jAcl2DbUserGroup::addUserToGroup('lizadmin', 'lizadmins');
jAcl2DbUserGroup::addUserToGroup('logintranet', 'intranet');
jAcl2DbManager::setRightsOnGroup('lizadmins', array('lizmap.admin.access' => true, 'lizmap.admin.services.update' => true, 'lizmap.admin.repositories.create' => true, 'lizmap.admin.repositories.delete' => true, 'lizmap.admin.repositories.update' => true, 'lizmap.admin.repositories.view' => true, 'lizmap.admin.services.view' => true));
// admins
jAcl2DbManager::addRight('admins', 'lizmap.tools.edition.use', 'intranet');
jAcl2DbManager::addRight('admins', 'lizmap.repositories.view', 'intranet');
jAcl2DbManager::addRight('admins', 'lizmap.tools.loginFilteredLayers.override', 'intranet');
jAcl2DbManager::addRight('admins', 'lizmap.tools.displayGetCapabilitiesLinks', 'intranet');
jAcl2DbManager::addRight('admins', 'lizmap.tools.edition.use', 'montpellier');
jAcl2DbManager::addRight('admins', 'lizmap.repositories.view', 'montpellier');
jAcl2DbManager::addRight('admins', 'lizmap.tools.loginFilteredLayers.override', 'montpellier');
jAcl2DbManager::addRight('admins', 'lizmap.tools.displayGetCapabilitiesLinks', 'montpellier');
// lizadmins
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.edition.use', 'intranet');
jAcl2DbManager::addRight('lizadmins', 'lizmap.repositories.view', 'intranet');
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.loginFilteredLayers.override', 'intranet');
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.displayGetCapabilitiesLinks', 'intranet');
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.edition.use', 'montpellier');
jAcl2DbManager::addRight('lizadmins', 'lizmap.repositories.view', 'montpellier');
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.loginFilteredLayers.override', 'montpellier');
jAcl2DbManager::addRight('lizadmins', 'lizmap.tools.displayGetCapabilitiesLinks', 'montpellier');
// intranet
jAcl2DbManager::addRight('intranet', 'lizmap.tools.edition.use', 'intranet');
jAcl2DbManager::addRight('intranet', 'lizmap.repositories.view', 'intranet');
jAcl2DbManager::addRight('intranet', 'lizmap.tools.loginFilteredLayers.override', 'intranet');
jAcl2DbManager::addRight('intranet', 'lizmap.tools.displayGetCapabilitiesLinks', 'intranet');
jAcl2DbManager::addRight('intranet', 'lizmap.tools.edition.use', 'montpellier');
jAcl2DbManager::addRight('intranet', 'lizmap.repositories.view', 'montpellier');
jAcl2DbManager::addRight('intranet', 'lizmap.tools.loginFilteredLayers.override', 'montpellier');
jAcl2DbManager::addRight('intranet', 'lizmap.tools.displayGetCapabilitiesLinks', 'montpellier');
// anonymous
jAcl2DbManager::addRight('__anonymous', 'lizmap.tools.edition.use', 'montpellier');
jAcl2DbManager::addRight('__anonymous', 'lizmap.repositories.view', 'montpellier');
jAcl2DbManager::addRight('__anonymous', 'lizmap.tools.loginFilteredLayers.override', 'montpellier');
jAcl2DbManager::addRight('__anonymous', 'lizmap.tools.displayGetCapabilitiesLinks', 'montpellier');
// declare the repositories of demo in the configuration
$ini = new jIniFileModifier($lizmapConfFile);
$ini->setValues(array('label' => 'LizMap Demo', 'path' => '../install/qgis/', 'allowUserDefinedThemes' => 1), 'repository:montpellier');
$ini->setValues(array('label' => 'Lizmap Demo - Intranet', 'path' => '../install/qgis_intranet/', 'allowUserDefinedThemes' => ''), 'repository:intranet');
$ini->setValue('defaultRepository', 'montpellier', 'services');
$ini->save();
}
}
示例5: install
function install()
{
$authconfig = $this->config->getValue('auth', 'coordplugins');
$authconfigMaster = $this->config->getValue('auth', 'coordplugins', null, true);
$forWS = in_array($this->entryPoint->type, array('json', 'jsonrpc', 'soap', 'xmlrpc'));
$createdConfFile = false;
if (!$authconfig || $forWS && $authconfig == $authconfigMaster) {
//if ($this->entryPoint->type == 'cmdline') {
// return;
//}
if ($forWS) {
$pluginIni = 'authsw.coord.ini.php';
} else {
$pluginIni = 'auth.coord.ini.php';
}
$authconfig = dirname($this->entryPoint->configFile) . '/' . $pluginIni;
if ($this->firstExec($authconfig)) {
// no configuration, let's install the plugin for the entry point
$this->config->setValue('auth', $authconfig, 'coordplugins');
$this->copyFile('var/config/' . $pluginIni, 'epconfig:' . $pluginIni);
$createdConfFile = true;
}
}
$conf = new jIniFileModifier(jApp::configPath($authconfig));
$usedStandardDao = $conf->getValue('dao', 'Db') == 'jauthdb~jelixuser';
$this->useDbProfile($conf->getValue('profile', 'Db'));
if ($createdConfFile) {
mt_srand();
$conf->setValue('persistant_crypt_key', sha1("jelix" . time() . mt_rand()));
$conf->save();
}
if ($this->firstExec($authconfig) && $this->getParameter('rewriteconfig')) {
$conf->setValue('driver', 'Db');
$conf->setValue('dao', 'jcommunity~user', 'Db');
$conf->setValue('form', 'jcommunity~account_admin', 'Db');
$conf->setValue('error_message', 'jcommunity~login.error.notlogged');
$conf->setValue('on_error_action', 'jcommunity~login:out');
$conf->setValue('bad_ip_action', 'jcommunity~login:out');
$conf->setValue('after_logout', 'jcommunity~login:index');
$conf->setValue('enable_after_login_override', 'on');
$conf->setValue('enable_after_logout_override', 'on');
$conf->setValue('after_login', 'jcommunity~account:show');
$conf->save();
}
if ($this->getParameter('masteradmin')) {
$conf->setValue('after_login', 'master_admin~default:index');
$conf->save();
$this->config->setValue('loginResponse', 'htmlauth', 'jcommunity');
}
if ($this->firstDbExec() && !$this->getParameter('notjcommunitytable')) {
$conf->setValue('dao', 'jcommunity~user', 'Db');
$conf->setValue('form', 'jcommunity~account_admin', 'Db');
$conf->save();
$this->execSQLScript('sql/install');
$cn = $this->dbConnection();
if ($usedStandardDao && $this->getParameter('migratejauthdbusers')) {
$cn->exec("INSERT INTO " . $cn->prefixTable('community_users') . "\n (login, password, email, nickname, status, create_date)\n SELECT usr_login, usr_password, usr_email, usr_login, 1, '" . date('Y-m-d H:i:s') . "'\n FROM " . $cn->prefixTable('jlx_user'));
} else {
if ($this->getParameter('defaultuser')) {
require_once JELIX_LIB_PATH . 'auth/jAuth.class.php';
require_once JELIX_LIB_PATH . 'plugins/auth/db/db.auth.php';
$confIni = parse_ini_file(jApp::configPath($authconfig), true);
$authConfig = jAuth::loadConfig($confIni);
$driver = new dbAuthDriver($authConfig['Db']);
$passwordHash = $driver->cryptPassword('admin');
$cn->exec("INSERT INTO " . $cn->prefixTable('community_users') . " (login, password, email, nickname, status, create_date) VALUES\n ('admin', " . $cn->quote($passwordHash) . ", 'admin@localhost.localdomain', 'admin', 1, '" . date('Y-m-d H:i:s') . "')");
}
}
}
if ($this->firstExec('acl2') && class_exists('jAcl2DbManager')) {
jAcl2DbManager::addSubjectGroup('jcommunity.admin', 'jcommunity~prefs.admin.jcommunity');
jAcl2DbManager::addSubject('jcommunity.prefs.change', 'jcommunity~prefs.admin.prefs.change', 'jprefs.prefs.management');
jAcl2DbManager::addRight('admins', 'jcommunity.prefs.change');
// for admin group
}
if ($this->firstExec('preferences')) {
$prefIni = new jIniFileModifier(__DIR__ . '/prefs.ini');
$prefFile = jApp::configPath('preferences.ini.php');
if (file_exists($prefFile)) {
$mainPref = new jIniFileModifier($prefFile);
//import this way to not erase changed value.
$prefIni->import($mainPref);
}
$prefIni->saveAs($prefFile);
}
}