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


PHP dbFetchAll函数代码示例

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


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

示例1: addEventToZip

function addEventToZip($eid, $mid, $zip)
{
    $query = "SELECT Id, MonitorId, StartTime, Frames FROM Events WHERE Id={$eid}";
    $results = dbFetchAll($query);
    $scale = max(reScale(SCALE_BASE, '100', ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
    foreach ($results as $result) {
        for ($counter = 1; $counter <= $result['Frames']; $counter++) {
            $event['Id'] = $result['Id'];
            $event['StartTime'] = $result['StartTime'];
            $event['MonitorId'] = $result['MonitorId'];
            $imageData = getImageSrc($event, $counter, $scale, isset($_REQUEST['show']) && $_REQUEST['show'] == "capt");
            $imagePath = $imageData['thumbPath'];
            $eventPath = $imageData['eventPath'];
            $dImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-d.jpg", $eventPath, $counter);
            $rImagePath = sprintf("%s/%0" . ZM_EVENT_IMAGE_DIGITS . "d-diag-r.jpg", $eventPath, $counter);
            $frames[] = viewImagePath($imagePath);
        }
        $zip->addDirectory("events/" . $event['MonitorId']);
        $zip->addDirectory("events/" . $event['MonitorId'] . "/" . $event['Id']);
    }
    $i = 0;
    $filesString = "";
    foreach ($frames as $frame) {
        $i++;
        $filesName = sprintf("%0" . ZM_EVENT_IMAGE_DIGITS . "d-capture.jpg", $i);
        $filesString .= "\nframes.push(\"events/" . $mid . "/" . $eid . "/" . $filesName . "\");";
        $zip->addLargeFile($frame, "events/" . $mid . "/" . $eid . "/" . $filesName);
    }
    return $filesString;
}
开发者ID:OverByThere,项目名称:modern,代码行数:30,代码来源:exportevents.php

示例2: find

 public static function find($parameters = array(), $limit = NULL)
 {
     $sql = 'SELECT * FROM Servers';
     $values = array();
     if (sizeof($parameters)) {
         $sql .= ' WHERE ' . implode(' AND ', array_map(function ($v) {
             return $v . '=?';
         }, array_keys($parameters)));
         $values = array_values($parameters);
     }
     if ($limit) {
         $sql .= ' LIMIT ' . $limit;
     }
     $results = dbFetchAll($sql, NULL, $values);
     if ($results) {
         return array_map(function ($id) {
             return new Server($id);
         }, $results);
     }
 }
开发者ID:schrorg,项目名称:ZoneMinder,代码行数:20,代码来源:Server.php

示例3: getAccountingCategory

 function getAccountingCategory($selInfo)
 {
     $sql = "Select c.category_id,category_name,b.category_detail_id,b.category_detail_name,sum(money) as money from " . $this->table['consumeDetail'] . " a,accounting.consume_category_detail b,accounting.consume_category c Where uid = " . $selInfo['userid'] . " and consume_date >= '" . $selInfo['start_date'] . "' and consume_date <= '" . $selInfo['end_date'] . "'" . " and a.category_detail_id = b.category_detail_id and b.category_id = c.category_id group by c.category_id,category_name,b.category_detail_id,b.category_detail_name Order by money desc";
     try {
         $categoryRet = dbFetchAll($this->DB, $sql);
         foreach ($categoryRet as $v) {
             $categoryMoney[$v['category_id']]['category_name'] = $v['category_name'];
             $categoryMoney[$v['category_id']]['category_id'] = $v['category_id'];
             if (!isset($categoryMoney[$v['category_id']]['category_detail'])) {
                 $categoryMoney[$v['category_id']]['category_detail'] = array();
             }
             array_push($categoryMoney[$v['category_id']]['category_detail'], array('category_detail_name' => $v['category_detail_name'], 'category_detail_id' => $v['category_detail_id'], 'money' => $v['money']));
             //[$v['category_detail_id']]['money'] = $v['money'];
             // $categoryMoney[$v['category_id']]['category_detail'][$v['category_detail_id']]['category_detail_name'] = $v['category_detail_name'];
             $categoryMoney[$v['category_id']]['money'] += $v['money'];
         }
     } catch (PDOException $e) {
     }
     foreach ($categoryMoney as $category_id => $v) {
         $money[$category_id] = $v['money'];
     }
     array_multisort($money, SORT_DESC, $categoryMoney);
     return array('status' => 200, 'data' => $categoryMoney);
 }
开发者ID:richiehu,项目名称:mini_accounting,代码行数:24,代码来源:user.php

示例4: controlPresets

function controlPresets($monitor, $cmds)
{
    global $SLANG;
    define("MAX_PRESETS", "12");
    $sql = "select * from ControlPresets where MonitorId = '" . $monitor['Id'] . "'";
    $labels = array();
    foreach (dbFetchAll($sql) as $row) {
        $labels[$row['Preset']] = $row['Label'];
    }
    $presetBreak = (int) (($monitor['NumPresets'] + 1) / ((int) (($monitor['NumPresets'] - 1) / MAX_PRESETS) + 1));
    ob_start();
    ?>
<div class="presetControls">
  <!--<div><?php 
    echo $SLANG['Presets'];
    ?>
</div>-->
  <div>
<?php 
    for ($i = 1; $i <= $monitor['NumPresets']; $i++) {
        ?>
<input type="button" class="ptzNumBtn" title="<?php 
        echo isset($labels[$i]) ? $labels[$i] : "";
        ?>
" value="<?php 
        echo $i;
        ?>
" onclick="controlCmd('<?php 
        echo $cmds['PresetGoto'];
        echo $i;
        ?>
');"/><?php 
        if ($i && $i % $presetBreak == 0) {
            ?>
<br/><?php 
        }
    }
    ?>
  </div>
  <div>
<?php 
    if ($monitor['HasHomePreset']) {
        ?>
    <input type="button" class="ptzTextBtn" value="<?php 
        echo $SLANG['Home'];
        ?>
" onclick="controlCmd('<?php 
        echo $cmds['PresetHome'];
        ?>
');"/>
<?php 
    }
    if (canEdit('Monitors') && $monitor['CanSetPresets']) {
        ?>
    <input type="button" class="ptzTextBtn" value="<?php 
        echo $SLANG['Set'];
        ?>
" onclick="createPopup( '?view=controlpreset&mid=<?php 
        echo $monitor['Id'];
        ?>
', 'zmPreset', 'preset' );"/>
<?php 
    }
    ?>
  </div>
</div>
<?php 
    return ob_get_clean();
}
开发者ID:mondychan,项目名称:modern,代码行数:69,代码来源:control_functions.php

示例5: array

// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
$sql = "select * from Groups order by Name";
$groups = array();
$selected = false;
foreach (dbFetchAll($sql) as $row) {
    if (!empty($_COOKIE['zmGroup']) && $row['Id'] == $_COOKIE['zmGroup']) {
        $row['selected'] = true;
        $selected = true;
    } else {
        $row['selected'] = false;
    }
    $groups[] = $row;
}
xhtmlHeaders(__FILE__, translate('Groups'));
?>
<body>
  <div id="page">
    <div id="header">
      <h2><?php 
echo translate('Groups');
开发者ID:ralfoide,项目名称:ZoneMinder,代码行数:31,代码来源:groups.php

示例6: Fatal

         $exportExt = "html";
         break;
     case 'xml':
         $exportExt = "xml";
         break;
     default:
         Fatal("Unrecognised log export format '{$format}'");
 }
 $exportKey = substr(md5(rand()), 0, 8);
 $exportFile = "zm-log.{$exportExt}";
 $exportPath = ZM_PATH_SWAP . "/zm-log-{$exportKey}.{$exportExt}";
 if (!($exportFP = fopen($exportPath, "w"))) {
     Fatal("Unable to open log export file {$exportPath}");
 }
 $logs = array();
 foreach (dbFetchAll($sql, NULL, $values) as $log) {
     $log['DateTime'] = preg_replace('/^\\d+/', strftime("%Y-%m-%d %H:%M:%S", intval($log['TimeKey'])), $log['TimeKey']);
     $logs[] = $log;
 }
 switch ($format) {
     case 'text':
         foreach ($logs as $log) {
             if ($log['Line']) {
                 fprintf($exportFP, "%s %s[%d].%s-%s/%d [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Line'], $log['Message']);
             } else {
                 fprintf($exportFP, "%s %s[%d].%s-%s [%s]\n", $log['DateTime'], $log['Component'], $log['Pid'], $log['Code'], $log['File'], $log['Message']);
             }
         }
         break;
     case 'tsv':
         fprintf($exportFP, translate('DateTime') . "\t" . translate('Component') . "\t" . translate('Pid') . "\t" . translate('Level') . "\t" . translate('Message') . "\t" . translate('File') . "\t" . translate('Line') . "\n");
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:log.php

示例7: module_cfg_install_db


//.........这里部分代码省略.........
            list($_host, $_port) = explode(':', $params['xlite_http_host']);
        } else {
            $_host = $params['xlite_http_host'];
        }
        if (!$_host) {
            fatal_error(xtr('The web server name and/or web drectory is invalid (:host). Press \'BACK\' button and review web server settings you provided', array(':host' => $_host)), 'params', 'wrong web server or webdir');
            $checkError = true;
            // Check if database settings provided are valid
        } else {
            $connection = dbConnect($params, $pdoErrorMsg);
            if (!$connection && preg_match('/SQLSTATE.*\\[1049\\].*' . preg_quote($params['mysqlbase']) . '/', $pdoErrorMsg)) {
                // The specified database not found, try to create
                x_install_log('The specified database "' . $params['mysqlbase'] . '" not found');
                $paramsNoDb = $params;
                unset($paramsNoDb['mysqlbase']);
                $pdoErrorMsg = null;
                $connection = dbConnect($paramsNoDb, $pdoErrorMsg);
                if ($connection) {
                    $pdoErrorMsg = null;
                    dbExecute('CREATE DATABASE `' . $params['mysqlbase'] . '`;', $pdoErrorMsg);
                    if (empty($pdoErrorMsg)) {
                        x_install_log('The database "' . $params['mysqlbase'] . '" successfully created.');
                        // Reconnect...
                        $connection = dbConnect($params, $pdoErrorMsg);
                    } else {
                        $connection = null;
                        x_install_log('The database "' . $params['mysqlbase'] . '" cannot be created: ' . $pdoErrorMsg);
                        fatal_error_extended(xtr('The database <i>:dbname</i> cannot be created automatically:pdoerr.<br /> Please go back, create it manually and then proceed with the installation process again.', array(':dbname' => $params['mysqlbase'], ':pdoerr' => ': ' . $pdoErrorMsg)), 'pdo', @$pdoErrorMsg, xtr('kb_note_mysql_issue'));
                        $checkError = true;
                    }
                }
            }
            if ($connection) {
                $isDBConnected = true;
                $requirements = doCheckRequirements();
                // Check MySQL version
                $mysqlVersionErr = $currentMysqlVersion = '';
                if (!checkMysqlVersion($mysqlVersionErr, $currentMysqlVersion, true)) {
                    fatal_error_extended($mysqlVersionErr . (!empty($currentMysqlVersion) ? '<br />(current version is ' . $currentMysqlVersion . ')' : ''), 'reqs', 'mysql version', xtr('kb_note_mysql_issue'));
                    $checkError = true;
                }
                // Check if config.php file is writeable
                if (!$checkError && !@is_writable(LC_DIR_CONFIG . constant('LC_CONFIG_FILE'))) {
                    fatal_error(xtr('Cannot open file \':filename\' for writing. To install the software, please correct the problem and start the installation again...', array(':filename' => constant('LC_CONFIG_FILE'))), 'file', 'config write failed');
                    $checkError = true;
                } elseif (!$checkError) {
                    // Check if X-Cart tables is already exists
                    $mystring = '';
                    $first = true;
                    $res = dbFetchAll('SHOW TABLES LIKE \'' . get_db_tables_prefix() . '%\'');
                    if (is_array($res)) {
                        foreach ($res as $row) {
                            if (in_array(get_db_tables_prefix() . 'products', $row)) {
                                warning_error(xtr('Installation Wizard has detected X-Cart tables'), 're-install');
                                $checkWarning = true;
                                break;
                            }
                        }
                    }
                }
            } elseif (!$checkError) {
                preg_match('/SQLSTATE.*\\[(\\d+)\\].*/', $pdoErrorMsg, $match);
                $code = intval(!empty($match[1]) ? $match[1] : 0);
                if ('1045' == $code) {
                    fatal_error_extended(xtr('pdo-error-1045', array(':pdoerr' => !empty($pdoErrorMsg) ? $pdoErrorMsg : '')), 'pdo', @$pdoErrorMsg, xtr('kb_note_mysql_issue'));
                } elseif ('1044' == $code) {
                    fatal_error_extended(xtr('pdo-error-1044', array(':dbuser' => $params['mysqluser'], ':dbname' => $params['mysqlbase'], ':pdoerr' => !empty($pdoErrorMsg) ? $pdoErrorMsg : '')), 'pdo', @$pdoErrorMsg, xtr('kb_note_mysql_issue'));
                } elseif ('2005' == $code) {
                    fatal_error_extended(xtr('pdo-error-2005', array(':pdoerr' => !empty($pdoErrorMsg) ? $pdoErrorMsg : '')), 'pdo', @$pdoErrorMsg, xtr('kb_note_mysql_issue'));
                } else {
                    fatal_error_extended(xtr('pdo-error-common', array(':pdoerr' => !empty($pdoErrorMsg) ? $pdoErrorMsg : '')), 'pdo', @$pdoErrorMsg, xtr('kb_note_mysql_issue'));
                }
                $checkError = true;
            }
        }
        if (!$checkError && !$checkWarning) {
            global $autoPost;
            $autoPost = true;
        } else {
            $output = '';
        }
        $error = $checkError;
    }
    ?>

<?php 
    echo $messageText;
    ?>

<table width="100%" border="0" cellpadding="10">

<?php 
    echo $output;
    ?>

</table>

<?php 
    return $displayConfigForm;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:101,代码来源:install.php

示例8: collectData


//.........这里部分代码省略.........
        }
        foreach ($_REQUEST['element'] as $element) {
            if (!($elementData = $lc_elements[strtolower($element)])) {
                ajaxError("Bad " . validJsStr($_REQUEST['entity']) . " element " . $element);
            }
            if (isset($elementData['func'])) {
                $data[$element] = eval("return( " . $elementData['func'] . " );");
            } else {
                if (isset($elementData['postFunc'])) {
                    $postFuncs[$element] = $elementData['postFunc'];
                } else {
                    if (isset($elementData['zmu'])) {
                        $data[$element] = exec(escapeshellcmd(getZmuCommand(" " . $elementData['zmu'])));
                    } else {
                        if (isset($elementData['sql'])) {
                            $fieldSql[] = $elementData['sql'] . " as " . $element;
                        } else {
                            $fieldSql[] = $element;
                        }
                        if (isset($elementData['table']) && isset($elementData['join'])) {
                            $joinSql[] = "left join " . $elementData['table'] . " on " . $elementData['join'];
                        }
                        if (isset($elementData['group'])) {
                            $groupSql[] = $elementData['group'];
                        }
                    }
                }
            }
        }
        if (count($fieldSql)) {
            $sql = "select " . join(", ", $fieldSql) . " from " . $entitySpec['table'];
            if ($joinSql) {
                $sql .= " " . join(" ", array_unique($joinSql));
            }
            if ($id && !empty($entitySpec['selector'])) {
                $index = 0;
                $where = array();
                $values = array();
                foreach ($entitySpec['selector'] as $selector) {
                    if (is_array($selector)) {
                        $where[] = $selector['selector'] . ' = ?';
                        $values[] = validInt($id[$index]);
                    } else {
                        $where[] = $selector . ' = ?';
                        $values[] = validInt($id[$index]);
                    }
                    $index++;
                }
                $sql .= " where " . join(" and ", $where);
            }
            if ($groupSql) {
                $sql .= " group by " . join(",", array_unique($groupSql));
            }
            if (!empty($_REQUEST['sort'])) {
                $arr = explode(' ', $_REQUEST['sort']);
                $col = validCol($arr[0]);
                $dir = "";
                if (count($arr) == 2) {
                    if ($arr[1] == "desc") {
                        $dir = $arr[1];
                    }
                }
                $sql .= " order by {$col} {$dir}";
            }
            if (!empty($entitySpec['limit'])) {
                $limit = $entitySpec['limit'];
            } elseif (!empty($_REQUEST['count'])) {
                $limit = validInt($_REQUEST['count']);
            }
            $limit_offset = "";
            if (!empty($_REQUEST['offset'])) {
                $limit_offset = validInt($_REQUEST['offset']) . ", ";
            }
            if (!empty($limit)) {
                $sql .= " limit " . $limit_offset . $limit;
            }
            if (isset($limit) && $limit == 1) {
                if ($sqlData = dbFetchOne($sql, NULL, $values)) {
                    foreach ($postFuncs as $element => $func) {
                        $sqlData[$element] = eval('return( ' . $func . '( $sqlData ) );');
                    }
                    $data = array_merge($data, $sqlData);
                }
            } else {
                $count = 0;
                foreach (dbFetchAll($sql, NULL, $values) as $sqlData) {
                    foreach ($postFuncs as $element => $func) {
                        $sqlData[$element] = eval('return( ' . $func . '( $sqlData ) );');
                    }
                    $data[] = $sqlData;
                    if (isset($limi) && ++$count >= $limit) {
                        break;
                    }
                }
            }
        }
    }
    #print_r( $data );
    return $data;
}
开发者ID:bill-mcgonigle,项目名称:ZoneMinder,代码行数:101,代码来源:status.php

示例9: elseif

                    $camera['monitor']['Port'] = $matches[2];
                } elseif ($matches[1] == 'network_rtsp_s0_accessname') {
                    $camera['monitor']['Path'] = $matches[2];
                }
            }
        }
    }
    return $camera;
}
function probeWansview($ip)
{
    $camera = array('model' => "Wansview Camera", 'monitor' => array('Type' => 'Remote', 'Protocol' => 'http', 'Host' => 'admin:123456@' . $ip, 'Port' => 80, 'Path' => 'videostream.cgi', 'Width' => 640, 'Height' => 480, 'Palette' => 3));
    return $camera;
}
$monitors = array();
foreach (dbFetchAll("select Id, Name, Host from Monitors where Type = 'Remote' order by Host") as $monitor) {
    if (preg_match('/^(.+)@(.+)$/', $monitor['Host'], $matches)) {
        //echo "1: ".$matches[2]." = ".gethostbyname($matches[2])."<br/>";
        $monitors[gethostbyname($matches[2])] = $monitor;
    } else {
        //echo "2: ".$monitor['Host']." = ".gethostbyname($monitor['Host'])."<br/>";
        $monitors[gethostbyname($monitor['Host'])] = $monitor;
    }
}
$macBases = array('00:40:8c' => array('type' => 'Axis', 'probeFunc' => 'probeAxis'), '00:80:f0' => array('type' => 'Panasonic', 'probeFunc' => 'probePana'), '00:0f:7c' => array('type' => 'ACTi', 'probeFunc' => 'probeACTi'), '00:02:d1' => array('type' => 'Vivotek', 'probeFunc' => 'probeVivotek'), '7c:dd:90' => array('type' => 'Wansview', 'probeFunc' => 'probeWansview'), '78:a5:dd' => array('type' => 'Wansview', 'probeFunc' => 'probeWansview'));
unset($output);
// Calling arp without the full path was reported to fail on some systems
// Use the builtin unix command "type" to tell us where the command is
$arp_command = '';
$result = explode(" ", ZM_PATH_ARP);
if (!is_executable($result[0])) {
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:monitorprobe.php

示例10: xhtmlHeaders


//.........这里部分代码省略.........
        <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/jquery.cookie.js"></script>
        <?php 
        if ($title == "Events" || $title == "Console") {
            ?>
            <script src="skins/<?php 
            echo $skin;
            ?>
/views/assets/js/admin.js"></script>
            <link rel="stylesheet" href="skins/<?php 
            echo $skin;
            ?>
/views/assets/css/admin.css">
      <?php 
        }
    }
    ?>

      <?php 
    if ($view == "playback" || ($view = "events")) {
        ?>
          <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/moment.min.js"></script>
      <?php 
    }
    if ($view == "playback") {
        ?>
          <style type="text/css">
          <?php 
        foreach (dbFetchAll("SELECT Monitors.Id, Monitors.WebColour FROM Monitors") as $monitor) {
            echo ".timeline-event.monitor" . $monitor['Id'] . " { background: " . $monitor['WebColour'] . "; }\n";
            echo "#monitor-stream-" . $monitor['Id'] . " .fa-stop { color: " . $monitor['WebColour'] . "; }\n";
        }
        ?>
          </style>
          <link rel="stylesheet" href="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/timeline/timeline.css" type="text/css" media="screen"/>
          <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/timeline/timeline-min.js"></script>
          <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/jquery.mousewheel.js"></script>
          <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/jquery.panzoom.min.js"></script>
          <script src="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/js/jquery.capty.min.js"></script>
          <link rel="stylesheet" href="skins/<?php 
        echo $skin;
        ?>
/views/assets/vendor/css/jquery.capty.min.css">
      <?php 
    }
    ?>
