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


PHP showWarning函数代码示例

本文整理汇总了PHP中showWarning函数的典型用法代码示例。如果您正苦于以下问题:PHP showWarning函数的具体用法?PHP showWarning怎么用?PHP showWarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: renderVLANMembership

function renderVLANMembership($object_id)
{
    try {
        $data = getSwitchVLANs($object_id);
    } catch (RTGatewayError $re) {
        showWarning('Device configuration unavailable:<br>' . $re->getMessage());
        return;
    }
    list($vlanlist, $portlist, $maclist) = $data;
    $vlanpermissions = array();
    foreach ($portlist as $port) {
        if (array_key_exists($port['vlanid'], $vlanpermissions)) {
            continue;
        }
        $vlanpermissions[$port['vlanid']] = array();
        foreach (array_keys($vlanlist) as $to) {
            if (permitted(NULL, NULL, 'setPortVLAN', array(array('tag' => '$fromvlan_' . $port['vlanid']), array('tag' => '$vlan_' . $port['vlanid']))) and permitted(NULL, NULL, 'setPortVLAN', array(array('tag' => '$tovlan_' . $to), array('tag' => '$vlan_' . $to)))) {
                $vlanpermissions[$port['vlanid']][] = $to;
            }
        }
    }
    if (isset($_REQUEST['hl_port_id'])) {
        assertUIntArg('hl_port_id');
        $hl_port_id = intval($_REQUEST['hl_port_id']);
        $object = spotEntity('object', $object_id);
        amplifyCell($object);
        foreach ($object['ports'] as $port) {
            if (mb_strlen($port['name']) && $port['id'] == $hl_port_id) {
                $hl_port_name = $port['name'];
                break;
            }
        }
    }
    echo '<table border=0 width="100%"><tr><td colspan=3>';
    startPortlet('Current status');
    echo "<table class=widetable cellspacing=3 cellpadding=5 align=center width='100%'><tr>";
    printOpFormIntro('setPortVLAN');
    $portcount = count($portlist);
    echo "<input type=hidden name=portcount value=" . $portcount . ">\n";
    $portno = 0;
    $ports_per_row = 12;
    foreach ($portlist as $port) {
        // Don't let wide forms break our fancy pages.
        if ($portno % $ports_per_row == 0) {
            if ($portno > 0) {
                echo "</tr>\n";
            }
            echo "<tr><th>" . ($portno + 1) . "-" . ($portno + $ports_per_row > $portcount ? $portcount : $portno + $ports_per_row) . "</th>";
        }
        $td_class = 'port_';
        if ($port['status'] == 'notconnect') {
            $td_class .= 'notconnect';
        } elseif ($port['status'] == 'disabled') {
            $td_class .= 'disabled';
        } elseif ($port['status'] != 'connected') {
            $td_class .= 'unknown';
        } elseif (!isset($maclist[$port['portname']])) {
            $td_class .= 'connected_none';
        } else {
            $maccount = 0;
            foreach ($maclist[$port['portname']] as $vlanid => $addrs) {
                $maccount += count($addrs);
            }
            if ($maccount == 1) {
                $td_class .= 'connected_single';
            } else {
                $td_class .= 'connected_multi';
            }
        }
        if (isset($hl_port_name) and strcasecmp($hl_port_name, $port['portname']) == 0) {
            $td_class .= (strlen($td_class) ? ' ' : '') . 'border_highlight';
        }
        echo "<td class='{$td_class}'>" . $port['portname'] . '<br>';
        echo "<input type=hidden name=portname_{$portno} value=" . $port['portname'] . '>';
        if ($port['vlanid'] == 'trunk') {
            echo "<input type=hidden name=vlanid_{$portno} value='trunk'>";
            echo "<select disabled multiple='multiple' size=1><option>TRUNK</option></select>";
        } elseif ($port['vlanid'] == 'routed') {
            echo "<input type=hidden name=vlanid_{$portno} value='routed'>";
            echo "<select disabled multiple='multiple' size=1><option>ROUTED</option></select>";
        } elseif (!array_key_exists($port['vlanid'], $vlanpermissions) or !count($vlanpermissions[$port['vlanid']])) {
            echo "<input type=hidden name=vlanid_{$portno} value={$port['vlanid']}>";
            echo "<select disabled name=vlanid_{$portno}>";
            echo "<option value={$port['vlanid']} selected>{$port['vlanid']}</option>";
            echo "</select>";
        } else {
            echo "<select name=vlanid_{$portno}>";
            // A port may belong to a VLAN, which is absent from the VLAN table, this is normal.
            // We must be able to render its SELECT properly at least.
            $in_table = FALSE;
            foreach ($vlanpermissions[$port['vlanid']] as $v) {
                echo "<option value={$v}";
                if ($v == $port['vlanid']) {
                    echo ' selected';
                    $in_table = TRUE;
                }
                echo ">{$v}</option>\n";
            }
            if (!$in_table) {
                echo "<option value={$port['vlanid']} selected>{$port['vlanid']}</option>\n";
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:livevlans.php

示例2: renderPortsInfo

function renderPortsInfo($object_id)
{
    try {
        if (permitted(NULL, NULL, 'get_link_status')) {
            $linkStatus = queryDevice($object_id, 'getportstatus');
        } else {
            showWarning("You don't have permission to view ports link status");
        }
        if (permitted(NULL, NULL, 'get_mac_list')) {
            $macList = sortPortList(queryDevice($object_id, 'getmaclist'));
        } else {
            showWarning("You don't have permission to view learned MAC list");
        }
    } catch (RTGatewayError $e) {
        showError($e->getMessage());
        return;
    }
    global $nextorder;
    echo "<table width='100%'><tr>";
    if (!empty($linkStatus)) {
        echo "<td valign='top' width='50%'>";
        startPortlet('Link status');
        echo "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>Port<th><th>Link status<th>Link info</tr>";
        $order = 'even';
        foreach ($linkStatus as $pn => $link) {
            switch ($link['status']) {
                case 'up':
                    $img_filename = 'link-up.png';
                    break;
                case 'down':
                    $img_filename = 'link-down.png';
                    break;
                case 'disabled':
                    $img_filename = 'link-disabled.png';
                    break;
                default:
                    $img_filename = '1x1t.gif';
            }
            echo "<tr class='row_{$order}'>";
            $order = $nextorder[$order];
            echo '<td>' . $pn;
            echo '<td>' . '<img width=16 height=16 src="?module=chrome&uri=pix/' . $img_filename . '">';
            echo '<td>' . $link['status'];
            $info = '';
            if (isset($link['speed'])) {
                $info .= $link['speed'];
            }
            if (isset($link['duplex'])) {
                if (!empty($info)) {
                    $info .= ', ';
                }
                $info .= $link['duplex'];
            }
            echo '<td>' . $info;
            echo '</tr>';
        }
        echo "</table></td>";
        finishPortlet();
    }
    if (!empty($macList)) {
        echo "<td valign='top' width='50%'>";
        $rendered_macs = '';
        $mac_count = 0;
        $rendered_macs .= "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>MAC<th>Vlan<th>Port</tr>";
        $order = 'even';
        foreach ($macList as $pn => $list) {
            $order = $nextorder[$order];
            foreach ($list as $item) {
                ++$mac_count;
                $rendered_macs .= "<tr class='row_{$order}'>";
                $rendered_macs .= '<td style="font-family: monospace">' . $item['mac'];
                $rendered_macs .= '<td>' . $item['vid'];
                $rendered_macs .= '<td>' . $pn;
                $rendered_macs .= '</tr>';
            }
        }
        $rendered_macs .= "</table></td>";
        startPortlet("Learned MACs ({$mac_count})");
        echo $rendered_macs;
        finishPortlet();
    }
    echo "</td></tr></table>";
}
开发者ID:xtha,项目名称:salt,代码行数:83,代码来源:interface.php

示例3: doGenericSNMPmining


//.........这里部分代码省略.........
        }
        // map entPhysicalIndex to ifIndex for MAC addresses association
        // first try to use entAliasMappingIdentifier (some devices don't support it)
        if ($entToIfMapping_raw = @$device->snmpwalkoid('mib-2.47.1.3.2.1.2')) {
            foreach ($entToIfMapping_raw as $key => $value) {
                // find the entID and map it to the ifID
                $e_array = explode('.', $key);
                $e_index = count($e_array) - 2;
                $eid = $e_array[$e_index];
                $iid = substr($value, strrpos($value, '.') + 1);
                $snmp_data['entToIfMapping'][$eid] = $iid;
            }
        } else {
            // entAliasMappingIdentifier isn't available, use entPhysicalName
            $ifName = array();
            foreach ($device->snmpwalkoid('ifName') as $raw_key => $raw_value) {
                $key = substr($raw_key, strlen('IF-MIB::ifName.'));
                $value = str_ireplace(array('STRING: ', '"'), '', $raw_value);
                $ifName[$key] = $value;
            }
            // query entPhysicalClass and note which entries which are ports
            foreach ($device->snmpwalkoid('mib-2.47.1.1.1.1.5') as $raw_key => $raw_value) {
                if (substr($raw_value, strlen('INTEGER: ')) == 10) {
                    $snmp_data['entPhysicalPorts'][] = substr($raw_key, strlen('SNMPv2-SMI::mib-2.47.1.1.1.1.5.'));
                }
            }
            // do the mapping, but only for ports
            foreach ($snmp_data['entPhysicalName'] as $key => $value) {
                if (in_array($key, $snmp_data['entPhysicalPorts'])) {
                    $snmp_data['entToIfMapping'][$key] = array_search($value, $ifName);
                }
            }
        }
        addModules(1, $objectInfo['id']);
    } else {
        // this is not a modular device
        $ifDescr_tablename = isset($known_devices[$sysObjectID]['ifDescrOID']) ? $known_devices[$sysObjectID]['ifDescrOID'] : 'ifDescr';
        foreach (array_keys($known_devices[$sysObjectID]['processors']) as $pkey) {
            if (!array_key_exists($known_devices[$sysObjectID]['processors'][$pkey], $iftable_processors)) {
                showWarning('processor "' . $known_devices[$sysObjectID]['processors'][$pkey] . '" not found');
                unset($known_devices[$sysObjectID]['processors'][$pkey]);
            }
        }
        $ifInfo = array();
        foreach ($device->snmpwalkoid($ifDescr_tablename) as $oid => $value) {
            $randomindex = preg_replace("/^.*{$ifDescr_tablename}\\.(.+)\$/", '\\1', $oid);
            $value = trim(preg_replace('/^[^:]+: (.+)$/', '\\1', $value), '"');
            $ifInfo[$randomindex]['ifDescr'] = $value;
        }
        foreach ($device->snmpwalkoid('ifPhysAddress') as $oid => $value) {
            $randomindex = preg_replace("/^.*ifPhysAddress\\.(.+)\$/", '\\1', $oid);
            $value = trim($value);
            // NET-SNMP may return MAC addresses in one of two (?) formats depending on
            // DISPLAY-HINT internal database. The best we can do about it is to accept both.
            // Bug originally reported by Walery Wysotsky against openSUSE 11.0.
            if (preg_match('/^string: [0-9a-f]{1,2}(:[0-9a-f]{1,2}){5}/i', $value)) {
                list($dummy, $value) = explode(' ', $value);
                $addrbytes = explode(':', $value);
                foreach ($addrbytes as $bidx => $bytestr) {
                    if (strlen($bytestr) == 1) {
                        $addrbytes[$bidx] = '0' . $bytestr;
                    }
                }
            } elseif (preg_match('/^hex-string:( [0-9a-f]{2}){6}/i', $value)) {
                // Hex-STRING: xx yy zz xx yy zz
                $addrbytes = explode(' ', substr($value, -17));
            } elseif (preg_match('/22[0-9a-f]{12}22$/', bin2hex($value))) {
                // STRING: "??????"
                $addrbytes = array(substr(bin2hex($value), -14, 12));
            } else {
                continue;
            }
            // martian format
            $ifInfo[$randomindex]['ifPhysAddress'] = implode('', $addrbytes);
        }
        // process each interface only once regardless of how many processors we have to run
        foreach ($ifInfo as $iface) {
            foreach ($known_devices[$sysObjectID]['processors'] as $processor_name) {
                $newname = preg_replace($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['replacement'], $iface['ifDescr'], 1, $count);
                if ($newname === NULL) {
                    showError('PCRE pattern error, terminating');
                    break 2;
                }
                if (!$count) {
                    continue;
                }
                // try next processor on current port
                $newlabel = preg_replace($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['label'], $iface['ifDescr'], 1, $count);
                checkPIC($iftable_processors[$processor_name]['dict_key']);
                commitAddPort($objectInfo['id'], $newname, $iftable_processors[$processor_name]['dict_key'], $newlabel, $iface['ifPhysAddress']);
                if (!$iftable_processors[$processor_name]['try_next_proc']) {
                    // done with this port
                    continue 2;
                }
            }
        }
    }
    // No failure up to this point, thus leave current tab for the "Ports" one.
    return buildRedirectURL(NULL, 'ports');
}
开发者ID:ivladdalvi,项目名称:racktables,代码行数:101,代码来源:snmp.php

示例4: apply8021qChangeRequest

function apply8021qChangeRequest($switch_id, $changes, $verbose = TRUE, $mutex_rev = NULL)
{
    global $dbxlink;
    $dbxlink->beginTransaction();
    try {
        if (NULL === ($vswitch = getVLANSwitchInfo($switch_id, 'FOR UPDATE'))) {
            throw new InvalidArgException('object_id', $switch_id, 'VLAN domain is not set for this object');
        }
        if (isset($mutex_rev) and $vswitch['mutex_rev'] != $mutex_rev) {
            throw new InvalidRequestArgException('mutex_rev', $mutex_rev, 'expired form data');
        }
        $after = $before = apply8021QOrder($vswitch['template_id'], getStored8021QConfig($vswitch['object_id'], 'desired'));
        $domain_vlanlist = getDomainVLANs($vswitch['domain_id']);
        $changes = filter8021QChangeRequests($domain_vlanlist, $before, apply8021QOrder($vswitch['template_id'], $changes));
        $desired_ports_count = count($changes);
        $changes = authorize8021QChangeRequests($before, $changes);
        if (count($changes) < $desired_ports_count) {
            showWarning(sprintf("Permission denied to change %d ports", $desired_ports_count - count($changes)));
        }
        foreach ($changes as $port_name => $port) {
            $after[$port_name] = $port;
        }
        $new_uplinks = filter8021QChangeRequests($domain_vlanlist, $after, produceUplinkPorts($domain_vlanlist, $after, $vswitch['object_id']));
        $npulled = replace8021QPorts('desired', $vswitch['object_id'], $before, $changes);
        $nsaved_uplinks = replace8021QPorts('desired', $vswitch['object_id'], $before, $new_uplinks);
        if ($npulled + $nsaved_uplinks) {
            touchVLANSwitch($vswitch['object_id']);
        }
        $dbxlink->commit();
    } catch (Exception $e) {
        $dbxlink->rollBack();
        showError(sprintf("Failed to update switchports: %s", $e->getMessage()));
        return 0;
    }
    $nsaved_downlinks = 0;
    if ($nsaved_uplinks) {
        $nsaved_downlinks = initiateUplinksReverb($vswitch['object_id'], $new_uplinks);
    }
    // instant deploy to that switch if configured
    $done = 0;
    if ($npulled + $nsaved_uplinks > 0 and getConfigVar('8021Q_INSTANT_DEPLOY') == 'yes') {
        try {
            if (FALSE === ($done = exec8021QDeploy($vswitch['object_id'], TRUE))) {
                showError("deploy was blocked due to conflicting configuration versions");
            } elseif ($verbose) {
                showSuccess(sprintf("Configuration for %u port(s) have been deployed", $done));
            }
        } catch (Exception $e) {
            showError(sprintf("Failed to deploy changes to switch: %s", $e->getMessage()));
        }
    }
    // report number of changed ports
    $total = $npulled + $nsaved_uplinks + $nsaved_downlinks;
    if ($verbose) {
        $message = sprintf('%u port(s) have been changed', $total);
        if ($total > 0) {
            showSuccess($message);
        } else {
            showNotice($message);
        }
    }
    return $total;
}
开发者ID:rhysm,项目名称:racktables,代码行数:63,代码来源:functions.php

示例5: validate


//.........这里部分代码省略.........
                                 }
                             }
                         }
                         $paramsToValidate = array("valor" => $valor, "model" => $this, "campo" => $campo, "vR" => $vR);
                         /**
                          * Com todas as regras, faz loop validando
                          */
                         if (!empty($allRules) and is_array($allRules)) {
                             foreach ($allRules as $rule) {
                                 /**
                                  * VALIDA DE FATO
                                  *
                                  * Verifica se funções de validação existem
                                  */
                                 /**
                                  * Função de validação pré-existente
                                  */
                                 if (is_string($rule["rule"]) and method_exists("Validation", $rule["rule"])) {
                                     $result = call_user_func("Validation::" . $rule["rule"], $valor);
                                 } elseif (is_string($rule["rule"]) and method_exists($this, $rule["rule"])) {
                                     $result = $this->{$rule["rule"]}($valor);
                                 } elseif (is_array($rule["rule"]) and method_exists("Validation", reset(array_keys($rule["rule"])))) {
                                     $result = call_user_func("Validation::" . reset(array_keys($rule["rule"])), $valor, reset(array_values($rule["rule"])));
                                 } elseif (is_array($rule["rule"]) and method_exists($this, reset(array_keys($rule["rule"])))) {
                                     $result = $this->{reset(array_keys($rule["rule"]))}($valor, reset(array_values($rule["rule"])));
                                 } else {
                                     if (is_array($rule["rule"])) {
                                         $inexistentRule = reset(array_keys($rule["rule"]));
                                     } elseif (is_string($rule["rule"])) {
                                         $inexistentRule = $rule["rule"];
                                     }
                                     showError("Regra de validação <em>" . $inexistentRule . "</em> do model <em>" . get_class($this) . "</em> inexistente");
                                 }
                                 /**
                                  * [Não validou]
                                  */
                                 if (!$result) {
                                     /*
                                      * Session para formHelper
                                      */
                                     /*
                                      * Pega mensagem
                                      */
                                     if (!empty($rule["message"])) {
                                         $message = $rule["message"];
                                     } else {
                                         if (!empty($rule["m"])) {
                                             $message = $rule["m"];
                                         } else {
                                             if (isDebugMode()) {
                                                 showWarning("Mensagem de validação do campo " . $campo . " não especificada");
                                             }
                                             $message = "Not validated!";
                                         }
                                     }
                                     /**
                                      * Caso seja um model-filho no
                                      * relacionamento de models
                                      */
                                     if ($sub) {
                                         $vE[$campo] = '1';
                                     } else {
                                         $vE[$model][$campo] = '1';
                                     }
                                     $_SESSION["Sys"]["FormHelper"]["notValidated"][$model][$campo]["message"] = $message;
                                 }
                                 // fim [não validou]
                             }
                         }
                         unset($allRules);
                     }
                 }
                 // fim foreach($campos)
             } elseif (empty($validationRules)) {
                 /*
                  * Não faz nada :)
                  */
             } else {
                 if (!$this->{$model}->validate(array($model => $campos), true)) {
                     $vE[$model] = 0;
                 }
             }
         }
     }
     /**
      * $vE: Validations Errors
      */
     /* se já houve invalidações manuais com $this->invalidate() */
     if ($this->invalidated) {
         return false;
     }
     /**
      * Se validou, retorna true
      */
     if (!empty($vE)) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:kurko,项目名称:acidphp,代码行数:101,代码来源:Model.php

