当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleSAML_Module::getModuleDir方法代码示例

本文整理汇总了PHP中SimpleSAML_Module::getModuleDir方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Module::getModuleDir方法的具体用法?PHP SimpleSAML_Module::getModuleDir怎么用?PHP SimpleSAML_Module::getModuleDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML_Module的用法示例。


在下文中一共展示了SimpleSAML_Module::getModuleDir方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 public static function getInstance()
 {
     if (self::$instance !== null) {
         return self::$instance;
     }
     $loader = new \Twig_Loader_Filesystem();
     $translator = Translator::getInstance();
     $modules = \SimpleSAML_Module::getModules();
     foreach ($modules as $module) {
         if (\SimpleSAML_Module::isModuleEnabled($module)) {
             $path = \SimpleSAML_Module::getModuleDir($module);
             $templatePath = self::resourceExists('templates', $path);
             if (false !== $templatePath) {
                 $loader->addPath($templatePath, $module);
             }
             $translationPath = self::resourceExists('translations', $path);
             if (false !== $translationPath) {
                 $translations = new Finder();
                 $translations->files()->in($translationPath)->name('/\\.[a-zA-Z_]+\\.yml$/');
                 /** @var SplFileInfo $translation */
                 foreach ($translations as $translation) {
                     $name = $translation->getBasename('.yml');
                     $locale = substr($name, strrpos($name, '.') + 1);
                     $translator->addResource('yaml', $translation->getPathname(), $locale, $module);
                 }
             }
         }
     }
     self::$instance = new \Twig_Environment($loader);
     self::$instance->addExtension(new TranslationExtension($translator));
     return self::$instance;
 }
开发者ID:sgomez,项目名称:simplesamlphp-module-twig,代码行数:32,代码来源:Twig.php

示例2: classAutoLoader

 /**
  * Class autoloader.
  */
 public static function classAutoLoader()
 {
     $moduleConfig = SimpleSAML_Configuration::getConfig('module_tiqr.php');
     $moduleDir = SimpleSAML_Module::getModuleDir('authTiqr');
     $path = array('tiqr.path' => $moduleConfig->getString('tiqr.path', $moduleDir . '/extlibinc/tiqr'), 'phpqrcode.path' => $moduleConfig->getString('phpqrcode.path', $moduleDir . '/extlibinc/phpqrcode'), 'zend.path' => $moduleConfig->getString('zend.path', $moduleDir . '/extlibinc/zend'));
     require_once $path['tiqr.path'] . '/Tiqr/AutoLoader.php';
     $autoloader = Tiqr_AutoLoader::getInstance($path);
     $autoloader->setIncludePath();
 }
开发者ID:RKathees,项目名称:is-connectors,代码行数:12,代码来源:Tiqr.php

示例3: getDictionary

 /**
  * This method retrieves a dictionary with the name given.
  *
  * @param string $name The name of the dictionary, as the filename in the dictionary directory, without the
  * '.php' ending.
  *
  * @return array An associative array with the dictionary.
  */
 private function getDictionary($name)
 {
     assert('is_string($name)');
     if (!array_key_exists($name, $this->dictionaries)) {
         $sepPos = strpos($name, ':');
         if ($sepPos !== false) {
             $module = substr($name, 0, $sepPos);
             $fileName = substr($name, $sepPos + 1);
             $dictDir = \SimpleSAML_Module::getModuleDir($module) . '/dictionaries/';
         } else {
             $dictDir = $this->configuration->getPathValue('dictionarydir', 'dictionaries/');
             $fileName = $name;
         }
         $this->dictionaries[$name] = $this->readDictionaryFile($dictDir . $fileName);
     }
     return $this->dictionaries[$name];
 }
开发者ID:mrvanes,项目名称:simplesamlphp,代码行数:25,代码来源:Translate.php

示例4: SimpleSAML_autoload

/**
 * Autoload function for SimpleSAMLphp modules.
 *
 * @param string $className Name of the class.
 */
function SimpleSAML_autoload($className)
{
    $modulePrefixLength = strlen('sspmod_');
    $classPrefix = substr($className, 0, $modulePrefixLength);
    if ($classPrefix !== 'sspmod_') {
        return;
    }
    $modNameEnd = strpos($className, '_', $modulePrefixLength);
    $module = substr($className, $modulePrefixLength, $modNameEnd - $modulePrefixLength);
    $moduleClass = substr($className, $modNameEnd + 1);
    if (!SimpleSAML_Module::isModuleEnabled($module)) {
        return;
    }
    $file = SimpleSAML_Module::getModuleDir($module) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php';
    if (file_exists($file)) {
        require_once $file;
    }
}
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:23,代码来源:_autoload_modules.php

