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


PHP config::genKey方法代码示例

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


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

示例1: updateNginxRedirection

 public static function updateNginxRedirection()
 {
     foreach (self::listServerZwave(false) as $zwave) {
         if (trim($zwave['addr']) == '' || trim($zwave['port']) == '') {
             continue;
         }
         $urlPath = config::byKey('urlPath' . $zwave['id'], 'openzwave');
         if ($urlPath == '') {
             $urlPath = 'openzwave_' . $zwave['id'] . '_' . config::genKey(30);
             config::save('urlPath' . $zwave['id'], $urlPath, 'openzwave');
         }
         $rules = array("location /" . $urlPath . "/ {\n" . "proxy_pass http://" . $zwave['addr'] . ":" . $zwave['port'] . "/;\n" . "proxy_redirect off;\n" . "proxy_set_header Host \$host:\$server_port;\n" . "proxy_set_header X-Real-IP \$remote_addr;\n" . "}");
         network::nginx_saveRule($rules);
     }
 }
开发者ID:stef3569,项目名称:plugin-openzwave,代码行数:15,代码来源:openzwave.class.php

示例2: createTemporary

 public static function createTemporary($_hours)
 {
     $user = new self();
     $user->setLogin('temp_' . config::genKey());
     $user->setPassword(config::genKey(45));
     $user->setRights('admin', 1);
     $user->setOptions('validity_limit', date('Y-m-d H:i:s', strtotime('+' . $_hours . ' hour now')));
     $user->save();
     return $user;
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:10,代码来源:user.class.php

示例3: Exception

     if (!isConnect() && !login(init('username'), init('password'), true)) {
         throw new Exception('Mot de passe ou nom d\'utilisateur incorrect');
     }
     if (init('storeConnection') == 1) {
         setcookie('registerDevice', $_SESSION['user']->getHash(), time() + 365 * 24 * 3600, "/", '', false, true);
     }
     ajax::success();
 }
 if (init('action') == 'forgotPassword') {
     log::add('user', 'info', __('Demande de récupération de mot de passe pour : ', __FILE__) . init('login'));
     $user = user::byLogin(init('login'));
     if (!is_object($user)) {
         connection::failed();
         throw new Exception('Utilisateur introuvable');
     }
     $newPassword = config::genKey();
     $oldPassword = $user->getPassword();
     $user->setPassword(sha1($newPassword));
     $cmds = explode('&&', config::byKey('emailAdmin'));
     $found = false;
     try {
         if (count($cmds) > 0) {
             foreach ($cmds as $id) {
                 $cmd = cmd::byId(str_replace('#', '', $id));
                 if (is_object($cmd)) {
                     $found = true;
                     $cmd->execCmd(array('title' => __('[JEEDOM] Récuperation de mot de passe', __FILE__), 'message' => 'Voici votre nouveau mot de passe pour votre installation jeedom : ' . $newPassword));
                 }
             }
         }
     } catch (Exception $e) {
开发者ID:saez0pub,项目名称:core,代码行数:31,代码来源:user.ajax.php

示例4: renameSysInfoFolder

 public static function renameSysInfoFolder()
 {
     $folder = self::getCurrentSysInfoFolder();
     if ($folder != '') {
         rename(dirname(__FILE__) . '/../../' . $folder, dirname(__FILE__) . '/../../sysinfo' . config::genKey());
     }
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:7,代码来源:jeedom.class.php

示例5: getHash

 public function getHash()
 {
     if ($this->hash == '' && $this->id != '') {
         $hash = sha1(config::genKey(128));
         while (is_object(self::byHash($hash))) {
             $hash = sha1(config::genKey(128));
         }
         $this->setHash($hash);
         $this->save();
     }
     return $this->hash;
 }
开发者ID:saez0pub,项目名称:core,代码行数:12,代码来源:user.class.php

示例6: preSave

 public function preSave()
 {
     if ($this->getConfiguration('key') == '') {
         $this->setConfiguration('key', config::genKey(30));
     }
 }
开发者ID:jeedom,项目名称:plugin-openvpn,代码行数:6,代码来源:openvpn.class.php

示例7: save

 public function save()
 {
     if ($this->getMessage() == '') {
         return;
     }
     if ($this->getLogicalId() == '') {
         $this->setLogicalId($this->getPlugin() . '::' . config::genKey());
     }
     $values = array('message' => $this->getMessage(), 'logicalId' => $this->getLogicalId(), 'plugin' => $this->getPlugin());
     $sql = 'SELECT count(*)
             FROM message
             WHERE plugin=:plugin
                   AND ( logicalId=:logicalId
                     OR message=:message ) ';
     $result = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
     if ($result['count(*)'] == 0) {
         DB::save($this);
         @nodejs::pushNotification(__('Message de ', __FILE__) . $this->getPlugin(), $this->getMessage(), 'message');
         $cmds = explode('&&', config::byKey('emailAdmin'));
         if (count($cmds) > 0) {
             foreach ($cmds as $id) {
                 $cmd = cmd::byId(str_replace('#', '', $id));
                 if (is_object($cmd)) {
                     $cmd->execCmd(array('title' => __('[JEEDOM] Message de ', __FILE__) . $this->getPlugin(), 'message' => $this->getMessage()));
                 } else {
                     log::add('message', 'info', __('Impossible de trouver la commande correspondant à :', __FILE__) . $id);
                 }
             }
         }
     }
     @nodejs::pushUpdate('message::refreshMessageNumber');
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:32,代码来源:message.class.php

示例8: Exception

         $jsonrpc->makeSuccess($scenario->save());
     }
     if ($params['state'] == 'disable') {
         $scenario->setIsActive(0);
         $jsonrpc->makeSuccess($scenario->save());
     }
     throw new Exception('La paramètre "state" ne peut être vide et doit avoir pour valeur [run,stop,enable;disable]');
 }
 /*             * ************************JeeNetwork*************************** */
 if ($jsonrpc->getMethod() == 'jeeNetwork::handshake') {
     if (config::byKey('jeeNetwork::mode') != 'slave') {
         throw new Exception('Impossible d\'ajouter une box jeedom non esclave à un réseau Jeedom');
     }
     $auiKey = config::byKey('auiKey');
     if ($auiKey == '') {
         $auiKey = config::genKey(255);
         config::save('auiKey', $auiKey);
     }
     $return = array('mode' => config::byKey('jeeNetwork::mode'), 'nbUpdate' => update::nbNeedUpdate(), 'version' => jeedom::version(), 'nbMessage' => message::nbMessage(), 'auiKey' => $auiKey, 'jeedom::url' => config::byKey('jeedom::url'), 'ngrok::port' => config::byKey('ngrok::port'));
     if (!filter_var(network::getNetworkAccess('external', 'ip'), FILTER_VALIDATE_IP) && network::getNetworkAccess('external', 'ip') != '') {
         $return['jeedom::url'] = network::getNetworkAccess('internal');
     }
     foreach (plugin::listPlugin(true) as $plugin) {
         if ($plugin->getAllowRemote() == 1) {
             $return['plugin'][] = $plugin->getId();
         }
     }
     $address = isset($params['address']) && $params['address'] != '' ? $params['address'] : getClientIp();
     config::save('jeeNetwork::master::ip', $address);
     config::save('jeeNetwork::master::apikey', $params['apikey_master']);
     config::save('jeeNetwork::slave::id', $params['slave_id']);
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:jeeApi.php

示例9: exit

 if (init('mode') != 'force') {
     echo "Jeedom va être installé. Voulez-vous continuer ? [o/N] ";
     if (trim(fgets(STDIN)) !== 'o') {
         echo "L'installation de Jeedom est annulée\n";
         echo "[END UPDATE SUCCESS]\n";
         exit(0);
     }
 }
 echo "\nInstallation de Jeedom " . jeedom::version() . "\n";
 $sql = file_get_contents(dirname(__FILE__) . '/install.sql');
 echo "Installation de la base de données...";
 DB::Prepare($sql, array(), DB::FETCH_TYPE_ROW);
 echo "OK\n";
 echo "Post installe...\n";
 nodejs::updateKey();
 config::save('api', config::genKey());
 require_once dirname(__FILE__) . '/consistency.php';
 echo "Ajout de l\\'utilisateur (admin,admin)\n";
 $user = new user();
 $user->setLogin('admin');
 $user->setPassword(sha1('admin'));
 $user->setRights('admin', 1);
 $user->save();
 $logLevel = array('info' => 0, 'debug' => 0, 'event' => 0, 'error' => 1);
 if (init('mode') != 'force') {
     echo "Jeedom est-il installé sur un Rasberry PI ? [o/N] ";
     if (trim(fgets(STDIN)) === 'o') {
         config::save('cronSleepTime', 60);
     }
 } else {
     config::save('cronSleepTime', 60);
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:install.php

示例10: updateKey

 public static function updateKey()
 {
     config::save('nodeJsKey', config::genKey());
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:4,代码来源:nodejs.class.php

示例11: catch

                die;
            }
            $cron->setState('stop');
            $cron->setPID();
            $cron->setServer('');
            $cron->setDuration(convertDuration(strtotime('now') - $datetimeStart));
            $cron->save();
        }
        die;
    } catch (Exception $e) {
        $cron->setState('error');
        $cron->setPID('');
        $cron->setServer('');
        $cron->setDuration(-1);
        $cron->save();
        $logicalId = config::genKey();
        if ($e->getCode() != 0) {
            $logicalId = $cron->getName() . '::' . $e->getCode();
        }
        echo '[Erreur] ' . $cron->getName() . ' : ' . print_r($e, true);
        log::add('cron', 'error', __('Erreur sur ', __FILE__) . $cron->getName() . ' : ' . print_r($e, true), $logicalId);
    }
} else {
    if (cron::jeeCronRun()) {
        die;
    }
    $sleepTime = config::byKey('cronSleepTime');
    $started = jeedom::isStarted();
    set_time_limit(59);
    cron::setPidFile();
    while (true) {
开发者ID:jimibi,项目名称:core,代码行数:31,代码来源:jeeCron.php

示例12: login

function login($_login, $_password, $_ajax = false, $_passAlreadyEncode = false)
{
    $user = user::connect($_login, $_password, $_passAlreadyEncode);
    if (is_object($user) && $user->getEnable() == 1) {
        connection::success($user->getLogin());
        @session_start();
        $_SESSION['user'] = $user;
        if (init('v') == 'd' && init('registerDevice') == 'on') {
            if ($_SESSION['user']->getOptions('registerDevice') == '') {
                $_SESSION['user']->setOptions('registerDevice', config::genKey(255));
                $_SESSION['user']->save();
            }
            setcookie('registerDevice', $_SESSION['user']->getOptions('registerDevice'), time() + 365 * 24 * 3600, "/", '', false, true);
        }
        @session_write_close();
        log::add('connection', 'info', __('Connexion de l\'utilisateur : ', __FILE__) . $_login);
        $getParams = '';
        unset($_GET['auth']);
        foreach ($_GET as $var => $value) {
            $getParams .= $var . '=' . $value . '&';
        }
        if (!$_ajax) {
            if (strpos($_SERVER['PHP_SELF'], 'core') || strpos($_SERVER['PHP_SELF'], 'desktop')) {
                header('Location:../../index.php?' . trim($getParams, '&'));
            } else {
                header('Location:index.php?' . trim($getParams, '&'));
            }
        }
        return true;
    }
    connection::failed();
    sleep(5);
    if (!$_ajax) {
        if (strpos($_SERVER['PHP_SELF'], 'core') || strpos($_SERVER['PHP_SELF'], 'desktop')) {
            header('Location:../../index.php?v=d&error=1');
        } else {
            header('Location:index.php?v=' . $_GET['v'] . '&error=1');
        }
    }
    return false;
}
开发者ID:GaelGRIFFON,项目名称:core,代码行数:41,代码来源:authentification.php

示例13: changeMode

 public static function changeMode($_mode)
 {
     switch ($_mode) {
         case 'master':
             if (config::byKey('jeeNetwork::mode') != 'master') {
                 $cron = new cron();
                 $cron->setClass('history');
                 $cron->setFunction('historize');
                 $cron->setSchedule('*/5 * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('scenario');
                 $cron->setFunction('check');
                 $cron->setSchedule('* * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('cmd');
                 $cron->setFunction('collect');
                 $cron->setSchedule('*/5 * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('history');
                 $cron->setFunction('archive');
                 $cron->setSchedule('00 * * * * *');
                 $cron->setTimeout(20);
                 $cron->save();
                 config::save('jeeNetwork::mode', 'master');
             }
             break;
         case 'slave':
             if (config::byKey('jeeNetwork::mode') != 'slave') {
                 foreach (eqLogic::all() as $eqLogic) {
                     $eqLogic->remove();
                 }
                 foreach (object::all() as $object) {
                     $object->remove();
                 }
                 foreach (update::all() as $update) {
                     switch ($update->getType()) {
                         case 'core':
                             break;
                         case 'plugin':
                             try {
                                 $plugin = plugin::byId($update->getLogicalId());
                                 if (is_object($plugin) && $plugin->getAllowRemote() != 1) {
                                     $update->deleteObjet();
                                 }
                             } catch (Exception $e) {
                             }
                             break;
                         default:
                             $update->deleteObjet();
                             break;
                     }
                 }
                 foreach (view::all() as $view) {
                     $view->remove();
                 }
                 foreach (plan::all() as $plan) {
                     $plan->remove();
                 }
                 foreach (scenario::all() as $scenario) {
                     $scenario->remove();
                 }
                 foreach (listener::all() as $listener) {
                     $listener->remove();
                 }
                 $cron = cron::byClassAndFunction('history', 'historize');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('scenario', 'check');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('cmd', 'collect');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('history', 'archive');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $user = new user();
                 $user->setLogin('jeedom_master');
                 $user->setPassword(config::genKey(255));
                 $user->setRights('admin', 1);
                 $user->save();
                 config::save('jeeNetwork::mode', 'slave');
             }
             break;
     }
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:96,代码来源:jeeNetwork.class.php


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