示例6: snmpgeneric_list


//.........这里部分代码省略.........
    /* array_merge doesn't work with numeric keys !! */
    $sysObjectID['attr'] = array();
    $sysObjectID['port'] = array();
    $sysobjid = $sysObjectID['value'];
    $count = 1;
    while ($count) {
        if (isset($sg_known_sysObjectIDs[$sysobjid])) {
            $sysObjectID = $sysObjectID + $sg_known_sysObjectIDs[$sysobjid];
            if (isset($sg_known_sysObjectIDs[$sysobjid]['attr'])) {
                $sysObjectID['attr'] = $sysObjectID['attr'] + $sg_known_sysObjectIDs[$sysobjid]['attr'];
            }
            if (isset($sg_known_sysObjectIDs[$sysobjid]['port'])) {
                $sysObjectID['port'] = $sysObjectID['port'] + $sg_known_sysObjectIDs[$sysobjid]['port'];
            }
            if (isset($sg_known_sysObjectIDs[$sysobjid]['text'])) {
                showSuccess("found sysObjectID ({$sysobjid}) " . $sg_known_sysObjectIDs[$sysobjid]['text']);
            }
        }
        $sysobjid = preg_replace('/\\.[[:digit:]]+$/', '', $sysobjid, 1, $count);
        /* add default sysobjectid */
        if ($count == 0 && $sysobjid != 'default') {
            $sysobjid = 'default';
            $count = 1;
        }
    }
    $sysObjectID['vendor_number'] = $sysobjid;
    /* device pf */
    if (isset($sysObjectID['pf'])) {
        foreach ($sysObjectID['pf'] as $function) {
            if (function_exists($function)) {
                /* call device pf */
                $function($snmpdev, $sysObjectID, NULL);
            } else {
                showWarning("Missing processor function " . $function . " for device {$sysobjid}");
            }
        }
    }
    /* sort attributes maintain numeric keys */
    ksort($sysObjectID['attr']);
    /* DEBUG */
    //sg_var_dump_html($sysObjectID['attr'], "Before processing");
    /* needs PHP >= 5 foreach call by reference */
    /* php 5.1.6 doesn't seem to work */
    //foreach($sysObjectID['attr'] as $attr_id => &$attr)
    foreach ($sysObjectID['attr'] as $attr_id => $value) {
        $attr =& $sysObjectID['attr'][$attr_id];
        if (isset($object['attr'][$attr_id])) {
            if (array_key_exists('key', $object['attr'][$attr_id])) {
                $attr['key'] = $object['attr'][$attr_id]['key'];
            }
            switch (TRUE) {
                case isset($attr['pf']):
                    if (function_exists($attr['pf'])) {
                        $attr['pf']($snmpdev, $sysObjectID, $attr_id);
                    } else {
                        showWarning("Missing processor function " . $attr['pf'] . " for attribute {$attr_id}");
                    }
                    break;
                case isset($attr['oid']):
                    $attrvalue = $snmpdev->get($attr['oid']);
                    if (isset($attr['regex'])) {
                        $regex = $attr['regex'];
                        if (isset($attr['replacement'])) {
                            $replacement = $attr['replacement'];
                            $attrvalue = preg_replace($regex, $replacement, $attrvalue);
                        } else {
开发者ID:dot-Sean,项目名称:racktables-contribs,代码行数:67,代码来源:snmpgeneric.php

示例7: handlePackageError

function handlePackageError($error)
{
    showWarning($error['description']);
    $actionList = $error['actions'];
    $actionList = getExtraActions($actionList);
    showPackageActions($actionList);
    $actions = array_keys($actionList);
    $actions = '[' . implode('], [', $actions) . ']';
    $userInput = getUserInput("    Plese choose one of the following actions( {$actions} ): ");
    return $userInput;
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:11,代码来源:ezwebincommon.php

示例8: postInstallAdminSiteaccessINIUpdate

            postInstallAdminSiteaccessINIUpdate($params);
            postInstallUserSiteaccessINIUpdate($params);
            createTranslationSiteAccesses($params);
            // updateTemplateLookClassAttributes() and updateTemplateLookObjectAttributes();
            $classIdentifier = 'template_look';
            $newAttributeIdArr = expandClass($classIdentifier);
            foreach ($newAttributeIdArr as $id) {
                updateObject($classIdentifier, $id);
            }
            $templateLookData = templateLookObjectData($params);
            $siteInstaller->updateContentObjectAttributes(array('object_id' => $webinInstaller->setting('template_look_object_id'), 'attributes_data' => $templateLookData));
            $siteInstaller->swapNodes(array('src_node' => array('name' => "eZ Publish"), 'dst_node' => array('name' => "Home")));
            $siteInstaller->removeContentObject(array('name' => 'eZ Publish'));
            $webinInstaller->postInstall();
        }
        //
        // Output installation status.
        //
        showMessage2('Installation complete.');
        showMessage('URLs to access eZWebin sites:');
        foreach ($siteaccessUrls as $siteaccessType => $siteaccessInfo) {
            showMessage("  {$siteaccessType}:");
            foreach ($siteaccessInfo as $siteaccessName => $urlInfo) {
                showMessage("    {$siteaccessName}: " . $urlInfo['url']);
            }
        }
    } else {
        showWarning("Unable to find installation script dir.");
    }
}
$script->shutdown(0, 'Done');
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:31,代码来源:ezwebininstall.php

示例9: queryTerminal


//.........这里部分代码省略.........
                    $commands = "set cli screen-length 0\n" . $commands;
                    break;
                case 'eos4':
                    $commands = "enable\nno terminal monitor\nterminal length 0\n" . $commands;
                    break;
                case 'ros11':
                    $commands = "terminal datadump\n" . $commands;
                    $commands .= "\n\n";
                    # temporary workaround for telnet server
                    break;
                case 'iosxr4':
                    $commands = "terminal length 0\nterminal monitor disable\n" . $commands;
                    break;
                case 'dlink':
                    $commands = "disable clipaging\n" . $commands;
                    break;
            }
            // prepend telnet commands by credentials
            if (isset($settings['password'])) {
                $commands = $settings['password'] . "\n" . $commands;
            }
            if (isset($settings['username'])) {
                $commands = $settings['username'] . "\n" . $commands;
            }
            // command-line options are specific to client: telnet or netcat
            switch ($settings['protocol']) {
                case 'telnet':
                    $params_from_settings['port'] = 'port';
                    $params_from_settings['prompt'] = 'prompt';
                    $params_from_settings['connect-timeout'] = 'connect_timeout';
                    $params_from_settings['timeout'] = 'timeout';
                    $params_from_settings['prompt-delay'] = 'prompt_delay';
                    break;
                case 'netcat':
                    $params_from_settings['p'] = 'port';
                    $params_from_settings['w'] = 'timeout';
                    $params_from_settings['b'] = 'ncbin';
                    break;
            }
            break;
        case 'ssh':
            $params_from_settings['port'] = 'port';
            $params_from_settings['proto'] = 'proto';
            $params_from_settings['username'] = 'username';
            $params_from_settings['i'] = 'identity_file';
            $params_from_settings['sudo-user'] = 'sudo_user';
            $params_from_settings['connect-timeout'] = 'connect_timeout';
            break;
        case 'ucssdk':
            # remote XML through a Python backend
            $params = array();
            # reset
            # UCS in its current implementation besides the terminal_settings() provides
            # an additional username/password feed through the HTML from. Whenever the
            # user provides the credentials through the form, use these instead of the
            # credentials [supposedly] set by terminal_settings().
            if ($script_mode != TRUE && !isCheckSet('use_terminal_settings')) {
                genericAssertion('ucs_login', 'string');
                genericAssertion('ucs_password', 'string');
                $settings['username'] = $_REQUEST['ucs_login'];
                $settings['password'] = $_REQUEST['ucs_password'];
            }
            foreach (array('hostname', 'username', 'password') as $item) {
                if (empty($settings[$item])) {
                    throw new RTGatewayError("{$item} not available, check terminal_settings()");
                }
            }
            $commands = "login {$settings['hostname']} {$settings['username']} {$settings['password']}\n" . $commands;
            break;
        default:
            throw RTGatewayError("Invalid terminal protocol '{$settings['protocol']}' specified");
    }
    foreach ($params_from_settings as $param_name => $setting_name) {
        if (isset($settings[$setting_name])) {
            if (is_int($param_name)) {
                $params[] = $settings[$setting_name];
            } else {
                $params[$param_name] = $settings[$setting_name];
            }
        }
    }
    callHook('alterTerminalParams', $object_id, $tolerate_remote_errors, array(&$settings['protocol']), array(&$params));
    $ret_code = callScript($settings['protocol'], $params, $commands, $out, $errors);
    if ($settings['protocol'] != 'ssh' || !$tolerate_remote_errors) {
        if (!empty($errors)) {
            throw new RTGatewayError("{$settings['protocol']} error: " . rtrim($errors));
        } elseif ($ret_code !== 0) {
            throw new RTGatewayError("{$settings['protocol']} error: result code {$ret_code}");
        }
    } elseif (!empty($errors)) {
        // ssh and tolerate and non-empty $errors
        foreach (explode("\n", $errors) as $line) {
            if (strlen($line)) {
                showWarning("{$settings['protocol']} {$settings['hostname']}: {$line}");
            }
        }
    }
    return strtr($out, array("\r" => ""));
    // cut ^M symbols
}
开发者ID:ehironymous,项目名称:racktables,代码行数:101,代码来源:remote.php