开发者ID:OverByThere,项目名称:modern,代码行数:67,代码来源:functions.php

示例11: dbEscape

// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
if (!canView('Events')) {
    $view = "error";
    return;
}
$sql = "select E.*,M.Name as MonitorName,M.Width,M.Height from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = '" . dbEscape($_REQUEST['eid']) . "'";
$event = dbFetchOne($sql);
$sql = "select *, unix_timestamp( TimeStamp ) as UnixTimeStamp from Frames where EventID = '" . dbEscape($_REQUEST['eid']) . "' order by FrameId";
$frames = dbFetchAll($sql);
$focusWindow = true;
xhtmlHeaders(__FILE__, $SLANG['Frames'] . " - " . $event['Id']);
?>
<body>
  <div id="page">
    <div id="header">
      <div id="headerButtons"><a href="#" onclick="closeWindow();"><?php 
echo $SLANG['Close'];
?>
</a></div>
      <h2><?php 
echo $SLANG['Frames'];
?>
 - <?php 
echo $event['Id'];
开发者ID:ardiqghenatya,项目名称:koptel2,代码行数:31,代码来源:frames.php

示例12: validInt

if (isset($_REQUEST['eid'])) {
    $mode = 'single';
    $eid = validInt($_REQUEST['eid']);
    $newEvent = dbFetchOne('SELECT E.* FROM Events AS E WHERE E.Id = ?', NULL, array($eid));
} elseif (isset($_REQUEST['eids'])) {
    $mode = 'multi';
    $sql = 'SELECT E.* FROM Events AS E WHERE ';
    $sqlWhere = array();
    $sqlValues = array();
    foreach ($_REQUEST['eids'] as $eid) {
        $sqlWhere[] = 'E.Id = ?';
        $sqlValues[] = $eid;
    }
    unset($eid);
    $sql .= join(" or ", $sqlWhere);
    foreach (dbFetchAll($sql, NULL, $sqlValues) as $row) {
        if (!isset($newEvent)) {
            $newEvent = $row;
        } else {
            if ($newEvent['Cause'] && $newEvent['Cause'] != $row['Cause']) {
                $newEvent['Cause'] = "";
            }
            if ($newEvent['Notes'] && $newEvent['Notes'] != $row['Notes']) {
                $newEvent['Notes'] = "";
            }
        }
    }
} else {
    $mode = '';
}
$focusWindow = true;
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:eventdetail.php

