生成connection id
@return int
197668
protected function generateConnectionId()
    {
        $max_unsigned_int = 4294967295;
        if (self::$_connectionIdRecorder >= $max_unsigned_int) {
            self::$_connectionIdRecorder = 0;
        }
        while(++self::$_connectionIdRecorder <= $max_unsigned_int) {
            if(!isset($this->_clientConnections[self::$_connectionIdRecorder])) {
                break;
            }
        }
        return self::$_connectionIdRecorder;
    }
465661
static function installationID()
    {
        if ( !empty( self::$InstallationID ) )
        {
            return self::$InstallationID;
        }
        $db = eZDB::instance();

        $resultSet = $db->arrayQuery( 'SELECT value FROM ezsite_data WHERE name=\'ezfind_site_id\'' );

        if ( count( $resultSet ) >= 1 )
        {
            self::$InstallationID = $resultSet[0]['value'];
        }
        else
        {
            self::$InstallationID = md5( time() . '-' . mt_rand() );
            $db->query( 'INSERT INTO ezsite_data ( name, value ) values( \'ezfind_site_id\', \'' . self::$InstallationID . '\' )' );
        }

        return self::$InstallationID;
    }
1051335
protected function createId()
	{
		$id = 0;

		while (strlen($id) < 32)
		{
			$id .= mt_rand(0, mt_getrandmax());
		}

		return md5(uniqid($id, true));
	}
272465
public function generateId()
    {
        $data = openssl_random_pseudo_bytes(16);
        $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
        $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10

        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
    }
101515
private function getConnectionString() {
        $parameters = array(
            'host='             . $this->getHost(),
            'connect_timeout='  . $this->getConnectTimeout(),
            'user='             . $this->getUserName(),
        );
        $this->hasPort()        && $parameters[] = 'port='      . $this->getPort();
        $this->hasPassword()    && $parameters[] = 'password='  . $this->getPassword();
        $this->hasDatabase()    && $parameters[] = 'dbname='    . $this->getDatabase();

        return implode(' ', $parameters);
    }
1174852
public function generate()
    {
        if (!isset($_SERVER['REQUEST_URI'])) {
            throw new RuntimeException("Can't auto-detect current page identity");
        }

        $port = ($_SERVER['SERVER_PORT'] == '80') ? '' : (':'.$_SERVER['SERVER_PORT']);
        $scheme = stripos($_SERVER['SERVER_PROTOCOL'], 'https') === 0 ? 'https' : 'http';

        return md5($scheme . '://'.$_SERVER['HTTP_HOST']. $port . $_SERVER['REQUEST_URI']);
    }
337024
public static function uuid()
    {
        $node = getenv('SERVER_ADDR');
        if (strpos($node, ':') !== false) {
            if (substr_count($node, '::')) {
                $node = str_replace(
                    '::',
                    str_repeat(':0000', 8 - substr_count($node, ':')) . ':',
                    $node
                );
            }
            $node = explode(':', $node);
            $ipSix = '';
            foreach ($node as $id) {
                $ipSix .= str_pad(base_convert($id, 16, 2), 16, 0, STR_PAD_LEFT);
            }
            $node = base_convert($ipSix, 2, 10);
            if (strlen($node) < 38) {
                $node = null;
            } else {
                $node = crc32($node);
            }
        } elseif (empty($node)) {
            $host = getenv('HOSTNAME');
            if (empty($host)) {
                $host = getenv('HOST');
            }
            if (!empty($host)) {
                $ip = gethostbyname($host);
                if ($ip === $host) {
                    $node = crc32($host);
                } else {
                    $node = ip2long($ip);
                }
            }
        } elseif ($node !== '127.0.0.1') {
            $node = ip2long($node);
        } else {
            $node = null;
        }
        if (empty($node)) {
            $node = crc32(Strata::app()->getConfig('security.salt'));
        }
        if (function_exists('hphp_get_thread_id')) {
            $pid = hphp_get_thread_id();
        } elseif (function_exists('zend_thread_id')) {
            $pid = zend_thread_id();
        } else {
            $pid = getmypid();
        }
        if (!$pid || $pid > 65535) {
            $pid = mt_rand(0, 0xfff) | 0x4000;
        }
        list($timeMid, $timeLow) = explode(' ', microtime());
        return sprintf(
            "%08x-%04x-%04x-%02x%02x-%04x%08x",
            (int)$timeLow,
            (int)substr($timeMid, 2) & 0xffff,
            mt_rand(0, 0xfff) | 0x4000,
            mt_rand(0, 0x3f) | 0x80,
            mt_rand(0, 0xff),
            $pid,
            $node
        );
    }