示例10: microtime

<?php

$timeStart = microtime(true);
session_start();
ob_start();
if (empty($_SESSION)) {
    exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
require_once 'Functions/SQL.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
?>

<br>
	<div class="panel panel-warning"> 
		<div class="panel-heading"></div>
		<div class="panel-body">
		<?php 
if ($totalWarning > 0) {
    showWarning($bdd, $accountID);
} else {
    echo $warning2;
}
?>
		</div>
	</div>

<?php 
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
开发者ID:The-Nico26,项目名称:Caranille,代码行数:31,代码来源:index.php

示例11: queryTerminal


//.........这里部分代码省略.........
            // set the prompt in case user would like to specify telnet protocol
            $commands = "terminal length 0\nterminal no monitor\n" . $commands;
            break;
        case 'air12':
            $protocol = 'telnet';
            # Aironet IOS is broken
            $prompt = '^(Username|Password): $|^\\S+[>#]$';
            $commands = "terminal length 0\nterminal no monitor\n" . $commands;
            break;
        case 'fdry5':
            $protocol = 'netcat';
            // default is netcat mode
            $prompt = '^(Login|Username|Password): $|^\\S+[>#]$';
            // set the prompt in case user would like to specify telnet protocol
            $commands = "skip-page-display\n" . $commands;
            break;
        case 'vrp55':
        case 'vrp85':
            $commands = "screen-length 0 temporary\n" . $commands;
            /* fall-through */
        /* fall-through */
        case 'vrp53':
            $protocol = 'telnet';
            $prompt = '^\\[[^[\\]]+\\]$|^<[^<>]+>$|^(Username|Password):$|\\[[Yy][^\\[\\]]*\\]\\s*:?\\s*$';
            break;
        case 'nxos4':
            $protocol = 'telnet';
            $prompt = '(^([Ll]ogin|[Pp]assword):|[>#]) $';
            $commands = "terminal length 0\nterminal no monitor\n" . $commands;
            break;
        case 'xos12':
            $protocol = 'telnet';
            $prompt = ': $|\\.\\d+ # $|\\?\\s*\\([Yy]\\/[Nn]\\)\\s*$';
            $commands = "disable clipaging\n" . $commands;
            break;
        case 'jun10':
            $protocol = 'telnet';
            $prompt = '^login: $|^Password:$|^\\S+@\\S+[>#] $';
            $commands = "set cli screen-length 0\n" . $commands;
            break;
        case 'eos4':
            $protocol = 'telnet';
            # strict RFC854 implementation, netcat won't work
            $prompt = '^\\xf2?(login|Username|Password): $|^\\S+[>#]$';
            $commands = "enable\nno terminal monitor\nterminal length 0\n" . $commands;
            break;
        case 'ros11':
            $protocol = 'netcat';
            # see ftos8 case
            $prompt = '^(User Name|\\rPassword):$|^\\r?\\S+# $';
            $commands = "terminal datadump\n" . $commands;
            $commands .= "\n\n";
            # temporary workaround for telnet server
            break;
        case 'iosxr4':
            $protocol = 'telnet';
            $prompt = '^\\r?(Login|Username|Password): $|^\\r?\\S+[>#]$';
            $commands = "terminal length 0\nterminal monitor disable\n" . $commands;
            break;
        case 'ucs':
            $protocol = 'ucssdk';
            break;
        case 'dlink':
            $protocol = 'netcat';
            $commands = "disable clipaging\n" . $commands;
            break;
    }
    if (!isset($protocol)) {
        $protocol = 'netcat';
    }
    if (!isset($prompt)) {
        $prompt = NULL;
    }
    // set the default settings before calling user-defined callback
    $settings = array('hostname' => $endpoints[0], 'protocol' => $protocol, 'port' => NULL, 'prompt' => $prompt, 'username' => NULL, 'password' => NULL, 'timeout' => 15, 'connect_timeout' => 2, 'prompt_delay' => 0.001, 'sudo_user' => NULL, 'identity_file' => NULL);
    // override default settings
    if (is_callable('terminal_settings')) {
        call_user_func('terminal_settings', $objectInfo, array(&$settings));
    }
    // make gateway-specific CLI params out of settings
    $params = callHook('makeGatewayParams', $object_id, $tolerate_remote_errors, array(&$settings), array(&$commands));
    // call gateway
    $ret_code = callScript($settings['protocol'], $params, $commands, $out, $errors);
    if ($settings['protocol'] != 'ssh' || !$tolerate_remote_errors) {
        if (!empty($errors)) {
            throw new RTGatewayError("{$settings['protocol']} error: " . rtrim($errors));
        } elseif ($ret_code !== 0) {
            throw new RTGatewayError("{$settings['protocol']} error: result code {$ret_code}");
        }
    } elseif (!empty($errors)) {
        // ssh and tolerate and non-empty $errors
        foreach (explode("\n", $errors) as $line) {
            if (strlen($line)) {
                showWarning("{$settings['protocol']} {$settings['hostname']}: {$line}");
            }
        }
    }
    return strtr($out, array("\r" => ""));
    // cut ^M symbols
}
开发者ID:ivladdalvi,项目名称:racktables,代码行数:101,代码来源:remote.php

