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


PHP Util::uuid方法代码示例

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


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

示例1: process

 public static function process()
 {
     $security = new Security();
     $security->verifyPre();
     $data = stream_get_contents(fopen('php://input', 'r'));
     $compressedSize = strlen($data);
     $security->verifyCompressedData($data, $compressedSize);
     $data = @gzdecode($data);
     $uncompressedSize = strlen($data);
     $security->validateData($data, $uncompressedSize);
     $json = json_decode($data, true);
     $security->validateJson($json);
     if (isset($json['icon'])) {
         $img = self::getServerIcon($json['icon']);
         $json['icon'] = $img;
         $data = json_encode($json);
         $uncompressedSize = strlen($data);
     }
     $key = Util::uuid(false);
     $cacheFile = Cache::getFile($key);
     Log::info("Uploaded {$uncompressedSize} bytes as {$key} to {$cacheFile}");
     Cache::put($key, $data);
     header("Location: " . BASE_URL_VIEW . "/?id={$key}");
     self::error("Compressed Size: {$compressedSize}\nUncompressed Size: {$uncompressedSize}\nRaw Upload: " . BASE_URL_VIEW . "/?id={$key}&raw=1");
 }
开发者ID:ArcheonK,项目名称:timings,代码行数:25,代码来源:Uploader.php

示例2: preSave

 public function preSave(PropelPDO $oConnection = null)
 {
     if ($this->isNew()) {
         $this->setActivationHash(Util::uuid());
     }
     return parent::preSave($oConnection);
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:7,代码来源:JournalComment.php

示例3: allDashboardModules

 public function allDashboardModules()
 {
     $aDashboardConfig = self::dashboardConfig();
     $aWidgets =& $aDashboardConfig['widgets'];
     $bDidAddIds = false;
     foreach ($aWidgets as &$aWidget) {
         if (!isset($aWidget['uid'])) {
             $bDidAddIds = true;
             $aWidget['uid'] = Util::uuid();
         }
     }
     if ($bDidAddIds) {
         $oUser = Session::getSession()->getUser();
         $oUser->setAdminSettings('dashboard', $aDashboardConfig);
         $oUser->save();
     }
     return $aWidgets;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:18,代码来源:DashboardControlWidgetModule.php

示例4: import_assets_from_csv


//.........这里部分代码省略.........
                $external = empty($param[9]) ? 0 : intval($param[9]);
                $csv_devices = $param[10];
            } else {
                $os = $param[6];
                $latitude = floatval($param[7]);
                $longitude = floatval($param[8]);
                $external = 0;
                $csv_devices = '';
            }
        } else {
            $descr = $param[2];
            $os = $param[3];
            $latitude = 0;
            $longitude = 0;
            $asset_value = 2;
            $external = 0;
            $csv_devices = $param[4];
        }
        //Permissions
        $can_i_create_assets = Session::can_i_create_assets();
        $can_i_modify_ips = TRUE;
        //IPs
        if (!ossim_valid($csv_ips, OSS_IP_ADDR, 'illegal:' . _('IP'))) {
            $summary['by_hosts'][$num_line]['errors']['IP'] = ossim_get_error_clean();
            $summary['general']['statistics']['errors']++;
            continue;
        }
        //Check Host ID: Is there a host registered in the System?
        $host_ids = Asset_host::get_id_by_ips($conn, $csv_ips, $ctx);
        $host_id = key($host_ids);
        if (!empty($host_id)) {
            $is_in_db = TRUE;
        } else {
            $host_id = Util::uuid();
        }
        // Special case: Forced Host ID [Version 4.x.x or higher]
        if ($import_type == 'hosts' && preg_match('/Host ID/', $csv_headers[8]) && valid_hex32($param[8])) {
            $csv_hosts_id = strtoupper($param[8]);
            if ($is_in_db == TRUE && $csv_hosts_id != $host_id) {
                $id_error_msg = _('Host is already registered in the System with another Host ID');
                $summary['by_hosts'][$num_line]['errors']['Host'] = $id_error_msg;
                $summary['general']['statistics']['errors']++;
                continue;
            } else {
                if ($is_in_db == FALSE) {
                    $host_id = $csv_hosts_id;
                    // Save host ID to insert it
                }
            }
        }
        //Hostname
        if (!empty($iic)) {
            $name = clean_iic($name);
        }
        if (!ossim_valid($name, OSS_HOST_NAME, 'illegal:' . _('Hostname'))) {
            ossim_clean_error();
            $name = Asset_host::create_valid_name($name);
            $warning_msg = _('Hostname does not match with RFC 1123 specifications') . '<br/>' . _('Hostname will be replaced by') . ": <strong>{$name}</strong>";
            $summary['by_hosts'][$num_line]['warnings']['Hostname'] = $warning_msg;
            $summary['by_hosts'][$num_line]['status'] = 'warning';
            $summary['general']['statistics']['warnings']++;
            if (!ossim_valid($name, OSS_HOST_NAME, 'illegal:' . _('Hostname'))) {
                unset($summary['by_hosts'][$num_line]['warnings']);
                $summary['general']['statistics']['warnings']--;
                $summary['by_hosts'][$num_line]['status'] = 'error';
                $summary['by_hosts'][$num_line]['errors']['Hostname'] = ossim_get_error_clean();
开发者ID:jackpf,项目名称:ossim-arc,代码行数:67,代码来源:import_all_hosts.php

示例5: startDigest

 public static function startDigest()
 {
     header('HTTP/1.1 401 Unauthorized');
     header('WWW-Authenticate: Digest realm="' . self::getRealm() . '",qop="auth",nonce="' . Util::uuid() . '",opaque="' . self::getRealm() . '"');
 }
开发者ID:rapila,项目名称:cms-base,代码行数:5,代码来源:Session.php

示例6: GET

            $_SESSION["pid" . GET('pid')] = $_GET['sids_str'];
        }
    }
    exit;
}
$db = new ossim_db();
$conn = $db->connect();
//
// Insert new
//
if (GET('action') == 'new') {
    $imported_plugins = get_checked_plugins($_POST);
    list($name, $descr, $plugins) = validate_post_params($conn, POST('name'), POST('descr'), POST('sids'), $imported_plugins);
    // Insert section
    //
    $group_id = Util::uuid();
    Plugin_group::insert($conn, $group_id, $name, $descr, $plugins, $imported_plugins);
    header("Location: modifyplugingroupsform.php?action=edit&id={$group_id}");
    exit;
    //
    // Edit group
    //
} elseif (GET('action') == 'edit') {
    //print_r(POST('sids'));
    //print_r($_SESSION);
    $imported_plugins = get_checked_plugins($_POST);
    list($name, $descr, $plugins) = validate_post_params($conn, POST('name'), POST('descr'), POST('sids'), $imported_plugins);
    $group_id = GET('id');
    ossim_valid($group_id, OSS_HEX, 'illegal:ID');
    if (ossim_error()) {
        die(ossim_error());
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:modifyplugingroups.php

示例7: bin2hex

     $result = Av_sensor::get_ip_by_id($dbconn, $asset);
     break;
 case 'get_system_uuid':
     $result = Util::get_encryption_key();
     break;
 case 'get_varhex':
     $result = bin2hex(inet_pton($asset));
     break;
 case 'insert_host':
     list($hostip, $ctx, $hostname, $aliases) = explode('|', base64_decode($asset));
     $hostid = key(Asset_host::get_id_by_ips($dbconn, $hostip, $ctx));
     if (!Asset_host::is_in_db($dbconn, $hostid)) {
         list($sensor_list, $total) = Av_sensor::get_list($dbconn, array('where' => "acl_sensors.entity_id=UNHEX('{$ctx}')"));
         $sensors = array_keys($sensor_list);
         try {
             $hostid = Util::uuid();
             Util::disable_perm_triggers($dbconn, TRUE);
             $host = new Asset_host($dbconn, $hostid);
             $host->set_name($hostname);
             $host->set_ctx($ctx);
             $host_ip = array();
             $ips[$hostip] = array('ip' => $hostip, 'mac' => NULL);
             $host->set_ips($ips);
             $host->set_sensors($sensors);
             $host->set_fqdns($aliases);
             $host->save_in_db($dbconn);
         } catch (Exception $e) {
             $result = 'Impossible to save the host';
         }
     } else {
         $result = 'The host already exists.';
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:util.php

示例8: ossim_error

    echo ossim_error(_("You don't have permissions to upload maps"));
    exit;
}
$name = POST('name');
$flag_close = FALSE;
$validation_errors = array();
if (isset($_POST['upload'])) {
    $validate = array('name' => array('validation' => 'OSS_INPUT', 'e_message' => 'illegal:' . _('Map Name')));
    $validation_errors = validate_form_fields('POST', $validate);
    if (!is_array($validation_errors) || empty($validation_errors)) {
        $db = new ossim_db();
        $conn = $db->connect();
        $config = new User_config($conn);
        $user = Session::get_session_user();
        if (is_uploaded_file($_FILES['map_file']['tmp_name'])) {
            $map_id = strtoupper(Util::uuid());
            $filename = "maps/map{$map_id}.jpg";
            if (getimagesize($_FILES['map_file']['tmp_name'])) {
                move_uploaded_file($_FILES['map_file']['tmp_name'], $filename);
                if (!Session::am_i_admin()) {
                    //If I am not an admin, I will add, as default, permission to see and edit the map to the current user.
                    $query = "INSERT IGNORE INTO risk_maps (map, perm, name) VALUES (UNHEX(?),?,?)";
                    $params = array($map_id, $user, $name);
                    $conn->Execute($query, $params);
                } else {
                    //If I am an admin user, I will add permission to see the map to everyone and only edit permission to the admin.
                    $query = "INSERT IGNORE INTO risk_maps (map, perm, name) VALUES (UNHEX(?),'0', ?)";
                    $params = array($map_id, $name);
                    $conn->Execute($query, $params);
                }
                $_SESSION['map_new']['error'] = FALSE;
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:upload_map.php

示例9: __construct

 public function __construct($sSessionKey = null)
 {
     if (static::isPersistent()) {
         if ($sSessionKey === null) {
             $this->sPersistentSessionKey = get_class($this);
             if (!call_user_func(array($this->sPersistentSessionKey, 'isSingleton'))) {
                 $this->sPersistentSessionKey .= "_" . Util::uuid();
             }
         } else {
             $this->sPersistentSessionKey = $sSessionKey;
         }
         Session::getSession()->setArrayAttributeValueForKey(self::WIDGET_SESSION_KEY, $this->sPersistentSessionKey, $this);
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:14,代码来源:WidgetModule.php

示例10: insert_host

function insert_host($conn, $data)
{
    $ips = preg_replace('/\\s*/', '', $data['ip']);
    $name = utf8_decode($data['name']);
    list($os, $dtype) = explode("_", $data['type']);
    // Type
    ossim_valid($ips, OSS_IP_ADDR, 'illegal:' . _("IP"));
    ossim_valid($name, OSS_HOST_NAME, 'illegal:' . _("Name"));
    ossim_valid($os, OSS_NULLABLE, OSS_ALPHA, 'illegal:' . _("OS"));
    ossim_valid($dtype, OSS_NULLABLE, OSS_ALPHA, 'illegal:' . _("Device Type"));
    check_ossim_error();
    $ips = explode(',', $ips);
    foreach ($ips as $ip) {
        $h_ip[$ip] = array('ip' => $ip, 'mac' => NULL);
    }
    //Insert the New Host
    $uuid = Util::uuid();
    $sensor_ip = Util::get_default_admin_ip();
    $sensor = Av_sensor::get_id_by_ip($conn, $sensor_ip);
    $host = new Asset_host($conn, $uuid);
    $host->set_ips($h_ip);
    $host->set_name($name);
    $host->set_sensors(array($sensor));
    $host->save_in_db($conn);
    // Device Type
    if ($dtype == 'networkdevice') {
        Asset_host_devices::save_device_in_db($conn, $uuid, 4);
    }
    // OS
    if ($os == 'windows' || $os == 'linux') {
        Asset_host_properties::save_property_in_db($conn, $uuid, 3, ucfirst($os), 1, TRUE);
    }
    $response['error'] = FALSE;
    $response['data'] = array();
    return $response;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:36,代码来源:wizard_actions_ajax.php

示例11: save_filter

function save_filter($conn, $filters, $data)
{
    //Getting the number of filters to be applied of the group
    $cont = $filters->get_num_filter_added();
    //We need at least one, otherwise we show an error.
    if ($cont < 1) {
        $return['error'] = TRUE;
        $return['msg'] = _('At least one filter needed');
        return $return;
    }
    $name = utf8_decode($data['name']);
    $descr = utf8_decode($data['descr']);
    ossim_valid($name, OSS_NOECHARS, OSS_ALPHA, OSS_PUNC, 'illegal:' . _('Group Name'));
    ossim_valid($descr, OSS_ALPHA, OSS_NULLABLE, OSS_PUNC, OSS_AT, OSS_NL, 'illegal:' . _('Description'));
    if (ossim_error()) {
        $response['error'] = TRUE;
        $response['msg'] = ossim_get_error();
        ossim_clean_error();
        return $response;
    }
    //Trying to save the filters, in case of error an exception will arise
    try {
        $new_id = Util::uuid();
        $ctx = Session::get_default_ctx();
        $group = new Asset_group($new_id);
        $group->set_name($name);
        $group->set_descr($descr);
        $group->set_ctx($ctx);
        $group->save_in_db($conn);
        $group->save_assets_from_search($conn);
        $filters->empty_filter_search($conn);
        $return['error'] = FALSE;
        $return['id'] = $new_id;
        $return['msg'] = 'ok';
        Asset_filter_list::delete_filters_from_session();
    } catch (Exception $e) {
        $return['error'] = TRUE;
        $return['msg'] = $e->getMessage();
    }
    return $return;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:41,代码来源:asset_filter_ajax.php

示例12: unset

         unset($_ctx);
     }
 }
 if (!empty($id) && Asset_host::is_in_db($conn, $id)) {
     ossim_valid($id, OSS_HEX, 'illegal:' . _('Asset ID'));
     if (ossim_error()) {
         echo ossim_error(_('Error! Asset not found'));
         exit;
     }
     $asset = new Asset_host($conn, $id);
     $asset->load_from_db($conn);
     $is_in_db = 1;
     $is_editable = Asset_host::can_i_modify_ips($conn, $id) ? 'yes' : 'no_ip';
 } else {
     //New asset or asset has been deleted but there are some instances in the system (SIEM, alarms, ...)
     $id = valid_hex32($id) ? $id : Util::uuid();
     $asset = new Asset_host($conn, $id);
     if (isset($_ip) && isset($_ctx)) {
         $asset->set_ctx($_ctx);
         $ext_ips[$_ip] = array('ip' => $_ip, 'mac' => NULL);
         $asset->set_ips($ext_ips);
     }
 }
 //Getting asset data
 $id = $asset->get_id();
 $ctx = $asset->get_ctx();
 $_ips = $asset->get_ips();
 $ips = $_ips->get_ips();
 if (is_array($ips) && !empty($ips)) {
     $ips = array_keys($ips);
 }
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:asset_form.php

示例13: _

         $data['general']['status'] = 'success';
         $data['general']['data'] = _('Hosts saved successfully');
         foreach ($data['by_host'] as $h_key => $h_data) {
             if ($h_data['status'] == 'warning') {
                 $data['general']['status'] = 'warning';
                 $data['general']['data'] = _('Hosts saved with warnings');
                 break;
             }
         }
     } else {
         $data['general']['status'] = 'warning';
         $data['general']['data'] = _('Warning! Some hosts could not be saved');
     }
     //Create a Asset Group
     if (!empty($group_name)) {
         $new_group_id = Util::uuid();
         $group = new Asset_group($new_group_id);
         $group->set_name($group_name);
         $group->set_ctx($ctx);
         $group->save_in_db($conn);
         $group->save_assets_from_list($conn, $data['general']['hosts_in_group']);
     }
 }
 /*
 echo '<pre style="white-space: pre;">';
     print_r($data);
     print_r($scan_results);   
 echo '</pre>';         
 */
 //Showing scan results
 ?>
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:save_scan.php

示例14: cleanupFormatTags

 private function cleanupFormatTags()
 {
     $aTags = array();
     if (isset($this->aModuleSettings['blockformats'])) {
         foreach ($this->aModuleSettings['blockformats'] as $mFormat) {
             if (is_string($mFormat)) {
                 $mFormat = array('element' => $mFormat);
             }
             $sKey = 'format_' . Util::uuid();
             $this->setSetting($sKey, $mFormat);
             $aTags[] = $mFormat['element'];
         }
         unset($this->aModuleSettings['blockformats']);
     }
     if (count($aTags) == 0) {
         $this->setSetting('format_tags', 'p;h1;h2;h3;h4;h5;h6;pre;address;div');
     } else {
         $this->setSetting('format_tags', implode(';', $aTags));
     }
 }
开发者ID:rapila,项目名称:cms-base,代码行数:20,代码来源:RichTextWidgetModule.php

示例15: while

                parent.show_error("<?php 
            echo $conn_snort->ErrorMsg();
            ?>
");								
            </script>
            <?php 
            exit;
        }
        while (!$rs->EOF) {
            $ip = $rs->fields['ip'];
            $ctx = $rs->fields['ctx'];
            $ids = Asset_host::get_id_by_ips($conn_aux, $ip, $ctx);
            if (empty($hosts_in_db[$ip][$ctx]) && empty($ids)) {
                if ($mode == 'insert') {
                    try {
                        $id = Util::uuid();
                        $hostname = Asset_host::get_autodetected_name($ip);
                        $ips = array();
                        $ips[$ip] = array('ip' => $ip, 'mac' => NULL);
                        $sensors = array($rs->fields['sensor_id']);
                        $conn_aux = $db->connect();
                        $host = new Asset_host($conn_aux, $id);
                        Util::disable_perm_triggers($conn_aux, TRUE);
                        $host->set_name($hostname);
                        $host->set_ctx($ctx);
                        $host->set_ips($ips);
                        $host->set_sensors($sensors);
                        $host->save_in_db($conn_aux, FALSE);
                        $hosts_in_db[$ip][$ctx] = $ip;
                        ?>
                        <script type="text/javascript">                                          
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:import_all_hosts_from_siem_ajax.php


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