示例5: processInput

function processInput($fieldValues, $expectedValues)
{
    global $eppnRealm;
    $skv = array();
    foreach ($expectedValues as $db => $field) {
        switch ($db) {
            case "cn":
                $hookfile = SimpleSAML_Module::getModuleDir('selfregister') . '/hooks/hook_attributes.php';
                include_once $hookfile;
                $skv[$db] = get_cn_hook($fieldValues);
                break;
            case "userPassword":
                $skv[$db] = sspmod_selfregister_Util::validatePassword($fieldValues);
                break;
                //			case "eduPersonPrincipalName":
                //				$skv[$db] = $fieldValues['uid'].'@'.$eppnRealm;
                //				break;
            //			case "eduPersonPrincipalName":
            //				$skv[$db] = $fieldValues['uid'].'@'.$eppnRealm;
            //				break;
            case "mail":
                if (array_key_exists('token', $_POST)) {
                    global $tokenLifetime;
                    $tg = new SimpleSAML_Auth_TimeLimitedToken($tokenLifetime);
                    $email = $_POST['emailconfirmed'];
                    $tg->addVerificationData($email);
                    $token = $_POST['token'];
                    if (!$tg->validate_token($token)) {
                        throw new sspmod_selfregister_Error_UserException('invalid_token');
                    }
                    $skv[$db] = $email;
                }
                break;
            default:
                $skv[$db] = $fieldValues[$field];
        }
    }
    return $skv;
}
开发者ID:GEANT,项目名称:simplesamlphp-module-selfregister,代码行数:39,代码来源:hook_attributes.php

示例6: SimpleSAML_autoload

/**
 * Autoload function for simpleSAMLphp.
 *
 * It will autoload all classes stored in the lib-directory.
 *
 * @param $className  The name of the class.
 */
function SimpleSAML_autoload($className)
{
    $libDir = dirname(__FILE__) . '/';
    /* Special handling for xmlseclibs.php. */
    if (in_array($className, array('XMLSecurityKey', 'XMLSecurityDSig', 'XMLSecEnc'), TRUE)) {
        require_once $libDir . 'xmlseclibs.php';
        return;
    }
    /* Handlig of modules. */
    if (substr($className, 0, 7) === 'sspmod_') {
        $modNameEnd = strpos($className, '_', 7);
        $module = substr($className, 7, $modNameEnd - 7);
        $moduleClass = substr($className, $modNameEnd + 1);
        if (!SimpleSAML_Module::isModuleEnabled($module)) {
            return;
        }
        $file = SimpleSAML_Module::getModuleDir($module) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php';
    } else {
        $file = $libDir . str_replace('_', '/', $className) . '.php';
    }
    if (file_exists($file)) {
        require_once $file;
    }
}
开发者ID:hooplad,项目名称:saml-20-single-sign-on,代码行数:31,代码来源:_autoload.php