28532
protected function _new_session_id()
	{
		$session_id = '';
		while (strlen($session_id) < 32)
		{
			$session_id .= mt_rand(0, mt_getrandmax());
		}
		return md5(uniqid($session_id, TRUE));
	}
51299
private function connectionString()
    {
        return [
            sprintf(
                '%s:dbname=%s;host=%s',
                $this->params['DBENGINE'],
                $this->params['DBNAME'],
                $this->params['DBHOST']
            ),
            $this->params['DBUSER'],
            $this->params['DBPASSWORD']
        ];
    }
713443
public function generateNewUuid(): string
    {
        $uuid = (string) Uuid::generate(4);

        return $this->uuidPrefix . str_replace('-', '', $uuid);
    }
401141
public function connect()
    {
        $this->connect = ldap_connect($this->hostname, $this->port);

        if (!$this->connect) {
            throw new ConnectionException($this);
        }

        // Set Ldap Version to 3
        ldap_set_option($this->connect, LDAP_OPT_PROTOCOL_VERSION, 3);

        if (!is_null($this->username) && !is_null($this->password)) {
            if (!@ldap_bind($this->connect, $this->username, $this->password)) {
                throw new BadIdentificationException($this);
            }
        }

        return new Client($this->connect);
    }
274055
protected function _getIdColumnName()
        {
            if (!is_null($this->_instance_id_column)) {
                return $this->_instance_id_column;
            }

            if (isset(self::$_config[$this->_connection_name]['id_column_overrides'][$this->_table_name])) {
                return self::$_config[$this->_connection_name]['id_column_overrides'][$this->_table_name];
            }

            return self::$_config[$this->_connection_name]['id_column'];
        }
475467
public static function generateSession()
    {
        $sessionID = TextHelper::random(20, 'qwertyuiopasdfghjklzxcvbnm1234567890');
        Base::getLog()->debug(__METHOD__ . ' generate session id', [
            'id' => $sessionID,
        ]);
        return $sessionID;
    }
90060
public function getConnectionString()
    {

        $dsn = 'mysql:';

        // get the connection settings local so there is less function call overhead
        $connectionSettings = $this->getConnectionSettings();
        if ($this->isSocket()) {
            $dsn .= (string)'unix_socket=' . $connectionSettings->getHost() . ';';
        } else {
            $dsn .= (string)'host=' . $connectionSettings->getHost() . ';';
            if ($connectionSettings->getPort()) {
                $dsn .= 'port=' . $connectionSettings->getPort() . ';';
            }
        }

        if ($connectionSettings->getDatabase()) {
            $dsn .= "dbname=" . $connectionSettings->getDatabase() . ';';
        }

        if ($connectionSettings->getCharset()) {
            $dsn .= "charset=" . $connectionSettings->getCharset() . ';';
        }

        return $dsn;
    }
183243
public static function GetConnectionName () {
		$class_name = static::class;
		if (!isset(static::$_connectionNameList[$class_name])) {
			if (defined($class_name.'::CONNECTION_NAME')) {
				$connection_name = $class_name::CONNECTION_NAME;
			} else {
				$connection_name = basename(dirname(str_replace("\\", '/', $class_name)));
			}
			static::$_connectionNameList[$class_name] = $connection_name;
		}
		return static::$_connectionNameList[$class_name];
	}
258972
public function generatePadID(): string
    {
        $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        $length = 16;
        $padID = "";

        for ($i = 0; $i < $length; $i++) {
            $padID .= $chars[rand() % strlen($chars)];
        }

        return $padID;
    }
1248344
public function generate_guid()
	{
	    return sprintf(
			'%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(16384, 20479),
			mt_rand(32768, 49151),
			mt_rand(0, 65535),
			mt_rand(0, 65535),
			mt_rand(0, 65535)
		);
	}