From: <jon...@us...> - 2010-06-08 19:09:52
|
Revision: 27541 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27541&view=rev Author: jonnybradley Date: 2010-06-08 18:36:03 +0000 (Tue, 08 Jun 2010) Log Message: ----------- [ENH] Profiles tracker handler: Check for required 'name' param first, and provide feedback about incorrect profile syntax. (TODO: more like this on all the other handlers) Modified Paths: -------------- trunk/lib/profilelib/installlib.php Modified: trunk/lib/profilelib/installlib.php =================================================================== --- trunk/lib/profilelib/installlib.php 2010-06-08 17:38:46 UTC (rev 27540) +++ trunk/lib/profilelib/installlib.php 2010-06-08 18:36:03 UTC (rev 27541) @@ -483,16 +483,19 @@ { $data = $this->getData(); + // Check for mandatory fields + if( !isset( $data['name'] ) ) { + $ref = $this->obj->getRef(); + throw (new Exception('No name for tracker:' . (empty($ref) ? '' : ' ref=' . $ref))); + } + // Check for unknown fields $optionMap = $this->getOptionMap(); $remain = array_diff( array_keys( $data ), array_keys( $optionMap ) ); - if( count( $remain ) ) - return false; - - // Check for mandatory fields - if( !isset( $data['name'] ) ) - return false; - + if( count( $remain ) ) { + throw (new Exception('Cannot map object options: "' . implode('","', $remain) . '" for tracker:' . $data['name'])); + } + return true; } // }}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |