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


PHP DBSelect函数代码示例

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


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

示例1: get_script_by_scriptid

function get_script_by_scriptid($scriptid)
{
    $sql = 'SELECT * FROM scripts WHERE scriptid=' . $scriptid;
    $rows = false;
    if ($res = DBSelect($sql)) {
        $rows = DBfetch($res);
    }
    return $rows;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:9,代码来源:scripts.inc.php

示例2: GetMun

function GetMun($GeoCod)
{
    $Reg = array();
    $Link = DBServerConnect();
    if ($Link !== FALSE) {
        DBSelect(cDBName);
        $SQL = "SELECT * FROM Municipios WHERE Geocodigo = {$GeoCod} LIMIT 1;";
        $ExeSQL = mysql_query($SQL);
        //  or die (mysql_error());;
        $Total = MySQLResults($ExeSQL);
        if ($Total > 0) {
            $Reg = mysql_fetch_array($ExeSQL);
        }
        DBServerDisconnect($Link);
    }
    return $Reg;
}
开发者ID:edilqueirozdearaujo,项目名称:mapa-municipios,代码行数:17,代码来源:proc.php

示例3: array

    // get items
    $data['hostPrototypes'] = API::HostPrototype()->get(array('discoveryids' => $data['parent_discoveryid'], 'output' => API_OUTPUT_EXTEND, 'selectTemplates' => array('templateid', 'name'), 'editable' => true, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1));
    order_result($data['hostPrototypes'], $sortField, $sortOrder);
    $data['paging'] = getPagingLine($data['hostPrototypes'], $sortOrder);
    // fetch templates linked to the prototypes
    $templateIds = array();
    foreach ($data['hostPrototypes'] as $hostPrototype) {
        $templateIds = array_merge($templateIds, zbx_objectValues($hostPrototype['templates'], 'templateid'));
    }
    $templateIds = array_unique($templateIds);
    $linkedTemplates = API::Template()->get(array('output' => array('templateid', 'name'), 'templateids' => $templateIds, 'selectParentTemplates' => array('hostid', 'name')));
    $data['linkedTemplates'] = zbx_toHash($linkedTemplates, 'templateid');
    // fetch source templates and LLD rules
    $hostPrototypeSourceIds = getHostPrototypeSourceParentIds(zbx_objectValues($data['hostPrototypes'], 'hostid'));
    if ($hostPrototypeSourceIds) {
        $hostPrototypeSourceTemplates = DBfetchArrayAssoc(DBSelect('SELECT h.hostid,h2.name,h2.hostid AS parent_hostid' . ' FROM hosts h,host_discovery hd,items i,hosts h2' . ' WHERE h.hostid=hd.hostid' . ' AND hd.parent_itemid=i.itemid' . ' AND i.hostid=h2.hostid' . ' AND ' . dbConditionInt('h.hostid', $hostPrototypeSourceIds)), 'hostid');
        foreach ($data['hostPrototypes'] as &$hostPrototype) {
            if ($hostPrototype['templateid']) {
                $sourceTemplate = $hostPrototypeSourceTemplates[$hostPrototypeSourceIds[$hostPrototype['hostid']]];
                $hostPrototype['sourceTemplate'] = array('hostid' => $sourceTemplate['parent_hostid'], 'name' => $sourceTemplate['name']);
                $sourceDiscoveryRuleId = get_realrule_by_itemid_and_hostid($discoveryRule['itemid'], $sourceTemplate['hostid']);
                $hostPrototype['sourceDiscoveryRuleId'] = $sourceDiscoveryRuleId;
            }
        }
        unset($hostPrototype);
    }
    // render view
    $itemView = new CView('configuration.host.prototype.list', $data);
    $itemView->render();
    $itemView->show();
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:host_prototypes.php

示例4: make_webmon_overview

function make_webmon_overview()
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST_GROUP, S_OK, S_FAILED, S_IN_PROGRESS, S_UNKNOWN));
    $sql = 'SELECT DISTINCT g.groupid, g.name ' . ' FROM httptest ht, applications a, groups g, hosts_groups hg ' . ' WHERE ' . DBcondition('hg.hostid', $available_hosts) . ' AND hg.hostid=a.hostid ' . ' AND g.groupid=hg.groupid ' . ' AND a.applicationid=ht.applicationid ' . ' AND ht.status=' . HTTPTEST_STATUS_ACTIVE . ' ORDER BY g.name';
    $host_groups = DBSelect($sql);
    while ($group = DBFetch($host_groups)) {
        $apps['ok'] = 0;
        $apps['failed'] = 0;
        $apps[HTTPTEST_STATE_BUSY] = 0;
        $apps[HTTPTEST_STATE_UNKNOWN] = 0;
        $sql = 'SELECT DISTINCT ht.httptestid, ht.curstate, ht.lastfailedstep ' . ' FROM httptest ht, applications a, hosts_groups hg, groups g ' . ' WHERE g.groupid=' . $group['groupid'] . ' AND hg.groupid=g.groupid ' . ' AND a.hostid=hg.hostid ' . ' AND ht.applicationid=a.applicationid ' . ' AND ht.status=' . HTTPTEST_STATUS_ACTIVE;
        $db_httptests = DBselect($sql);
        while ($httptest_data = DBfetch($db_httptests)) {
            if (HTTPTEST_STATE_BUSY == $httptest_data['curstate']) {
                $apps[HTTPTEST_STATE_BUSY]++;
            } else {
                if (HTTPTEST_STATE_IDLE == $httptest_data['curstate']) {
                    if ($httptest_data['lastfailedstep'] > 0) {
                        $apps['failed']++;
                    } else {
                        $apps['ok']++;
                    }
                } else {
                    $apps[HTTPTEST_STATE_UNKNOWN]++;
                }
            }
        }
        $table->addRow(array(is_show_all_nodes() ? get_node_name_by_elid($group['groupid']) : null, $group['name'], new CSpan($apps['ok'], 'off'), new CSpan($apps['failed'], $apps['failed'] ? 'on' : 'off'), new CSpan($apps[HTTPTEST_STATE_BUSY], $apps[HTTPTEST_STATE_BUSY] ? 'orange' : 'off'), new CSpan($apps[HTTPTEST_STATE_UNKNOWN], 'unknown')));
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:35,代码来源:blocks.inc.php

示例5: syncTemplates

 /**
  * Inherit template graphs from template to host.
  *
  * @param array $data
  *
  * @return bool
  */
 public function syncTemplates($data)
 {
     $data['templateids'] = zbx_toArray($data['templateids']);
     $data['hostids'] = zbx_toArray($data['hostids']);
     $dbLinks = DBSelect('SELECT ht.hostid,ht.templateid' . ' FROM hosts_templates ht' . ' WHERE ' . dbConditionInt('ht.hostid', $data['hostids']) . ' AND ' . dbConditionInt('ht.templateid', $data['templateids']));
     $linkage = array();
     while ($link = DBfetch($dbLinks)) {
         if (!isset($linkage[$link['templateid']])) {
             $linkage[$link['templateid']] = array();
         }
         $linkage[$link['templateid']][$link['hostid']] = 1;
     }
     $graphs = $this->get(array('hostids' => $data['templateids'], 'preservekeys' => true, 'output' => API_OUTPUT_EXTEND, 'selectGraphItems' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid'), 'filter' => array('flags' => null)));
     foreach ($graphs as $graph) {
         foreach ($data['hostids'] as $hostid) {
             if (isset($linkage[$graph['hosts'][0]['hostid']][$hostid])) {
                 $this->inherit($graph, $hostid);
             }
         }
     }
     return true;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:29,代码来源:CGraphPrototype.php

示例6: get_row_for_nofalseforb

function get_row_for_nofalseforb($row, $sql)
{
    $res_events = DBSelect($sql, 1);
    if (!($e_row = DBfetch($res_events))) {
        return false;
    } else {
        $row = array_merge($row, $e_row);
    }
    if ($row['value'] != TRIGGER_VALUE_TRUE && !event_initial_time($row)) {
        if (!($eventid = first_initial_eventid($row, 0))) {
            return false;
        }
        $sql = 'SELECT e.eventid, e.value' . ' FROM events e ' . ' WHERE e.eventid=' . $eventid . ' AND e.acknowledged=0';
        $res_events = DBSelect($sql, 1);
        if (!($e_row = DBfetch($res_events))) {
            return false;
        } else {
            $row = array_merge($row, $e_row);
        }
    }
    return $row;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:22,代码来源:triggers.inc.php

示例7: getHostPrototypeSourceParentIds

/**
 * Returns the farthest host prototype ancestor for each given host prototype.
 *
 * @param array $hostPrototypeIds
 * @param array $templateHostPrototypeIds	array with parent host prototype IDs as keys and arrays of child host
 * 											prototype IDs as values
 *
 * @return array	an array of child ID - ancestor ID pairs
 */
function getHostPrototypeSourceParentIds(array $hostPrototypeIds, array $templateHostPrototypeIds = array())
{
    $query = DBSelect('SELECT h.hostid,h.templateid' . ' FROM hosts h' . ' WHERE ' . dbConditionInt('h.hostid', $hostPrototypeIds) . ' AND h.templateid>0');
    $hostPrototypeIds = array();
    while ($hostPrototype = DBfetch($query)) {
        // check if we already have host prototype inherited from the current host prototype
        // if we do - move all of its child prototypes to the parent template
        if (isset($templateHostPrototypeIds[$hostPrototype['hostid']])) {
            $templateHostPrototypeIds[$hostPrototype['templateid']] = $templateHostPrototypeIds[$hostPrototype['hostid']];
            unset($templateHostPrototypeIds[$hostPrototype['hostid']]);
        } else {
            $templateHostPrototypeIds[$hostPrototype['templateid']][] = $hostPrototype['hostid'];
            $hostPrototypeIds[] = $hostPrototype['templateid'];
        }
    }
    // continue while we still have new host prototypes to check
    if ($hostPrototypeIds) {
        return getHostPrototypeSourceParentIds($hostPrototypeIds, $templateHostPrototypeIds);
    } else {
        // return an inverse hash with prototype IDs as keys and parent prototype IDs as values
        $result = array();
        foreach ($templateHostPrototypeIds as $templateId => $hostIds) {
            foreach ($hostIds as $hostId) {
                $result[$hostId] = $templateId;
            }
        }
        return $result;
    }
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:38,代码来源:hosts.inc.php

示例8: find

 /**
  * Returns the records that match the given criteria.
  *
  * @static
  *
  * @param string $tableName
  * @param array $criteria   An associative array of field-value pairs, where value can be either a single value
  *                          or an array (IN)
  *
  * @return array
  */
 public static function find($tableName, array $criteria = array())
 {
     // build the WHERE part
     $sqlWhere = array();
     foreach ($criteria as $field => $value) {
         // check if the table has this field
         if (!self::hasField($tableName, $field)) {
             self::exception(self::DBEXECUTE_ERROR, _s('Table "%1$s" doesn\'t have a field named "%2$s".', $tableName, $field));
         }
         $sqlWhere[] = dbConditionString($field, zbx_toArray($value));
     }
     // build query
     $sql = 'SELECT * FROM ' . $tableName;
     if ($sqlWhere) {
         $sql .= ' WHERE ' . implode(' AND ', $sqlWhere);
     }
     return DBfetchArray(DBSelect($sql));
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:29,代码来源:DB.php

示例9: DBSelect

	<caption>Resultados Concurso Planeta Linux 2007</caption>
	<thead>
		<tr>
			<th scope="col">Correo de Denunciante</th>
			<th scope="col">Puntos Acumulados</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th scope="row"></a></th>
			<td colspan="2"></td>									
		</tr>
	</tfoot>
	<tbody>		
       <?php 
$denunciantes = DBSelect("correo,puntos", "denunciantes", "", "Order by puntos DESC");
foreach ($denunciantes as $key => $denuncia) {
    echo "<tr class='odd'><th scope='row' id=denunciantes>" . $denuncia['correo'] . "</th>";
    echo " <td>" . $denuncia['puntos'] . "</td></tr>";
}
?>
  	</tbody>
	</table>	
	</div>
<?php 
require "footer.php";
?>
</body>
</html>

开发者ID:markuz,项目名称:planetalinux,代码行数:29,代码来源:resultados.php

示例10: checkDependencyParents

 /**
  * Check that none of the triggers have dependencies on their children. Checks only one level of inheritance, but
  * since it is called on each inheritance step, also works for multiple inheritance levels.
  *
  * @throws APIException     if at least one trigger is dependent on its child
  *
  * @param array $triggers
  */
 protected function checkDependencyParents(array $triggers)
 {
     // fetch all templated dependency trigger parents
     $depTriggerIds = array();
     foreach ($triggers as $trigger) {
         foreach ($trigger['dependencies'] as $depTriggerId) {
             $depTriggerIds[$depTriggerId] = $depTriggerId;
         }
     }
     $parentDepTriggers = DBfetchArray(DBSelect('SELECT templateid,triggerid' . ' FROM triggers' . ' WHERE templateid>0' . ' AND ' . dbConditionInt('triggerid', $depTriggerIds)));
     if ($parentDepTriggers) {
         $parentDepTriggers = zbx_toHash($parentDepTriggers, 'triggerid');
         foreach ($triggers as $trigger) {
             foreach ($trigger['dependencies'] as $depTriggerId) {
                 // check if the current trigger is the parent of the dependency trigger
                 if (isset($parentDepTriggers[$depTriggerId]) && $parentDepTriggers[$depTriggerId]['templateid'] == $trigger['triggerid']) {
                     self::exception(ZBX_API_ERROR_PARAMETERS, _s('Trigger cannot be dependent on a trigger that is inherited from it.'));
                 }
             }
         }
     }
 }
开发者ID:itnihao,项目名称:Zabbix_,代码行数:30,代码来源:CTrigger.php

示例11: get_regexp_form

function get_regexp_form()
{
    $frm_title = S_REGULAR_EXPRESSION;
    if (isset($_REQUEST['regexpid']) && !isset($_REQUEST["form_refresh"])) {
        $sql = 'SELECT re.* ' . ' FROM regexps re ' . ' WHERE ' . DBin_node('re.regexpid') . ' AND re.regexpid=' . $_REQUEST['regexpid'];
        $regexp = DBfetch(DBSelect($sql));
        $frm_title .= ' [' . $regexp['name'] . ']';
        $rename = $regexp['name'];
        $test_string = $regexp['test_string'];
        $expressions = array();
        $sql = 'SELECT e.* ' . ' FROM expressions e ' . ' WHERE ' . DBin_node('e.expressionid') . ' AND e.regexpid=' . $regexp['regexpid'] . ' ORDER BY e.expression_type';
        $db_exps = DBselect($sql);
        while ($exp = DBfetch($db_exps)) {
            $expressions[] = $exp;
        }
    } else {
        $rename = get_request('rename', '');
        $test_string = get_request('test_string', '');
        $expressions = get_request('expressions', array());
    }
    $tblRE = new CTable('', 'nowrap');
    $tblRE->addStyle('border-left: 1px #AAA solid; border-right: 1px #AAA solid; background-color: #EEE; padding: 2px; padding-left: 6px; padding-right: 6px;');
    $tblRE->addRow(array(S_NAME, new CTextBox('rename', $rename, 60)));
    $tblRE->addRow(array(S_TEST_STRING, new CTextArea('test_string', $test_string, 66, 5)));
    $tabExp = new CTableInfo();
    $td1 = new CCol(S_EXPRESSION);
    $td1->addStyle('background-color: #CCC;');
    $td2 = new CCol(S_EXPECTED_RESULT);
    $td2->addStyle('background-color: #CCC;');
    $td3 = new CCol(S_RESULT);
    $td3->addStyle('background-color: #CCC;');
    $tabExp->setHeader(array($td1, $td2, $td3));
    $final_result = !empty($test_string);
    foreach ($expressions as $id => $expression) {
        $results = array();
        $paterns = array($expression['expression']);
        if (!empty($test_string)) {
            if ($expression['expression_type'] == EXPRESSION_TYPE_ANY_INCLUDED) {
                $paterns = explode($expression['exp_delimiter'], $expression['expression']);
            }
            if (uint_in_array($expression['expression_type'], array(EXPRESSION_TYPE_TRUE, EXPRESSION_TYPE_FALSE))) {
                if ($expression['case_sensitive']) {
                    $results[$id] = ereg($paterns[0], $test_string);
                } else {
                    $results[$id] = eregi($paterns[0], $test_string);
                }
                if ($expression['expression_type'] == EXPRESSION_TYPE_TRUE) {
                    $final_result &= $results[$id];
                } else {
                    $final_result &= !$results[$id];
                }
            } else {
                $results[$id] = true;
                $tmp_result = false;
                if ($expression['case_sensitive']) {
                    foreach ($paterns as $pid => $patern) {
                        $tmp_result |= zbx_stristr($test_string, $patern) !== false;
                    }
                } else {
                    foreach ($paterns as $pid => $patern) {
                        $tmp_result |= zbx_strstr($test_string, $patern) !== false;
                    }
                }
                $results[$id] &= $tmp_result;
                $final_result &= $results[$id];
            }
        }
        if (isset($results[$id]) && $results[$id]) {
            $exp_res = new CSpan(S_TRUE_BIG, 'green bold');
        } else {
            $exp_res = new CSpan(S_FALSE_BIG, 'red bold');
        }
        $expec_result = expression_type2str($expression['expression_type']);
        if (EXPRESSION_TYPE_ANY_INCLUDED == $expression['expression_type']) {
            $expec_result .= ' (' . S_DELIMITER . "='" . $expression['exp_delimiter'] . "')";
        }
        $tabExp->addRow(array($expression['expression'], $expec_result, $exp_res));
    }
    $td = new CCol(S_COMBINED_RESULT, 'bold');
    $td->setColSpan(2);
    if ($final_result) {
        $final_result = new CSpan(S_TRUE_BIG, 'green bold');
    } else {
        $final_result = new CSpan(S_FALSE_BIG, 'red bold');
    }
    $tabExp->addRow(array($td, $final_result));
    $tblRE->addRow(array(S_RESULT, $tabExp));
    $tblFoot = new CTableInfo(null);
    $td = new CCol(array(new CButton('save', S_SAVE)));
    $td->setColSpan(2);
    $td->addStyle('text-align: right;');
    $td->addItem(SPACE);
    $td->addItem(new CButton('test', S_TEST));
    if (isset($_REQUEST['regexpid'])) {
        $td->addItem(SPACE);
        $td->addItem(new CButton('clone', S_CLONE));
        $td->addItem(SPACE);
        $td->addItem(new CButtonDelete(S_DELETE_REGULAR_EXPRESSION_Q, url_param('form') . url_param('config') . url_param('regexpid')));
    }
    $td->addItem(SPACE);
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php

示例12: addUserHistory

function addUserHistory($title, $url)
{
    $userId = CWebUser::$data['userid'];
    $history5 = DBfetch(DBSelect('SELECT uh.title5,uh.url5' . ' FROM user_history uh' . ' WHERE uh.userid=' . $userId));
    if ($history5) {
        if ($history5['title5'] === $title) {
            if ($history5['url5'] === $url) {
                return true;
            } else {
                $sql = 'UPDATE user_history SET url5=' . zbx_dbstr($url) . ' WHERE userid=' . $userId;
            }
        } else {
            $sql = 'UPDATE user_history' . ' SET title1=title2,' . ' url1=url2,' . ' title2=title3,' . ' url2=url3,' . ' title3=title4,' . ' url3=url4,' . ' title4=title5,' . ' url4=url5,' . ' title5=' . zbx_dbstr($title) . ',' . ' url5=' . zbx_dbstr($url) . ' WHERE userid=' . $userId;
        }
    } else {
        $userHistoryId = get_dbid('user_history', 'userhistoryid');
        $sql = 'INSERT INTO user_history (userhistoryid, userid, title5, url5)' . ' VALUES(' . $userHistoryId . ', ' . $userId . ', ' . zbx_dbstr($title) . ', ' . zbx_dbstr($url) . ')';
    }
    return DBexecute($sql);
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:20,代码来源:profiles.inc.php

示例13: fetchLatestValues

 /**
  * Returns the value of the latest service alarm before the given time.
  *
  * @param array $serviceIds
  * @param int $beforeTime
  *
  * @return array
  */
 protected function fetchLatestValues(array $serviceIds, $beforeTime)
 {
     // the query will return the alarms with the maximum timestamp for each service
     // since multiple alarms can have the same timestamp, we only need to save the last one
     $query = DBSelect('SELECT sa.serviceid,sa.value' . ' FROM (SELECT MAX(sa3.servicealarmid) AS servicealarmid' . ' FROM (SELECT sa2.serviceid,MAX(sa2.clock) AS clock' . ' FROM service_alarms sa2' . ' WHERE sa2.clock<' . zbx_dbstr($beforeTime) . ' AND ' . dbConditionInt('sa2.serviceid', $serviceIds) . ' GROUP BY sa2.serviceid) ss' . ' JOIN service_alarms sa3 ON sa3.serviceid = ss.serviceid and sa3.clock = ss.clock' . ' GROUP BY sa3.serviceid) ss2' . ' JOIN service_alarms sa ON sa.servicealarmid = ss2.servicealarmid');
     $rs = array();
     while ($alarm = DBfetch($query)) {
         $rs[$alarm['serviceid']] = $alarm['value'];
     }
     return $rs;
 }
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:19,代码来源:CService.php

示例14: array

$fields = array('regexpids' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'regexpid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&({form}=="update")'), 'rename' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Name')), 'test_string' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})', _('Test string')), 'delete_regexp' => array(T_ZBX_STR, O_OPT, null, null, null), 'g_expressionid' => array(T_ZBX_INT, O_OPT, null, DB_ID, null), 'expressions' => array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'), 'new_expression' => array(T_ZBX_STR, O_OPT, null, null, null), 'cancel_new_expression' => array(T_ZBX_STR, O_OPT, null, null, null), 'add_expression' => array(T_ZBX_STR, O_OPT, null, null, null), 'edit_expressionid' => array(T_ZBX_STR, O_OPT, null, null, null), 'delete_expression' => array(T_ZBX_STR, O_OPT, null, null, null), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'delete' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'clone' => array(T_ZBX_STR, O_OPT, null, null, null), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
/*
 * Permissions
 */
if (isset($_REQUEST['regexpid'])) {
    $regExp = DBfetch(DBSelect('SELECT re.regexpid FROM regexps re WHERE re.regexpid=' . get_request('regexpid')));
    if (empty($regExp)) {
        access_deny();
    }
}
if (isset($_REQUEST['go']) && !isset($_REQUEST['regexpid'])) {
    if (!isset($_REQUEST['regexpids']) || !is_array($_REQUEST['regexpids'])) {
        access_deny();
    } else {
        $regExpChk = DBfetch(DBSelect('SELECT COUNT(*) AS cnt FROM regexps re WHERE ' . dbConditionInt('re.regexpid', $_REQUEST['regexpids'])));
        if ($regExpChk['cnt'] != count($_REQUEST['regexpids'])) {
            access_deny();
        }
    }
}
/*
 * Actions
 */
if (isset($_REQUEST['clone']) && isset($_REQUEST['regexpid'])) {
    unset($_REQUEST['regexpid']);
    $_REQUEST['form'] = 'clone';
} elseif (isset($_REQUEST['cancel_new_expression'])) {
    unset($_REQUEST['new_expression']);
} elseif (isset($_REQUEST['save'])) {
    $regExp = array('name' => $_REQUEST['rename'], 'test_string' => $_REQUEST['test_string']);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:adm.regexps.php

示例15: get_screen

function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
    global $USER_DETAILS;
    if ($screenid == 0) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    $r = CScreen::get(array('screenids' => $screenid, 'editable' => $editmode == 1 ? 1 : null, 'output' => API_OUTPUT_SHORTEN));
    if (empty($r)) {
        access_deny();
    }
    if (is_null($effectiveperiod)) {
        $effectiveperiod = ZBX_MIN_PERIOD;
    }
    $result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
    $row = DBfetch($result);
    if (!$row) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    $sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid;
    $iresult = DBSelect($sql);
    $skip_field = array();
    $irows = array();
    while ($irow = DBfetch($iresult)) {
        $irows[] = $irow;
        for ($i = 0; $i < $irow['rowspan'] || $i == 0; $i++) {
            for ($j = 0; $j < $irow['colspan'] || $j == 0; $j++) {
                if ($i != 0 || $j != 0) {
                    if (!isset($skip_field[$irow['y'] + $i])) {
                        $skip_field[$irow['y'] + $i] = array();
                    }
                    $skip_field[$irow['y'] + $i][$irow['x'] + $j] = 1;
                }
            }
        }
    }
    $table = new CTable(new CLink(S_NO_ROWS_IN_SCREEN . SPACE . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
    $table->setAttribute('id', 'iframe');
    if ($editmode == 1) {
        $new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        for ($c = 0; $c < $row['hsize'] + 1; $c++) {
            $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_col={$c}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        $table->addRow($new_cols);
    }
    $empty_screen_col = array();
    for ($r = 0; $r < $row['vsize']; $r++) {
        $new_cols = array();
        $empty_screen_row = true;
        if ($editmode == 1) {
            $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_row={$r}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        for ($c = 0; $c < $row['hsize']; $c++) {
            $item = array();
            if (isset($skip_field[$r][$c])) {
                continue;
            }
            $item_form = false;
            $irow = false;
            foreach ($irows as $tmprow) {
                if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
                    $irow = $tmprow;
                    break;
                }
            }
            if ($irow) {
                $screenitemid = $irow['screenitemid'];
                $resourcetype = $irow['resourcetype'];
                $resourceid = $irow['resourceid'];
                $width = $irow['width'];
                $height = $irow['height'];
                $colspan = $irow['colspan'];
                $rowspan = $irow['rowspan'];
                $elements = $irow['elements'];
                $valign = $irow['valign'];
                $halign = $irow['halign'];
                $style = $irow['style'];
                $url = $irow['url'];
                $dynamic = $irow['dynamic'];
            } else {
                $screenitemid = 0;
                $resourcetype = 0;
                $resourceid = 0;
                $width = 0;
                $height = 0;
                $colspan = 0;
                $rowspan = 0;
                $elements = 0;
                $valign = VALIGN_DEFAULT;
                $halign = HALIGN_DEFAULT;
                $style = 0;
                $url = '';
                $dynamic = 0;
            }
            if ($screenitemid > 0) {
                $empty_screen_row = false;
                $empty_screen_col[$c] = 1;
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:screens.inc.php


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