示例13: dbFetchMonitor

} else {
    $view = "error";
    return;
}
$monitor = dbFetchMonitor($mid);
$plugin = $_REQUEST['pl'];
$plugin_path = dirname(ZM_PLUGINS_CONFIG_PATH) . "/" . $plugin;
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Plugin'));
$pluginOptions = array('Enabled' => array('Type' => 'select', 'Name' => 'Enabled', 'Choices' => 'yes,no', 'Value' => 'no'));
$optionNames = array();
if (file_exists($plugin_path . "/config.php")) {
    include_once $plugin_path . "/config.php";
}
$sql = 'SELECT * FROM PluginsConfig WHERE MonitorId=? AND ZoneId=? AND pluginName=?';
foreach (dbFetchAll($sql, NULL, array($mid, $zid, $plugin)) as $popt) {
    if (array_key_exists($popt['Name'], $pluginOptions) && $popt['Type'] == $pluginOptions[$popt['Name']]['Type'] && $popt['Choices'] == $pluginOptions[$popt['Name']]['Choices']) {
        $pluginOptions[$popt['Name']] = $popt;
        array_push($optionNames, $popt['Name']);
    } else {
        dbQuery('DELETE FROM PluginsConfig WHERE Id=?', array($popt['Id']));
    }
}
foreach ($pluginOptions as $name => $values) {
    if (!in_array($name, $optionNames)) {
        $popt = $pluginOptions[$name];
        $sql = "INSERT INTO PluginsConfig VALUES ('',?,?,?,?,?,?,?)";
        dbQuery($sql, array($popt['Name'], $popt['Value'], $popt['Type'], $popt['Choices'], $mid, $zid, $plugin));
    }
}
$PLANG = array();
开发者ID:rodoviario,项目名称:ZoneMinder,代码行数:31,代码来源:plugin.php

