[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 sniffer.php

Zen Cart 源代码 sniffer.php




下载文件

文件名: sniffer.php
文件类型: PHP文件
文件大小: 2.18 KiB
MD5: 259da0b8ac947f348db5c7f034cf1ddb

sniffer.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Sniffer Class.
  4.  *
  5.  * @package classes
  6.  * @copyright Copyright 2003-2007 Zen Cart Development Team
  7.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  8.  * @version $Id: sniffer.php 5645 2007-01-21 00:40:03Z drbyte $
  9.  */
  10. if (!defined('IS_ADMIN_FLAG')) {
  11.   die('Illegal Access');
  12. }
  13. /**
  14.  * Sniffer Class.
  15.  * This class is used to collect information on the system that Zen Cart is running on
  16.  * and to return error reports
  17.  *
  18.  * @package classes
  19.  */
  20. class sniffer extends base {
  21.  
  22.   function sniffer() {
  23.     $this->browser = Array();
  24.     $this->php = Array();
  25.     $this->server = Array();
  26.     $this->database = Array();
  27.     $this->phpBB = Array();
  28.   }
  29.  
  30.   function table_exists($table_name) {
  31.     global $db;
  32.     $found_table = false;
  33.     // Check to see if the requested Zen Cart table exists
  34.     $sql = "SHOW TABLES like '".$table_name."'";
  35.     $tables = $db->Execute($sql);
  36.     //echo 'tables_found = '. $tables->RecordCount() .'<br>';
  37.     if ($tables->RecordCount() > 0) {
  38.       $found_table = true;
  39.     }
  40.     return $found_table;
  41.   }
  42.  
  43.   function field_exists($table_name, $field_name) {
  44.     global $db;
  45.     $sql = "show fields from " . $table_name;
  46.     $result = $db->Execute($sql);
  47.     while (!$result->EOF) {
  48.       // echo 'fields found='.$result->fields['Field'].'<br />';
  49.       if  ($result->fields['Field'] == $field_name) {
  50.         return true; // exists, so return with no error
  51.       }
  52.       $result->MoveNext();
  53.     }
  54.     return false;
  55.   }
  56.  
  57.   function field_type($table_name, $field_name, $field_type, $return_found = false) {
  58.     global $db;
  59.     $sql = "show fields from " . $table_name;
  60.     $result = $db->Execute($sql);
  61.     while (!$result->EOF) {
  62.       // echo 'fields found='.$result->fields['Field'].'<br />';
  63.       if  ($result->fields['Field'] == $field_name) {
  64.         if  ($result->fields['Type'] == $field_type) {
  65.           return true; // exists and matches required type, so return with no error
  66.         } elseif ($return_found) {
  67.           return $result->fields['Type']; // doesn't match, so return what it "is", if requested
  68.         }
  69.       }
  70.       $result->MoveNext();
  71.     }
  72.     return false;
  73.   }
  74. }
  75. ?>