示例7: SimpleSAML_Error_NotFound

 if ($url === false) {
     $url = '';
 }
 if (!SimpleSAML_Module::isModuleEnabled($module)) {
     throw new SimpleSAML_Error_NotFound('The module \'' . $module . '\' was either not found, or wasn\'t enabled.');
 }
 /* Make sure that the request isn't suspicious (contains references to current directory or parent directory or
  * anything like that. Searching for './' in the URL will detect both '../' and './'. Searching for '\' will detect
  * attempts to use Windows-style paths.
  */
 if (strpos($url, '\\') !== false) {
     throw new SimpleSAML_Error_BadRequest('Requested URL contained a backslash.');
 } elseif (strpos($url, './') !== false) {
     throw new SimpleSAML_Error_BadRequest('Requested URL contained \'./\'.');
 }
 $moduleDir = SimpleSAML_Module::getModuleDir($module) . '/www/';
 // check for '.php/' in the path, the presence of which indicates that another php-script should handle the request
 for ($phpPos = strpos($url, '.php/'); $phpPos !== false; $phpPos = strpos($url, '.php/', $phpPos + 1)) {
     $newURL = substr($url, 0, $phpPos + 4);
     $param = substr($url, $phpPos + 4);
     if (is_file($moduleDir . $newURL)) {
         /* $newPath points to a normal file. Point execution to that file, and
          * save the remainder of the path in PATH_INFO.
          */
         $url = $newURL;
         $_SERVER['PATH_INFO'] = $param;
         break;
     }
 }
 $path = $moduleDir . $url;
 if ($path[strlen($path) - 1] === '/') {
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:31,代码来源:module.php

示例8: isset

<?php

/**
 * Header template.
 *
 * The main header template. This is used throughout the application.
 *
 * @author     Cory Collier <corycollier@corycollier.com>
 * @license    http://opensource.org/licenses/MIT  MIT License
 * @version    git: $Id$
 * @link       https://github.com/corycollier/simplesamlphp-module-themes
 * @see        https://github.com/simplesamlphp/simplesamlphp/
 * @since      File available since Release 1.3.0
 */
$dir = SimpleSAML_Module::getModuleDir('themes');
require $dir . '/lib/functions.php';
// Define variables.
$url_path = SimpleSAML_Module::getModuleURL('themes');
$css_path = $url_path . '/css';
$js_path = $url_path . '/js';
$img_path = $url_path . '/img';
$language = $this->getLanguage();
$this->data['isadmin'] = (bool) SimpleSAML_Session::getSessionFromRequest()->getAuthState('admin');
$login_url = isset($this->data['loginurl']) ? $this->data['loginurl'] : '';
$title = isset($this->data['header']) ? $this->data['header'] : 'SimpleSAMLphp';
$alert_msg = $this->data['isadmin'] ? $this->t('{core:frontpage:loggedin_as_admin}') : '<a href="' . $login_url . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a>';
if (array_key_exists('pageid', $this->data)) {
    $hookinfo = array('pre' => &$this->data['htmlinject']['htmlContentPre'], 'post' => &$this->data['htmlinject']['htmlContentPost'], 'head' => &$this->data['htmlinject']['htmlContentHead'], 'jquery' => &$jquery, 'page' => $this->data['pageid']);
    SimpleSAML_Module::callHooks('htmlinject', $hookinfo);
}
?>
开发者ID:corycollier,项目名称:simplesamlphp-module-themes,代码行数:31,代码来源:header.php

示例9: findTemplatePath

 /**
  * Find template path.
  *
  * This function locates the given template based on the template name. It will first search for the template in
  * the current theme directory, and then the default theme.
  *
  * The template name may be on the form <module name>:<template path>, in which case it will search for the
  * template file in the given module.
  *
  * @param string $template The relative path from the theme directory to the template file.
  *
  * @return string The absolute path to the template file.
  *
  * @throws Exception If the template file couldn't be found.
  */
 private function findTemplatePath($template)
 {
     assert('is_string($template)');
     $tmp = explode(':', $template, 2);
     if (count($tmp) === 2) {
         $templateModule = $tmp[0];
         $templateName = $tmp[1];
     } else {
         $templateModule = 'default';
         $templateName = $tmp[0];
     }
     $tmp = explode(':', $this->configuration->getString('theme.use', 'default'), 2);
     if (count($tmp) === 2) {
         $themeModule = $tmp[0];
         $themeName = $tmp[1];
     } else {
         $themeModule = null;
         $themeName = $tmp[0];
     }
     // first check the current theme
     if ($themeModule !== null) {
         // .../module/<themeModule>/themes/<themeName>/<templateModule>/<templateName>
         $filename = SimpleSAML_Module::getModuleDir($themeModule) . '/themes/' . $themeName . '/' . $templateModule . '/' . $templateName;
     } elseif ($templateModule !== 'default') {
         // .../module/<templateModule>/templates/<themeName>/<templateName>
         $filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName;
     } else {
         // .../templates/<theme>/<templateName>
         $filename = $this->configuration->getPathValue('templatedir', 'templates/') . $templateName;
     }
     if (file_exists($filename)) {
         return $filename;
     }
     // not found in current theme
     SimpleSAML_Logger::debug($_SERVER['PHP_SELF'] . ' - Template: Could not find template file [' . $template . '] at [' . $filename . '] - now trying the base template');
     // try default theme
     if ($templateModule !== 'default') {
         // .../module/<templateModule>/templates/<templateName>
         $filename = SimpleSAML_Module::getModuleDir($templateModule) . '/templates/' . $templateName;
     } else {
         // .../templates/<templateName>
         $filename = $this->configuration->getPathValue('templatedir', 'templates/') . '/' . $templateName;
     }
     if (file_exists($filename)) {
         return $filename;
     }
     // not found in default template - log error and throw exception
     $error = 'Template: Could not find template file [' . $template . '] at [' . $filename . ']';
     SimpleSAML_Logger::critical($_SERVER['PHP_SELF'] . ' - ' . $error);
     throw new Exception($error);
 }
开发者ID:mrvanes,项目名称:simplesamlphp,代码行数:66,代码来源:Template.php

示例10: __autoload

function __autoload($class_name)
{
	$tab_classes = array(
		'DB'                          => '_lib'.DIRECTORY_SEPARATOR.'DB'.DIRECTORY_SEPARATOR.'DB.class.php' ,
		'FirePHP'                     => '_lib'.DIRECTORY_SEPARATOR.'FirePHPCore'.DIRECTORY_SEPARATOR.'FirePHP.class.php' ,
		'FPDF'                        => '_lib'.DIRECTORY_SEPARATOR.'FPDF'.DIRECTORY_SEPARATOR.'fpdf.php' ,
		'PDF_Label'                   => '_lib'.DIRECTORY_SEPARATOR.'FPDF'.DIRECTORY_SEPARATOR.'PDF_Label.php' ,
		'FPDI'                        => '_lib'.DIRECTORY_SEPARATOR.'FPDI'.DIRECTORY_SEPARATOR.'fpdi.php' ,
		'PDFMerger'                   => '_lib'.DIRECTORY_SEPARATOR.'FPDI'.DIRECTORY_SEPARATOR.'PDFMerger.php' ,
		'phpCAS'                      => '_lib'.DIRECTORY_SEPARATOR.'phpCAS'.DIRECTORY_SEPARATOR.'CAS.php' ,

		'cssmin'                      => '_inc'.DIRECTORY_SEPARATOR.'class.CssMinified.php' ,
		'MyDOMDocument'               => '_inc'.DIRECTORY_SEPARATOR.'class.domdocument.php' ,
		'JSMin'                       => '_inc'.DIRECTORY_SEPARATOR.'class.JavaScriptMinified.php' ,
		'JavaScriptPacker'            => '_inc'.DIRECTORY_SEPARATOR.'class.JavaScriptPacker.php' ,
		'PDF'                         => '_inc'.DIRECTORY_SEPARATOR.'class.PDF.php' ,

		'Formulaire'                  => '_inc'.DIRECTORY_SEPARATOR.'class.formulaire.php' ,

		'DB_STRUCTURE_ADMINISTRATEUR' => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_administrateur.php' ,
		'DB_STRUCTURE_DIRECTEUR'      => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_directeur.php' ,
		'DB_STRUCTURE_ELEVE'          => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_eleve.php' ,
		'DB_STRUCTURE_PROFESSEUR'     => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_professeur.php' ,
		'DB_STRUCTURE_PUBLIC'         => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_public.php' ,
		'DB_STRUCTURE_WEBMESTRE'      => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_webmestre.php' ,

		'DB_STRUCTURE_BILAN'          => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_bilan.php' ,
		'DB_STRUCTURE_OFFICIEL'       => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_officiel.php' ,
		'DB_STRUCTURE_COMMUN'         => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_commun.php' ,
		'DB_STRUCTURE_MAJ_BASE'       => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_maj_base.php' ,
		'DB_STRUCTURE_REFERENTIEL'    => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_referentiel.php' ,
		'DB_STRUCTURE_SOCLE'          => '_sql'.DIRECTORY_SEPARATOR.'requetes_structure_socle.php' ,

		'DB_WEBMESTRE_PUBLIC'         => '_sql'.DIRECTORY_SEPARATOR.'requetes_webmestre_public.php' ,
		'DB_WEBMESTRE_SELECT'         => '_sql'.DIRECTORY_SEPARATOR.'requetes_webmestre_select.php' ,
		'DB_WEBMESTRE_WEBMESTRE'      => '_sql'.DIRECTORY_SEPARATOR.'requetes_webmestre_webmestre.php'
	);
	if(isset($tab_classes[$class_name]))
	{
		load_class($class_name,CHEMIN_SACOCHE.$tab_classes[$class_name]);
	}
	// Remplacement de l'autoload de phpCAS qui n'est pas chargé à cause de celui de SACoche
	// Voir le fichier ./_lib/phpCAS/CAS/autoload.php
	elseif(substr($class_name,0,4)=='CAS_')
	{
		load_class($class_name,CHEMIN_SACOCHE.'_lib'.DIRECTORY_SEPARATOR.'phpCAS'.DIRECTORY_SEPARATOR.str_replace('_',DIRECTORY_SEPARATOR,$class_name).'.php');
	}
	// Remplacement de l'autoload de SimpleSAMLphp qui n'est pas chargé à cause de celui de SACoche
	// Voir le fichier ./_lib/SimpleSAMLphp/lib/_autoload.php
	else if(in_array($class_name, array('XMLSecurityKey', 'XMLSecurityDSig', 'XMLSecEnc'), TRUE))
	{
		load_class($class_name,CHEMIN_SACOCHE.'_lib'.DIRECTORY_SEPARATOR.'SimpleSAMLphp'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'xmlseclibs.php');
	}
	else if(substr($class_name,0,7)=='sspmod_')
	{
		$modNameEnd  = strpos($class_name, '_', 7);
		$module      = substr($class_name, 7, $modNameEnd - 7);
		$moduleClass = substr($class_name, $modNameEnd + 1);
		if(SimpleSAML_Module::isModuleEnabled($module))
		{
			load_class($class_name,SimpleSAML_Module::getModuleDir($module).'/lib/'.str_replace('_', DIRECTORY_SEPARATOR, $moduleClass).'.php');
		}
	}
	elseif( (substr($class_name,0,5)=='SAML2') || (substr($class_name,0,10)=='SimpleSAML') )
	{
		load_class($class_name,CHEMIN_SACOCHE.'_lib'.DIRECTORY_SEPARATOR.'SimpleSAMLphp'.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.str_replace('_','/',$class_name).'.php');
	}
	// La classe invoquée ne correspond pas à ce qui vient d'être passé en revue
	else
	{
		affich_message_exit($titre='Classe introuvable',$contenu='La classe '.$class_name.' est inconnue.');
	}
}
开发者ID:rhertzog,项目名称:lcs,代码行数:73,代码来源:config_serveur.php

示例11: filterAsAttributes

 public static function filterAsAttributes($asAttributes, $reviewAttr)
 {
     $hookfile = SimpleSAML_Module::getModuleDir('selfregister') . '/hooks/hook_attributes.php';
     include_once $hookfile;
     return filterAsAttributes($asAttributes, $reviewAttr);
 }
开发者ID:googlecode-mirror,项目名称:simplesamlphp-labs,代码行数:6,代码来源:Util.php

示例12:

if (!is_null($sid['url'])) {
    SimpleSAML_Utilities::checkURLAllowed($sid['url']);
}
$state = SimpleSAML_Auth_State::loadState($id, 'duosecurity:request');
if (array_key_exists('core:SP', $state)) {
    $spentityid = $state['core:SP'];
} else {
    if (array_key_exists('saml:sp:State', $state)) {
        $spentityid = $state['saml:sp:State']['core:SP'];
    } else {
        $spentityid = 'UNKNOWN';
    }
}
// Duo returned a good auth, pass the user on
if (isset($_POST['sig_response'])) {
    require SimpleSAML_Module::getModuleDir('duosecurity') . '/templates/duo_web.php';
    $resp = Duo::verifyResponse($state['duosecurity:ikey'], $state['duosecurity:skey'], $state['duosecurity:akey'], $_POST['sig_response']);
    if (isset($state['Attributes'][$state['duosecurity:usernameAttribute']])) {
        $username = $state['Attributes'][$state['duosecurity:usernameAttribute']][0];
    } else {
        throw new SimpleSAML_Error_BadRequest('Missing required username attribute.');
    }
    if ($resp != NULL and $resp === $username) {
        $state['duo_complete'] = True;
        SimpleSAML_Auth_ProcessingChain::resumeProcessing($state);
    } else {
        throw new SimpleSAML_Error_BadRequest('Response verification failed.');
    }
}
// Bypass Duo if auth source is not specified in config file
/*
开发者ID:scottcarlson,项目名称:simplesamlphp-duosecurity,代码行数:31,代码来源:getduo.php


注:本文中的SimpleSAML_Module::getModuleDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。