@Ghazascanner
_2019runbot
Ghazascanner File Manager
server :Linux phosweb008 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
Current Path :
/
homepage
/
v-mt
/
php
/
lib
/
Path :
Upload File :
New :
File
Dir
/homepage/v-mt/php/lib/mtdb_postgres.php
<?php # Movable Type (r) (C) 2001-2008 Six Apart, Ltd. All Rights Reserved. # This code cannot be redistributed without permission from www.sixapart.com. # For more information, consult your Movable Type license. # # $Id: mtdb_postgres.php 1174 2008-01-08 21:02:50Z bchoate $ require_once("ezsql".DIRECTORY_SEPARATOR."ezsql_postgres.php"); require_once("mtdb_base.php"); class MTDatabase_postgres extends MTDatabaseBase { var $vendor = 'postgres'; function unserialize($data) { $data = pg_unescape_bytea($data); return parent::unserialize($data); } function apply_limit_sql($sql, $limit, $offset = 0) { $limit = intval($limit); $offset = intval($offset); $limitStr = ''; if ($limit == -1) $limit = 0; if ($limit || $offset) { if (!$limit) $limit = 'all'; $limitStr = ($offset ? 'offset ' . $offset : '') . ' limit ' . $limit; } $sql = preg_replace('/<LIMIT>/', $limitStr, $sql); return $sql; } function limit_by_day_sql($column, $days) { return '(' . $column . '+\'' . $days . ' days\' >= current_date)'; } function entries_recently_commented_on_sql($subsql) { $sql = " select main.* from ( select distinct on (entry_id) subs.*, comment_created_on from ($subsql) as subs inner join mt_comment on comment_entry_id = entry_id and comment_visible = 1 order by entry_id desc ) as main order by comment_created_on desc"; return $sql; } function query_start($query) { // For reg expressions $query = trim($query); // Query was an insert, delete, update, replace if ( preg_match("/^(insert|delete|update|replace)\s+/i",$query) ) { return false; } // Flush cached values.. $this->flush(); // Log how the function was called $this->func_call = "\$db->query_start(\"$query\")"; // Keep track of the last query for debug.. $this->last_query = $query; // Perform the query via std pg_query function.. if (!$this->result = @pg_query($this->dbh,$query)) { $this->print_error(); return false; } $this->num_queries++; // ======================================================= // Take note of column info $i=0; while ($i < @pg_num_fields($this->result)) { $this->col_info[$i]->name = pg_field_name($this->result,$i); $this->col_info[$i]->type = pg_field_type($this->result,$i); $this->col_info[$i]->size = pg_field_size($this->result,$i); $i++; } $this->last_result = array(); $this->num_rows = 0; // If debug ALL queries $this->trace || $this->debug_all ? $this->debug() : null ; return true; } function query_fetch($output=OBJECT) { if ( $row = @pg_fetch_object($this->result) ) { $this->num_rows++; if ( $output == OBJECT ) { return $row; } // If the output is an associative array then return row as such.. elseif ( $output == ARRAY_A ) { return $this->convert_fieldname(get_object_vars($row)); } // If the output is an numerical array then return row as such.. elseif ( $output == ARRAY_N ) { return array_values(get_object_vars($row)); } } return null; } function query_finish() { if (isset($this->result)) { @pg_free_result($this->result); unset($this->result); } } function apply_extract_date($part, $column) { return "extract('" .strtolower($part) . "' from $column)"; } } ?>