コード例 #1
0
function snmpgeneric_tabhandler($object_id)
{
    //	sg_var_dump_html($_POST);
    if (isset($_POST['asnewobject']) && $_POST['asnewobject'] == "1") {
        $newobject_name = $_POST['object_name'];
        $newobject_label = $_POST['object_label'];
        $newobject_type_id = $_POST['object_type_id'];
        $newobject_asset_no = $_POST['object_asset_no'];
        if (sg_checkObjectNameUniqueness($newobject_name, $newobject_type_id)) {
            $object_id = commitAddObject($newobject_name, $newobject_label, $newobject_type_id, $newobject_asset_no);
            $_POST['asnewobject'] = "0";
            parse_str($_SERVER['QUERY_STRING'], $query_string);
            $query_string['object_id'] = $object_id;
            $_SERVER['QUERY_STRING'] = http_build_query($query_string);
            list($path, $qs) = explode('?', $_SERVER['REQUEST_URI'], 2);
            $_SERVER['REQUEST_URI'] = $path . '?' . $_SERVER['QUERY_STRING'];
            // switch to new object
            echo '<body>';
            echo '<body onload="document.forms[\'newobject\'].submit();">';
            echo '<form method=POST id=newobject action=' . $_SERVER['REQUEST_URI'] . '>';
            foreach ($_POST as $name => $value) {
                echo "<input type=hidden name={$name} value={$value}>";
            }
            echo '<input type=submit id="submitbutton" tabindex="1" value="Show List">';
            echo '</from></body>';
            exit;
        } else {
            showError("Object with name: \"{$newobject_name}\" already exists!!!");
            $_POST['snmpconfig'] = "0";
        }
    }
    // save snmp settings
    if (isset($_POST['save']) && $_POST['save'] == "1") {
        // TODO save only on success !!
        $object = spotEntity('object', $object_id);
        $snmpvalues[0] = 'SNMP';
        $snmpnames = array('host', 'version', 'community');
        if ($_POST['version'] == "v3") {
            $snmpnames = array_merge($snmpnames, array('sec_level', 'auth_protocol', 'auth_passphrase', 'priv_protocol', 'priv_passphrase'));
        }
        foreach ($snmpnames as $key => $value) {
            if (isset($_POST[$value])) {
                switch ($value) {
                    case "auth_passphrase":
                    case "priv_passphrase":
                        $snmpvalues[$key + 1] = base64_encode($_POST[$value]);
                        break;
                    default:
                        $snmpvalues[$key + 1] = $_POST[$value];
                }
            }
        }
        //	sg_var_dump_html($snmpvalues);
        $newsnmpstr = implode($snmpvalues, ":");
        $snmpstr = strtok($object['comment'], "\n\r");
        $snmpstrarray = explode(':', $snmpstr);
        $setcomment = "set";
        if ($snmpstrarray[0] == "SNMP") {
            if ($newsnmpstr == $snmpstr) {
                $setcomment = "ok";
            } else {
                $setcomment = "update";
            }
        }
        if ($setcomment != "ok") {
            if ($setcomment == "update") {
                $comment = str_replace($snmpstr, $newsnmpstr, $object['comment']);
            } else {
                $comment = "{$newsnmpstr}\n" . $object['comment'];
            }
            //	echo "$snmpnewstr ".$object['comment']." --> $comment";
            commitUpdateObject($object_id, $object['name'], NULL, $object['has_problems'], NULL, $comment);
            showNotice("{$setcomment} SNMP Settings: {$newsnmpstr}");
        }
    }
    if (isset($_POST['snmpconfig']) && $_POST['snmpconfig'] == '1') {
        snmpgeneric_list($object_id);
    } else {
        snmpgeneric_snmpconfig($object_id);
    }
}
コード例 #2
0
ファイル: ophandlers.php プロジェクト: xtha/salt
function renameObjectPorts()
{
    $object_id = getBypassValue();
    $n = 0;
    foreach (getObjectPortsAndLinks($object_id) as $port) {
        $canon_pn = shortenPortName($port['name'], $port['object_id']);
        if ($canon_pn != $port['name']) {
            commitUpdatePort($object_id, $port['id'], $canon_pn, $port['oif_id'], $port['label'], $port['l2address'], $port['reservation_comment']);
            $n++;
        }
    }
    if ($n) {
        showSuccess("Renamed {$n} ports");
    } else {
        showNotice("Nothing renamed");
    }
}
コード例 #3
0
function renderNewSLBItemForm($realm1, $realm2)
{
    /**
     * Returns a list of values, a human readable name and options
     * for the selecttag for a given realm.
     */
    function get_realm_data($realm)
    {
        $name = NULL;
        $list = array();
        $options = array();
        switch ($realm) {
            case 'object':
                $name = 'Load balancer';
                $list = getNarrowObjectList('IPV4LB_LISTSRC');
                $options = array('name' => 'object_id');
                break;
            case 'ipv4vs':
                $name = 'Virtual service';
                $list = formatEntityList(listCells('ipv4vs'));
                $options = array('name' => 'vs_id');
                break;
            case 'ipv4rspool':
                $name = 'RS pool';
                $list = formatEntityList(listCells('ipv4rspool'));
                $options = array('name' => 'pool_id');
                break;
            default:
                throw new InvalidArgException('realm', $realm);
        }
        return array('name' => $name, 'list' => $list, 'options' => $options);
    }
    $realm1_data = get_realm_data($realm1);
    $realm2_data = get_realm_data($realm2);
    startPortlet('Add new');
    echo "<table cellspacing=0 cellpadding=5 align=center>";
    if (count($realm1_data['list']) && count($realm2_data['list'])) {
        printOpFormIntro('addLB');
    }
    echo "<tr valign=top><th class=tdright>{$realm1_data['name']}</th><td class=tdleft>";
    printSelect($realm1_data['list'], $realm1_data['options']);
    echo '</td><td class=tdcenter valign=middle rowspan=2>';
    if (count($realm1_data['list']) && count($realm2_data['list'])) {
        printImageHREF('ADD', 'Configure LB', TRUE);
    } else {
        $names = array();
        if (!count($realm1_data['list'])) {
            $names[] = 'a ' . $realm1_data['name'];
        }
        if (!count($realm2_data['list'])) {
            $names[] = 'a ' . $realm2_data['name'];
        }
        $message = 'Please create ' . implode(' and ', $names) . '.';
        showNotice($message);
        printImageHREF('DENIED', $message, FALSE);
    }
    echo "<tr valign=top><th class=tdright>{$realm2_data['name']}</th><td class=tdleft>";
    printSelect($realm2_data['list'], $realm2_data['options']);
    echo "</td></tr>\n";
    echo "<tr><th class=tdright>VS config</th><td colspan=2><textarea name=vsconfig rows=10 cols=80></textarea></td></tr>";
    echo "<tr><th class=tdright>RS config</th><td colspan=2><textarea name=rsconfig rows=10 cols=80></textarea></td></tr>";
    echo "<tr><th class=tdright>Priority</th><td class=tdleft colspan=2><input name=prio size=10></td></tr>";
    echo "</form></table>\n";
    finishPortlet();
}
コード例 #4
0
        default:
            break;
    }
    return $isValid;
}
// script initializing
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "\n" . "This script will upgrade ezwebin.", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true, 'user' => true));
$script->startup();
$scriptOptions = $script->getOptions("[to-version:][repository:][package:][package-dir:][url:][auto-mode:]", "", array('to-version' => "Specify what upgrade path to use. \n" . " available options: '1.2-0' - upgrade 1.1-1 to 1.2-0\n" . "                    '1.3-0' - upgrade 1.2-0 to 1.3-0\n" . "                    '1.4-0' - upgrade 1.3-0 to 1.4-0", 'repository' => "Path to repository where unpacked(unarchived) packages are \n" . "placed. it's relative to 'var/[site.ini].[FileSettings].[StorageDir]/[package.ini].[RepositorySettings].[RepositoryDirectory]' \n" . "(default is 'var/storage/packages/ez_systems')", 'package' => "Package(s) to install, f.e. 'ezwebin_classes'", 'package-dir' => "Path to directory with packed(ezpkg) packages(default is '/tmp/ezwebin') ", 'url' => "URL to download packages, f.e. 'http://packages.ez.no/ezpublish/3.9'.\n" . "'package-dir' can be specified to store uploaded packages on local computer.\n" . "if 'package-dir' is not specified then default dir('/tmp/ezwebin') will be used.", 'auto-mode' => "[on/off]. Do not ask what to do in case of confilicts. By default is 'on'"), false, array('user' => true));
if (!$scriptOptions['siteaccess']) {
    showNotice("No siteaccess provided, will use default siteaccess");
} else {
    $siteAccessExists = checkSiteaccess($scriptOptions['siteaccess']);
    if ($siteAccessExists) {
        showNotice("Using siteaccess " . $scriptOptions['siteaccess']);
        $script->setUseSiteAccess($scriptOptions['siteaccess']);
    } else {
        showError("Siteaccess '" . $scriptOptions['siteaccess'] . "' does not exist. Exiting...");
    }
}
$script->initialize();
/**************************************************************
* process options                                             *
***************************************************************/
$toVersion = '1.2-0';
if ($scriptOptions['to-version']) {
    $version = $scriptOptions['to-version'];
    if (isValidWebinUpgradeVersion($version)) {
        $toVersion = $version;
    } else {
コード例 #5
0
function renderNewTripletForm($realm1, $realm2)
{
    function get_realm_data($realm)
    {
        $name = NULL;
        $list = array();
        $options = array();
        switch ($realm) {
            case 'object':
                $name = 'Load balancer';
                $list = getNarrowObjectList('IPV4LB_LISTSRC');
                $options = array('name' => 'object_id');
                break;
            case 'ipvs':
                $name = 'Virtual service';
                $list = formatEntityList(listCells('ipvs'));
                $options = array('name' => 'vs_id');
                break;
            case 'ipv4rspool':
                $name = 'RS pool';
                $list = formatEntityList(listCells('ipv4rspool'));
                $options = array('name' => 'rspool_id');
                break;
            default:
                throw new InvalidArgException('realm', $realm);
        }
        return array('name' => $name, 'list' => $list, 'options' => $options);
    }
    $realm1_data = get_realm_data($realm1);
    $realm2_data = get_realm_data($realm2);
    startPortlet('Add new VS group');
    if (count($realm1_data['list']) && count($realm2_data['list'])) {
        printOpFormIntro('addLink');
    }
    echo "<table cellspacing=0 cellpadding=5 align=center>";
    echo "<tr valign=top><th class=tdright>{$realm1_data['name']}</th><td class=tdleft>";
    printSelect($realm1_data['list'], $realm1_data['options']);
    echo '</td><td class=tdcenter valign=middle rowspan=2>';
    if (count($realm1_data['list']) && count($realm2_data['list'])) {
        printImageHREF('ADD', 'Configure LB', TRUE);
    } else {
        $names = array();
        if (!count($realm1_data['list'])) {
            $names[] = 'a ' . $realm1_data['name'];
        }
        if (!count($realm2_data['list'])) {
            $names[] = 'a ' . $realm2_data['name'];
        }
        $message = 'Please create ' . implode(' and ', $names) . '.';
        showNotice($message);
        printImageHREF('DENIED', $message, FALSE);
    }
    echo "<tr valign=top><th class=tdright>{$realm2_data['name']}</th><td class=tdleft>";
    printSelect($realm2_data['list'], $realm2_data['options']);
    echo "</td></tr>\n";
    echo "</table></form>\n";
    finishPortlet();
}
コード例 #6
0
ファイル: index.php プロジェクト: logboost/vinaget-logboost
							</div>
							<div id="bbcode" align="center" style="display: none;"></div>
							<div id="showresults" align="center"></div>
<?php 
            }
        }
    }
}
#---------------------------- end get  ------------------------------#
?>
				<!-- ########################## End Main ########################### -->

					<div style="width: 55%;">
						<!-- Start Server Info -->
						<div class="alert alert-info"><?php 
showNotice();
?>
</div>
						<!-- End Server Info -->
						</div>
						<hr />

					<!-- Bootstrap skin by Rhuan Gonzaga (rhuangonzaga[@]gmail.com)-->	

						<script type="text/javascript" language="javascript" src="ajax.js?ver=1.0"></script> 
					<!-- Copyright please don't remove-->
						<STRONG><SPAN class='powered' style="font-size: 12px;">Code LeechViet. Developed by ..:: [H] ::..<br/>Powered by <a href='http://rapidleech.com/forum/viewforum.php?f=23'><?php 
printf($obj->lang['version']);
?>
 Revision <?php 
printf($obj->current_version);
コード例 #7
0
ファイル: update.php プロジェクト: martinbrylski/admidio
 // until version 3 Admidio had sql and php files where the update statements where stored
 // these files must be executed
 // in der Schleife wird geschaut ob es Scripte fuer eine Microversion (3.Versionsstelle) gibt
 // Microversion 0 sollte immer vorhanden sein, die anderen in den meisten Faellen nicht
 for ($microVersion = $microVersion; $microVersion < 15; ++$microVersion) {
     $version = $mainVersion . '_' . $subVersion . '_' . $microVersion;
     // Update-Datei der naechsten hoeheren Version ermitteln
     $sqlUpdateFile = 'db_scripts/upd_' . $version . '_db.sql';
     $phpUpdateFile = 'db_scripts/upd_' . $version . '_conv.php';
     // output of the version number for better debugging
     if ($gDebug) {
         error_log('Update to version ' . $version);
     }
     if (file_exists($sqlUpdateFile)) {
         // SQL-Script abarbeiten
         $file = fopen($sqlUpdateFile, 'r') or showNotice($gL10n->get('INS_ERROR_OPEN_FILE', $sqlUpdateFile), 'update.php', $gL10n->get('SYS_BACK'), 'layout/back.png', true);
         $content = fread($file, filesize($sqlUpdateFile));
         $sql_arr = explode(';', $content);
         fclose($file);
         foreach ($sql_arr as $sql) {
             if (trim($sql) !== '') {
                 // replace prefix with installation specific table prefix
                 $sql = str_replace('%PREFIX%', $g_tbl_praefix, $sql);
                 // now execute update sql
                 $gDb->query($sql);
             }
         }
         $flagNextVersion = true;
     }
     // check if an php update file exists and then execute the script
     if (file_exists($phpUpdateFile)) {
コード例 #8
0
// script initializing
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "\n" . "Install eZWebin package\n", 'use-session' => false, 'use-modules' => true, 'use-extensions' => true, 'user' => true));
$script->startup();
$scriptOptions = $script->getOptions("[repository:][package:][package-dir:][url:][admin-siteaccess:][user-siteaccess:][auto-mode:]", "", array('repository' => "Path to repository where unpacked(unarchived) packages are \n" . "placed. it's relative to 'var/[site.ini].[FileSettings].[StorageDir]/[package.ini].[RepositorySettings].[RepositoryDirectory]' \n" . "(default is 'var/storage/packages/ez_systems')", 'package-dir' => "Path to directory with packed(ezpkg) packages(default is '/tmp/ezwebin') ", 'url' => "URL to download packages, f.e. 'http://packages.ez.no/ezpublish/3.9'.\n" . "'package-dir' can be specified to store uploaded packages on local computer.\n" . "if 'package-dir' is not specified then default dir('/tmp/ezwebin') will be used.", 'admin-siteaccess' => 'Will be used as base for eZWebin admin siteaccess', 'user-siteaccess' => 'Will be used as base for eZWebin user siteaccesses', 'auto-mode' => "[on/off]. Do not ask what to do in case of confilicts. By default is 'on'"), false, array('user' => true));
if (!$scriptOptions['admin-siteaccess']) {
    showError("No admin siteaccess provided");
}
if (!$scriptOptions['user-siteaccess']) {
    showError("No user siteaccess provided");
}
$adminSiteaccess = $scriptOptions['admin-siteaccess'];
$userSiteaccess = $scriptOptions['user-siteaccess'];
checkSiteaccess($adminSiteaccess, true);
checkSiteaccess($userSiteaccess, true);
showNotice("Using siteaccess '" . $adminSiteaccess . "'");
$script->setUseSiteAccess($adminSiteaccess);
$script->initialize();
/**************************************************************
* process options                                             *
***************************************************************/
//
// 'repository' option
//
$packageRepository = $scriptOptions['repository'];
if (!$packageRepository) {
    $packageRepository = repositoryByVendor(defaultVendor());
}
//
// 'package' option
//
コード例 #9
0
ファイル: snmpgeneric.php プロジェクト: xtha/salt
function snmpgeneric_pf_entitymib(&$snmp, &$sysObjectID, $attr_id)
{
    /* $attr_id == NULL -> device pf */
    $attrs =& $sysObjectID['attr'];
    $ports =& $sysObjectID['port'];
    $entPhysicalClass = $snmp->walk('.1.3.6.1.2.1.47.1.1.1.1.5');
    /* entPhysicalClass */
    if (empty($entPhysicalClass)) {
        return;
    }
    showNotice("Found Entity Table (Experimental)");
    /*		PhysicalClass
     *		1:other
     *		2:unknown
     *		3:chassis
     *		4:backplane
     *		5:container
     *		6:powerSupply
     *		7:fan
     *		8:sensor
     *		9:module
     *		10:port
     *		11:stack
     *		12:cpu
     */
    /* chassis */
    /* always index = 1 ??? */
    $chassis = array_keys($entPhysicalClass, '3');
    /* 3 chassis */
    if (0) {
        if (!empty($chassis)) {
            echo '<table>';
            foreach ($chassis as $key => $oid) {
                /* get index */
                if (!preg_match('/\\.(\\d+)$/', $oid, $matches)) {
                    continue;
                }
                $index = $matches[1];
                $name = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.7.{$index}");
                $serialnum = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.11.{$index}");
                $mfgname = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.12.{$index}");
                $modelname = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.13.{$index}");
                //showNotice("$name $mfgname $modelname $serialnum");
                echo "<tr><td>{$name}</td><td>{$mfgname}</td><td>{$modelname}</td><td>{$serialnum}</td>";
            }
            unset($key);
            unset($oid);
            echo '</table>';
        }
    }
    /* chassis */
    /* modules */
    $modules = array_keys($entPhysicalClass, '9');
    /* 9 Modules */
    if (!empty($modules)) {
        echo '<br><br>Modules<br><table>';
        echo "<tr><th>Name</th><th>MfgName</th><th>ModelName</th><th>HardwareRev</th><th>FirmwareRev</th><th>SoftwareRev</th><th>SerialNum</th>";
        foreach ($modules as $key => $oid) {
            /* get index */
            if (!preg_match('/\\.(\\d+)$/', $oid, $matches)) {
                continue;
            }
            $index = $matches[1];
            $name = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.7.{$index}");
            $hardwarerev = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.8.{$index}");
            $firmwarerev = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.9.{$index}");
            $softwarerev = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.10.{$index}");
            $serialnum = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.11.{$index}");
            $mfgname = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.12.{$index}");
            $modelname = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.13.{$index}");
            //showNotice("$name $mfgname $modelname $hardwarerev $firmwarerev $softwarerev $serialnum");
            echo "<tr><td>" . (empty($name) ? '-' : $name) . "</td><td>{$mfgname}</td><td>{$modelname}</td><td>{$hardwarerev}</td><td>{$firmwarerev}</td><td>{$softwarerev}</td><td>{$serialnum}</td>";
            /* set SW version to first module software version */
            if ($key == 0) {
                $attrs[5]['value'] = $softwarerev;
                /* SW version */
                $attrs[5]['comment'] = 'entity MIB';
            }
        }
        unset($key);
        unset($oid);
        echo '</table>';
    }
    /* add AC ports */
    $powersupply = array_keys($entPhysicalClass, '6');
    /* 6 powerSupply */
    $count = 1;
    foreach ($powersupply as $oid) {
        /* get index */
        if (!preg_match('/\\.(\\d+)$/', $oid, $matches)) {
            continue;
        }
        $index = $matches[1];
        $descr = $snmp->get(".1.3.6.1.2.1.47.1.1.1.1.2.{$index}");
        $ports['AC-' . $count] = array('porttypeid' => '1-16', 'ifDescr' => $descr, 'comment' => 'entity MIB', 'uncheck' => '');
        $count++;
    }
    unset($oid);
}
コード例 #10
0
ファイル: installation.php プロジェクト: sistlind/admidio
 if (!file_exists('../../adm_my_files/config.php')) {
     showNotice($gL10n->get('INS_CONFIGURATION_FILE_NOT_FOUND', 'config.php'), 'installation.php?mode=6', $gL10n->get('SYS_BACK'), 'layout/back.png');
 }
 // set execution time to 6 minutes because we have a lot to do :)
 // there should be no error output because of safe mode
 @set_time_limit(300);
 // first check if session is filled (if installation was aborted then this is not filled)
 if (isset($_SESSION['prefix'])) {
     // if previous dialogs were filled then check if the settings are equal to config file
     if ($g_tbl_praefix != $_SESSION['prefix'] || $gDbType != $_SESSION['db_type'] || $g_adm_srv != $_SESSION['db_server'] || $g_adm_usr != $_SESSION['db_user'] || $g_adm_pw != $_SESSION['db_password'] || $g_adm_db != $_SESSION['db_database'] || $g_organization != $_SESSION['orga_shortname']) {
         showNotice($gL10n->get('INS_DATA_DO_NOT_MATCH', 'config.php'), 'installation.php?mode=6', $gL10n->get('SYS_BACK'), 'layout/back.png');
     }
 }
 // read data from sql script db.sql and execute all statements to the current database
 $filename = 'db_scripts/db.sql';
 $file = fopen($filename, 'r') or showNotice($gL10n->get('INS_DATABASE_FILE_NOT_FOUND', 'db.sql', 'adm_program/installation/db_scripts'), 'installation.php?mode=6', $gL10n->get('SYS_BACK'), 'layout/back.png');
 $content = fread($file, filesize($filename));
 $sql_arr = explode(';', $content);
 fclose($file);
 foreach ($sql_arr as $sql) {
     if (trim($sql) !== '') {
         // Prefix fuer die Tabellen einsetzen und SQL-Statement ausfuehren
         $sql = str_replace('%PREFIX%', $g_tbl_praefix, $sql);
         $db->query($sql);
     }
 }
 // create default data
 // add system component to database
 $component = new ComponentUpdate($db);
 $component->setValue('com_type', 'SYSTEM');
 $component->setValue('com_name', 'Admidio Core');
コード例 #11
0
ファイル: admin.php プロジェクト: sherlockhouse/aliyun
require_once R_P . 'admin/admincp.php';
//$imgpath = $db_bbsurl . '/images/';
$basename = $admin_file . '?adminjob=platformweiboapp&action=' . $action;
if ($adminjob == 'msg') {
    showNotice($message);
}
if ($adminjob != 'platformweiboapp' || !adminRight($adminjob, $admintype)) {
    showNotice('·Ç·¨²Ù×÷');
}
if ($action == 'customweibotemplate') {
    require_once R_P . 'connexion/customweibotemplate.php';
} else {
    if ($adminjob == 'admin') {
    } else {
        //adminmsg('undefine_action');
        showNotice('·Ç·¨²Ù×÷');
    }
}
function showNotice($notice)
{
    //global $db_bbsurl;
    //$imgpath = $db_bbsurl . '/images/';
    $message = $notice;
    include R_P . 'connexion/template/message.htm';
    exit;
}
function PrintTemplate($template, $EXT = 'htm')
{
    return R_P . 'connexion/template/' . $template . ".{$EXT}";
}
function adminRight($adminjob, $admintype)
コード例 #12
0
ファイル: admin.php プロジェクト: jechiy/PHPWind
require_once R_P . 'admin/admincp.php';
//$imgpath = $db_bbsurl . '/images/';
$basename = $admin_file . '?adminjob=platformweiboapp&action=' . $action;
if ($adminjob == 'msg') {
    showNotice($message);
}
if ($adminjob != 'platformweiboapp' || !adminRight($adminjob, $admintype)) {
    showNotice('非法操作');
}
if ($action == 'customweibotemplate') {
    require_once R_P . 'connexion/customweibotemplate.php';
} else {
    if ($adminjob == 'admin') {
    } else {
        //adminmsg('undefine_action');
        showNotice('非法操作');
    }
}
function showNotice($notice)
{
    //global $db_bbsurl;
    //$imgpath = $db_bbsurl . '/images/';
    $message = $notice;
    include R_P . 'connexion/template/message.htm';
    exit;
}
function PrintTemplate($template, $EXT = 'htm')
{
    return R_P . 'connexion/template/' . $template . ".{$EXT}";
}
function adminRight($adminjob, $admintype)
コード例 #13
0
ファイル: ophandlers.php プロジェクト: rhysm/racktables
function cleanupUCS()
{
    global $ucsproductmap;
    $oinfo = spotEntity('object', getBypassValue());
    $contents = getObjectContentsList($oinfo['id']);
    $clear = TRUE;
    foreach ($contents as $item_id) {
        $o = spotEntity('object', $item_id);
        $attrs = getAttrValues($item_id);
        # use HW type to decide if the object was produced by autoPopulateUCS()
        if (!array_key_exists(2, $attrs) or !in_array($attrs[2]['key'], $ucsproductmap)) {
            showWarning('Contained object ' . mkA($o['dname'], 'object', $item_id) . ' is not an automatic UCS object');
            $clear = FALSE;
        }
    }
    if (!$clear) {
        showNotice('nothing was deleted');
        return;
    }
    $done = 0;
    foreach ($contents as $item_id) {
        commitDeleteObject($item_id);
        $done++;
    }
    showSuccess("Removed {$done} items from UCS Domain '{$oinfo['name']}'");
}
コード例 #14
0
function clearstatscache($devOptions)
{
    $date = $devOptions['install_date'];
    if ($date == 0 || $date > strtotime('2 month ago')) {
        return false;
    } else {
        return showNotice();
        return true;
    }
}
コード例 #15
0
ファイル: functions.php プロジェクト: rhysm/racktables
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;
}