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


PHP ACL::createRandomKey方法代码示例

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


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

示例1: createSConfigurationFile

 public function createSConfigurationFile($params)
 {
     try {
         if (file_exists($conf = 'sites/conf.example.php')) {
             if (($params->AESkey = ACL::createRandomKey()) !== false) {
                 $buffer = file_get_contents($conf);
                 $search = ['#host#', '#user#', '#pass#', '#db#', '#port#', '#key#', '#lang#', '#theme#', '#timezone#', '#sitename#', '#hl7Port#'];
                 $replace = [$params->dbHost, $params->dbUser, $params->dbPass, $params->dbName, $params->dbPort, $params->AESkey, $params->lang, $params->theme, $params->timezone, $params->siteId, 9100];
                 $newConf = str_replace($search, $replace, $buffer);
                 $siteDir = "sites/{$params->siteId}";
                 $conf_file = "{$siteDir}/conf.php";
                 $handle = fopen($conf_file, 'w');
                 fwrite($handle, $newConf);
                 fclose($handle);
                 chmod($conf_file, 0644);
                 if (file_exists($conf_file)) {
                     return ['success' => true, 'AESkey' => $params->AESkey];
                 } else {
                     throw new Exception("Unable to create {$siteDir}/conf.php file");
                 }
             } else {
                 throw new Exception('Unable to Generate AES 32 bit key');
             }
         } else {
             throw new Exception('Unable to Find sites/conf.example.php');
         }
     } catch (Exception $Error) {
         return ['success' => false, 'error' => $Error->getMessage()];
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:30,代码来源:SiteSetup.php

示例2: createSConfigurationFile

 public function createSConfigurationFile($params)
 {
     if (file_exists($conf = 'sites/conf.example.php')) {
         if (($params->AESkey = ACL::createRandomKey()) !== false) {
             $buffer = file_get_contents($conf);
             $search = array('%host%', '%user%', '%pass%', '%db%', '%port%', '%key%', '%lang%', '%theme%', '%timezone%', '%sitename%');
             $replace = array($params->dbHost, $params->dbUser, $params->dbPass, $params->dbName, $params->dbPort, $params->AESkey, $params->lang, $params->theme, $params->timezone, $params->siteId);
             $newConf = str_replace($search, $replace, $buffer);
             $siteDir = "sites/{$params->siteId}";
             $conf_file = "{$siteDir}/conf.php";
             $handle = fopen($conf_file, 'w');
             fwrite($handle, $newConf);
             fclose($handle);
             chmod($conf_file, 0644);
             if (file_exists($conf_file)) {
                 return array('success' => true, 'AESkey' => $params->AESkey);
             } else {
                 return array('success' => false, 'error' => "Unable to create {$siteDir}/conf.php file");
             }
         } else {
             return array('success' => false, 'error' => 'Unable to Generate AES 32 bit key');
         }
     } else {
         return array('success' => false, 'error' => 'Unable to Find sites/conf.example.php');
     }
 }
开发者ID:nhom5UET,项目名称:tichhophethong,代码行数:26,代码来源:SiteSetup.php


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