示例12: mkdir

    mkdir($sessdir, 0777);
}
ini_set('session.save_path', $sessdir);
function ae_nocache()
{
    header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
}
ae_nocache();
session_start();
ini_set('display_errors', 1);
require_once "../auth.lib.php";
require_once "../mysql.inc.php";
mysqlConnect();
if (!checkSessionAuth()) {
    showWarning(1);
    exit(1);
}
if (isLevelCompleted($LEVELNAME)) {
    showWarning(2);
    exit(1);
}
$USERLOGGEDIN = true;
updateUserAttempt($LEVELNAME);
$LEVELPOINTS = getLevelPoints($LEVELNAME);
?>

开发者ID:nobelium,项目名称:digitalfortress,代码行数:29,代码来源:session.inc.php

示例13: _printportlink

 function _printportlink($src_port_id, $dst_port_id, &$dst_link, $back = FALSE)
 {
     global $lm_multilink_port_types;
     $multilink = LM_MULTILINK;
     if (!isset($this->list[$dst_port_id])) {
         /* get port not in list */
         //	echo "<td>AHHH $src_port_id $dst_port_id --> $back</td>";
         //	echo "<td>load".$this->var_dump_html($dst_link)." tree</td>";
         //		echo "<td>".$dst_link['cable']." ".$dst_link['name']."</td><td>not displayed</td>";
         if ($back) {
             echo "<td>></td>";
         }
         // TODO check if multilink is needed here
         $this->printport($dst_link, $multilink && in_array($dst_link['type'], $lm_multilink_port_types));
         echo "<td>...</td>";
         return TRUE;
         //	$this->_getportlist($this->list[$src_port_id], $back, !$back);
     }
     $dst_port = $this->list[$dst_port_id];
     $object_id = $dst_port['object_id'];
     $obj_name = $dst_port['obj_name'];
     if ($obj_name == NULL) {
         $tmpobj = spotEntity('object', $dst_port['object_id']);
         $dst_port['obj_name'] = $tmpobj['dname'];
         $obj_name = $tmpobj['dname'];
     }
     $loop = FALSE;
     $edgeport = $dst_link == NULL || empty($dst_port['front']) || empty($dst_port['back']);
     if ($back) {
         $linktype = 'back';
     } else {
         $linktype = 'front';
     }
     $sameobject = FALSE;
     if (isset($dst_link['loop'])) {
         $loop = TRUE;
     }
     if ($dst_link != NULL) {
         $src_object_id = $this->list[$src_port_id]['object_id'];
         if (!$this->allback && $object_id == $src_object_id && $back) {
             $sameobject = TRUE;
         } else {
             $this->printlink($src_port_id, $dst_link, $linktype);
         }
     } else {
         $this->_printlinkportsymbol($dst_port_id, $linktype);
         $edgeport = true;
         if (!$back) {
             $this->printcomment($dst_port);
         }
     }
     if ($back) {
         if (!$sameobject) {
             $this->printobject($object_id, $obj_name);
         }
         echo "<td>></td>";
         /* align ports nicely */
         if ($dst_port['id'] == $this->port_id) {
             echo '</td></tr></table id=printportlink1></td><td><table align=left><tr>';
         }
     }
     /* print [portname] */
     // TODO check multilink symbols front/back edgeports
     $this->printport($dst_port, $multilink && in_array($dst_port['type'], $lm_multilink_port_types));
     if ($loop) {
         echo '<td bgcolor=#ff9966>LOOP</td>';
     }
     if (!$back) {
         /* align ports nicely */
         if ($dst_port['id'] == $this->port_id) {
             echo '</td></tr></table id=printportlink2></td><td><table align=left><tr>';
         }
         echo "<td><</td>";
         $this->printobject($object_id, $obj_name);
         if (empty($dst_port['back'])) {
             $this->_printlinkportsymbol($dst_port_id, 'back');
         }
     } else {
         if (empty($dst_port['front'])) {
             $this->printcomment($dst_port);
             $this->_printlinkportsymbol($dst_port_id, 'front');
         }
     }
     if ($loop) {
         if (isset($dst_link['loopmaxcount'])) {
             $reason = " (MAX LOOP COUNT reached)";
         } else {
             $reason = '';
         }
         showWarning("Possible Loop on Port ({$linktype}) " . $dst_port['name'] . $reason);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:dot-Sean,项目名称:racktables-contribs,代码行数:94,代码来源:linkmgmt.php

示例14: trim

        $ver = trim($recent['version']);
        $uri = trim($recent['uri']);
        $msg = trim($recent['message']);
        if ($pretty) {
            $out .= '<ul>
			<li>Your version: <strong>' . $version . '</strong></li>
			<li>Latest version: <strong>' . $ver . '</strong></li>
			<li>&nbsp;</li>';
            if ($recent['is_testing']) {
                $out .= '<li><strong>There is a newer testing version of Froxlor available, please update.</strong></li>';
            } else {
                $out .= '<li><strong>There is a newer version of Froxlor available, please update.</strong></li>';
            }
            if ($uri != '') {
                $out .= '<li>&nbsp;</li>
				<li><a href="' . $uri . '">' . $uri . '</a></li>';
            }
            if ($msg != '') {
                $out .= '<li>&nbsp;</li>
				<li>Info: ' . $msg . '</li>';
            }
            $out .= '</ul>';
            showWarning($out);
        } else {
            echo $ver . '|' . $uri . '|' . $msg;
        }
    }
}
if ($pretty) {
    echo htmlFooter();
}
开发者ID:Alkyoneus,项目名称:Froxlor,代码行数:31,代码来源:index.php

示例15: getGlobals_about

<?php

/****************************************************************************
* Name:        about.php
* Author:      Ben Barnes
* Date:        2016-02-20
* Purpose:     About page
*****************************************************************************/
getGlobals_about($getPage_connection2);
showTitle("About");
compileMenu($getPage_connection2, "about");
showWarning($getPage_connection2);
showPageTitle($getPage_connection2, "About", false);
showAboutInfo($getPage_connection2);
require "section4.txt";
resetSession(true);
开发者ID:barnesb25,项目名称:worldsthegame,代码行数:16,代码来源:about.php


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