示例14: mysql_query

    $result = mysql_query($query);
    // Get all of the mids in a group
    $row = mysql_result($result, 0);
    $mids = explode(",", $row);
    # Put them into an array
    foreach ($mids as $mid) {
        # Foreach item in the array
        $query = "select Id, Name, Width, Height from Monitors where Id = " . $mid;
        foreach (dbFetchAll($query) as $monitor) {
            # Query the database
            displayMonitor($monitor, $bandwidth);
            # And call displayMonitor with the result
        }
    }
} else {
    $monitors = dbFetchAll("select Id, Name, Width, Height from Monitors order by Sequence asc");
    foreach ($monitors as $monitor) {
        displayMonitor($monitor, $bandwidth);
    }
}
?>
 </ul>
<?php 
function displayMonitor($monitor, $bandwidth)
{
    if (!defined(ZM_WEB_DEFAULT_SCALE)) {
        $scale = 40;
    } else {
        $scale = ZM_WEB_DEFAULT_SCALE;
    }
    if ($bandwidth == 'high') {
开发者ID:mondychan,项目名称:modern,代码行数:31,代码来源:monitors.old.php

示例15: dbFetchAll

            <th>Max Bandwidth</th>
            <td>
              <select name="MaxBandwidth" id="MaxBandwidth" class="form-control new-user-form-value">
                <option value="" selected="selected"></option>
                <option value="high">High</option>
                <option value="medium">Medium</option>
                <option value="low">Low</option>
              </select>
            </td>
          </tr>
          <tr>
            <th>Restricted Monitors</th>
            <td>
              <select id="monitorIds" name="monitorIds" multiple="multiple" class="form-control new-user-form-value">
                <?php 
$response = dbFetchAll("SELECT Id, Name FROM Monitors");
if (!$response) {
    echo "<option value=\"null\">Error fetching list</option>";
} else {
    foreach ($response as $row) {
        echo "<option value=\"{$row['Id']}\">{$row['Name']}</option>";
    }
}
?>
              </select>
            </td>
          </tr>
        </tbody>
      </table>
      <a href="#" class="btn btn-primary back-to-preset-management" data-calledfrom="userlist"><span class="fa fa-arrow-circle-left"></span> Back To Preset Mangement</a>
      <button id="add-new-user" class="btn btn-success"><span class="fa fa-save"></span> Save User</button>
开发者ID:OverByThere,项目名称:modern,代码行数:31,代码来源:userlist.php


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