|
From: <rd...@us...> - 2009-02-04 12:22:17
|
Revision: 1971
http://digir.svn.sourceforge.net/digir/?rev=1971&view=rev
Author: rdg
Date: 2009-02-04 12:10:35 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
Moved streaming control to the main Process function.
Modified Paths:
--------------
tapirlink/trunk/classes/TpResponse.php
tapirlink/trunk/classes/TpSearchResponse.php
Modified: tapirlink/trunk/classes/TpResponse.php
===================================================================
--- tapirlink/trunk/classes/TpResponse.php 2009-02-02 21:33:34 UTC (rev 1970)
+++ tapirlink/trunk/classes/TpResponse.php 2009-02-04 12:10:35 UTC (rev 1971)
@@ -67,6 +67,10 @@
function Process()
{
+ // In some cases it is necessary to replace headers (see "header" call
+ // inside TpXmlGenerator), so avoid echoing content straight away.
+ ob_start();
+
global $g_dlog;
$log_data = array();
@@ -179,6 +183,8 @@
$LogStruct->WriteRequestResult( $stats_log );
}
+ ob_end_flush();
+
} // end of member function Process
function Header()
Modified: tapirlink/trunk/classes/TpSearchResponse.php
===================================================================
--- tapirlink/trunk/classes/TpSearchResponse.php 2009-02-02 21:33:34 UTC (rev 1970)
+++ tapirlink/trunk/classes/TpSearchResponse.php 2009-02-04 12:10:35 UTC (rev 1971)
@@ -65,15 +65,6 @@
} // end of member function Footer
- function Process()
- {
- // This method is redefined here because in some cases it is necessary
- // to replace headers (see "header" call inside TpXmlGenerator).
- ob_start();
- parent::Process();
-
- } // end of member function Footer
-
function Body()
{
global $g_dlog;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rd...@us...> - 2009-08-26 20:49:12
|
Revision: 1994
http://digir.svn.sourceforge.net/digir/?rev=1994&view=rev
Author: rdg
Date: 2009-08-26 20:49:04 +0000 (Wed, 26 Aug 2009)
Log Message:
-----------
Minor changes.
Modified Paths:
--------------
tapirlink/trunk/classes/TpConfigManager.php
tapirlink/trunk/classes/TpMappingForm.php
Modified: tapirlink/trunk/classes/TpConfigManager.php
===================================================================
--- tapirlink/trunk/classes/TpConfigManager.php 2009-08-26 19:47:22 UTC (rev 1993)
+++ tapirlink/trunk/classes/TpConfigManager.php 2009-08-26 20:49:04 UTC (rev 1994)
@@ -120,11 +120,11 @@
// Check that session is working
- session_destroy();
+ session_destroy();
session_start();
$_SESSION['test'] = '1';
session_write_close();
- $_SESSION = array();
+ $_SESSION = array();
session_start();
if ( ! isset( $_SESSION['test'] ) )
Modified: tapirlink/trunk/classes/TpMappingForm.php
===================================================================
--- tapirlink/trunk/classes/TpMappingForm.php 2009-08-26 19:47:22 UTC (rev 1993)
+++ tapirlink/trunk/classes/TpMappingForm.php 2009-08-26 20:49:04 UTC (rev 1994)
@@ -537,7 +537,7 @@
{
// Remove all possible content from cache (query templates,
// output models and response structures) since this kind of
- // cached data largely depends on what it mapped.
+ // cached data largely depends on what is mapped.
$cache_dir = TP_CACHE_DIR . '/' . $this->mResource->GetCode();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rd...@us...> - 2011-02-02 16:24:50
|
Revision: 2028
http://digir.svn.sourceforge.net/digir/?rev=2028&view=rev
Author: rdg
Date: 2011-02-02 16:24:44 +0000 (Wed, 02 Feb 2011)
Log Message:
-----------
Fixed crash when a literal in a kvp filter is not delimited by double quotes.
Modified Paths:
--------------
tapirlink/trunk/classes/TpComparisonOperator.php
tapirlink/trunk/classes/TpInventoryParameters.php
tapirlink/trunk/classes/TpInventoryResponse.php
Modified: tapirlink/trunk/classes/TpComparisonOperator.php
===================================================================
--- tapirlink/trunk/classes/TpComparisonOperator.php 2010-09-15 00:51:15 UTC (rev 2027)
+++ tapirlink/trunk/classes/TpComparisonOperator.php 2011-02-02 16:24:44 UTC (rev 2028)
@@ -107,8 +107,16 @@
$concept = $r_local_mapping->GetConcept( $concept_id );
- if ( $concept == null or ! $concept->IsMapped() )
+ if ( is_null( $concept ) )
{
+ $msg = 'Unknown concept "'.$concept_id.'"';
+
+ TpDiagnostics::Append( DC_UNMAPPED_CONCEPT, $msg, DIAG_ERROR );
+
+ return 'FALSE';
+ }
+ else if ( ! $concept->IsMapped() )
+ {
// Don't raise error here. If the expression is a missing
// parameter then the comparison should be simply discarded
Modified: tapirlink/trunk/classes/TpInventoryParameters.php
===================================================================
--- tapirlink/trunk/classes/TpInventoryParameters.php 2010-09-15 00:51:15 UTC (rev 2027)
+++ tapirlink/trunk/classes/TpInventoryParameters.php 2011-02-02 16:24:44 UTC (rev 2028)
@@ -21,7 +21,6 @@
*/
require_once('TpOperationParameters.php');
-require_once('TpFilter.php');
class TpInventoryParameters extends TpOperationParameters
{
Modified: tapirlink/trunk/classes/TpInventoryResponse.php
===================================================================
--- tapirlink/trunk/classes/TpInventoryResponse.php 2010-09-15 00:51:15 UTC (rev 2027)
+++ tapirlink/trunk/classes/TpInventoryResponse.php 2011-02-02 16:24:44 UTC (rev 2028)
@@ -45,6 +45,8 @@
{
global $g_dlog;
+ $g_dlog->debug( 'Processing inventory' );
+
$inventory_parameters = $this->mRequest->GetOperationParameters();
if ( ! is_object( $inventory_parameters ) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rd...@us...> - 2011-02-25 18:42:20
|
Revision: 2030
http://digir.svn.sourceforge.net/digir/?rev=2030&view=rev
Author: rdg
Date: 2011-02-25 18:42:14 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
Workaround to get clone working in older PHP versions.
Modified Paths:
--------------
tapirlink/trunk/classes/TpMappingForm.php
tapirlink/trunk/classes/TpUtils.php
Modified: tapirlink/trunk/classes/TpMappingForm.php
===================================================================
--- tapirlink/trunk/classes/TpMappingForm.php 2011-02-17 20:49:38 UTC (rev 2029)
+++ tapirlink/trunk/classes/TpMappingForm.php 2011-02-25 18:42:14 UTC (rev 2030)
@@ -437,14 +437,7 @@
// Refresh mappings
// Create copy of local mapping to avoid messing with iterators
- if ( version_compare( phpversion(), '5.0.0', '<' ) > 0 )
- {
- $this->mLocalMappingCopy = $this->mResource->GetLocalMapping();
- }
- else
- {
- $this->mLocalMappingCopy = clone $this->mResource->GetLocalMapping();
- }
+ $this->mLocalMappingCopy = clone( $this->mResource->GetLocalMapping() );
$r_mapped_schemas =& $r_local_mapping->GetMappedSchemas();
Modified: tapirlink/trunk/classes/TpUtils.php
===================================================================
--- tapirlink/trunk/classes/TpUtils.php 2011-02-17 20:49:38 UTC (rev 2029)
+++ tapirlink/trunk/classes/TpUtils.php 2011-02-25 18:42:14 UTC (rev 2030)
@@ -892,5 +892,15 @@
} // end of FixAdodbColumnsArray
+ // Workaround to get clone working in older PHP versions
+ // For more details, see: http://acko.net/node/54
+ if ( version_compare( phpversion(), '5.0' ) < 0 ) {
+
+ eval('
+ function clone( $object ) {
+ return $object;
+ }
+ ');
+ }
} // end of TpUtils
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rd...@us...> - 2012-08-21 21:03:18
|
Revision: 2034
http://digir.svn.sourceforge.net/digir/?rev=2034&view=rev
Author: rdg
Date: 2012-08-21 21:03:07 +0000 (Tue, 21 Aug 2012)
Log Message:
-----------
Fixed bug in search operation when more than one KVP orderby parameter is passed. Also replaced the function that converts multiple parameters with the same name into arrays.
Modified Paths:
--------------
tapirlink/trunk/classes/TpInventoryParameters.php
tapirlink/trunk/classes/TpOperationParameters.php
tapirlink/trunk/classes/TpSearchParameters.php
Modified: tapirlink/trunk/classes/TpInventoryParameters.php
===================================================================
--- tapirlink/trunk/classes/TpInventoryParameters.php 2012-03-28 21:54:09 UTC (rev 2033)
+++ tapirlink/trunk/classes/TpInventoryParameters.php 2012-08-21 21:03:07 UTC (rev 2034)
@@ -36,27 +36,25 @@
function LoadKvpParameters()
{
- // Since there can be multiple parameters with the same name
- // (concept and tagname) we need a custom HTTP query string parser
- $parameters = $this->_ParseQueryString();
+ parent::LoadKvpParameters();
// Concepts
- if ( isset( $parameters['concept'] ) )
+ if ( isset( $_REQUEST['concept'] ) )
{
- $concept = $parameters['concept'];
+ $concept = $_REQUEST['concept'];
}
- else if ( isset( $parameters['c'] ) )
+ else if ( isset( $_REQUEST['c'] ) )
{
- $concept = $parameters['c'];
+ $concept = $_REQUEST['c'];
}
- if ( isset( $parameters['tagname'] ) )
+ if ( isset( $_REQUEST['tagname'] ) )
{
- $tag_name = $parameters['tagname'];
+ $tag_name = $_REQUEST['tagname'];
}
- else if ( isset( $parameters['n'] ) )
+ else if ( isset( $_REQUEST['n'] ) )
{
- $tag_name = $parameters['n'];
+ $tag_name = $_REQUEST['n'];
}
if ( isset( $concept ) )
@@ -92,67 +90,10 @@
}
}
- return parent::LoadKvpParameters();
+ return true;
} // end of member function LoadKvpParameters
- function _ParseQueryString( )
- {
- $parameters = array();
-
- // See if there is any raw post
- $raw_post = '';
-
- if ( $fp = fopen( 'php://input', 'r' ) )
- {
- while ( $data = fread( $fp, 4096 ) )
- {
- $raw_post .= $data;
- }
-
- fclose( $fp );
- }
- else
- {
- // TODO: raise an error here!
- }
-
- // Concatenate with query string and raw post before spliting
- $raw_input_items = split( '&', $_SERVER['QUERY_STRING'] . '&' . $raw_post );
-
- foreach ( $raw_input_items as $input_item )
- {
- // split into name/value pair
- if ( $input_item != '' )
- {
- $item = split( '=', $input_item );
-
- $key = urldecode( $item[0] );
-
- $value = ( empty( $item[1] ) ) ? '' : urldecode( $item[1] );
-
- if ( ! isset( $parameters[$key] ) )
- {
- $parameters[$key] = $value;
- }
- elseif ( ! is_array( $parameters[$key] ) )
- {
- $first = $parameters[$key];
- $parameters[$key] = array();
- $parameters[$key][]= $first;
- $parameters[$key][]= $value;
- }
- else
- {
- $parameters[$key][]= $value;
- }
- }
- }
-
- return $parameters;
-
- } // end of member function _ParseQueryString
-
function StartElement( $parser, $qualified_name, $attrs )
{
$name = TpUtils::GetUnqualifiedName( $qualified_name );
Modified: tapirlink/trunk/classes/TpOperationParameters.php
===================================================================
--- tapirlink/trunk/classes/TpOperationParameters.php 2012-03-28 21:54:09 UTC (rev 2033)
+++ tapirlink/trunk/classes/TpOperationParameters.php 2012-08-21 21:03:07 UTC (rev 2034)
@@ -53,6 +53,10 @@
function LoadKvpParameters()
{
+ // Since there can be multiple parameters with the same name
+ // (concept and tagname) we need a custom HTTP query string parser
+ $this->_FixRawQuery();
+
// Filter
if ( isset( $_REQUEST['filter'] ) )
{
@@ -198,6 +202,104 @@
} // end of member function GetFilter
/**
+ * Converts HTTP variables into an array when more than one parameter with
+ * the same name is passed. Deliberately taken from:
+ * http://www.php.net/manual/en/reserved.variables.get.php#92439
+ */
+ function _FixRawQuery( ) {
+
+ $post = '';
+
+ // Try globals array
+ if ( !$post && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]) )
+ {
+ $post = $_GLOBALS["HTTP_RAW_POST_DATA"];
+ }
+
+ // Try globals variable
+ if ( !$post && isset($HTTP_RAW_POST_DATA) )
+ {
+ $post = $HTTP_RAW_POST_DATA;
+ }
+
+ // Try stream
+ if ( !$post )
+ {
+ if ( !function_exists('file_get_contents') )
+ {
+ $fp = fopen("php://input", "r");
+
+ if ( $fp )
+ {
+ $post = '';
+
+ while ( !feof($fp) )
+ {
+ $post = fread($fp, 1024);
+ }
+
+ fclose($fp);
+ }
+ }
+ else
+ {
+ $post = "" . file_get_contents("php://input");
+ }
+ }
+
+ $raw = !empty($_SERVER['QUERY_STRING']) ? sprintf('%s&%s', $_SERVER['QUERY_STRING'], $post) : $post;
+
+ $arr = array();
+ $pairs = explode('&', $raw);
+
+ foreach ( $pairs as $i )
+ {
+ if ( !empty($i) )
+ {
+ list($name, $value) = explode('=', $i, 2);
+
+ if ( isset($arr[$name]) )
+ {
+ if ( is_array($arr[$name]) )
+ {
+ $arr[$name][] = $value;
+ }
+ else
+ {
+ $arr[$name] = array($arr[$name], $value);
+ }
+ }
+ else
+ {
+ $arr[$name] = $value;
+ }
+ }
+ }
+
+ foreach ( $_POST as $key => $value )
+ {
+ if ( is_array($arr[$key]) )
+ {
+ $_POST[$key] = $arr[$name];
+ $_REQUEST[$key] = $arr[$name];
+ }
+ }
+
+ foreach ( $_GET as $key => $value )
+ {
+ if ( is_array($arr[$key]) )
+ {
+ $_GET[$key] = $arr[$name];
+ $_REQUEST[$key] = $arr[$name];
+ }
+ }
+
+ # optionally return result array
+ return $arr;
+
+ } // end of member function _FixRawQuery
+
+ /**
* Internal method called before serialization
*
* @return array Properties that should be considered during serialization
Modified: tapirlink/trunk/classes/TpSearchParameters.php
===================================================================
--- tapirlink/trunk/classes/TpSearchParameters.php 2012-03-28 21:54:09 UTC (rev 2033)
+++ tapirlink/trunk/classes/TpSearchParameters.php 2012-08-21 21:03:07 UTC (rev 2034)
@@ -54,6 +54,8 @@
function LoadKvpParameters()
{
+ parent::LoadKvpParameters();
+
// Output model
if ( isset( $_REQUEST['model'] ) )
{
@@ -152,7 +154,7 @@
}
}
- return parent::LoadKvpParameters();
+ return true;
} // end of member function LoadKvpParameters
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rd...@us...> - 2015-02-10 02:32:20
|
Revision: 2045
http://sourceforge.net/p/digir/svn/2045
Author: rdg
Date: 2015-02-10 02:32:17 +0000 (Tue, 10 Feb 2015)
Log Message:
-----------
Made arguments compatible
Modified Paths:
--------------
tapirlink/trunk/classes/TpFilterToHtml.php
tapirlink/trunk/classes/TpFilterVisitor.php
Modified: tapirlink/trunk/classes/TpFilterToHtml.php
===================================================================
--- tapirlink/trunk/classes/TpFilterToHtml.php 2015-02-06 15:55:49 UTC (rev 2044)
+++ tapirlink/trunk/classes/TpFilterToHtml.php 2015-02-10 02:32:17 UTC (rev 2045)
@@ -80,7 +80,7 @@
} // end of member function GetHtml
- function VisitLogicalOperator( $lop, $args )
+ function VisitLogicalOperator( &$rLop, $args )
{
$html = '';
@@ -94,7 +94,7 @@
$lop_name = '?';
- $logical_type = $lop->GetLogicalType();
+ $logical_type = $rLop->GetLogicalType();
if ( $logical_type == LOP_AND )
{
@@ -124,7 +124,7 @@
$html .= '<br/>';
}
- $boolean_operators = $lop->GetBooleanOperators();
+ $boolean_operators = $rLop->GetBooleanOperators();
$total = count( $boolean_operators );
@@ -182,7 +182,7 @@
} // end of member function VisitLogicalOperatior
- function VisitComparisonOperator( $cop, $args )
+ function VisitComparisonOperator( &$rCop, $args )
{
$html = "\n";
@@ -190,7 +190,7 @@
$cop_id = $path;
- $base_concept = $cop->GetBaseConcept();
+ $base_concept = $rCop->GetBaseConcept();
if ( is_object( $base_concept ) )
{
@@ -207,12 +207,12 @@
$html .= ' '.
TpHtmlUtils::GetCombo( $cop_id,
- $cop->GetComparisonType(),
+ $rCop->GetComparisonType(),
$this->_GetOptions( 'cops') ).' ';
$value_id = $cop_id . '@val';
- $expressions = $cop->GetExpressions();
+ $expressions = $rCop->GetExpressions();
$value = '';
Modified: tapirlink/trunk/classes/TpFilterVisitor.php
===================================================================
--- tapirlink/trunk/classes/TpFilterVisitor.php 2015-02-06 15:55:49 UTC (rev 2044)
+++ tapirlink/trunk/classes/TpFilterVisitor.php 2015-02-10 02:32:17 UTC (rev 2045)
@@ -29,12 +29,12 @@
} // end of member function TpFilterVisitor
- function VisitLogicalOperator( $lop, $args )
+ function VisitLogicalOperator( &$rLop, $args )
{
} // end of member function VisitLogicalOperatior
- function VisitComparisonOperator( $cop, $args )
+ function VisitComparisonOperator( &$rCop, $args )
{
} // end of member function VisitComparisonOperator
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|