Index: administrator/logout.php
===================================================================
--- administrator/logout.php	(revision 1753)
+++ administrator/logout.php	(working copy)
@@ -16,6 +16,7 @@
 $currentDate = date("Y-m-d\TH:i:s");
 
 if (isset($_SESSION['session_user_id']) && $_SESSION['session_user_id']!="") {
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$database->setQuery( "UPDATE #__users SET lastvisitDate='$currentDate' WHERE id='" . $_SESSION['session_user_id'] . "'");
 
 	if (!$database->query()) {
@@ -24,6 +25,7 @@
 }
 
 if (isset($_SESSION['session_id']) && $_SESSION['session_id']!="") {
+	// @RawSQLUse, trivial_implementation, DELETE
 	$database->setQuery( "DELETE FROM #__session WHERE session_id='" . $_SESSION['session_id'] . "'");
 
 	if (!$database->query()) {
Index: administrator/components/com_newsfeeds/admin.newsfeeds.php
===================================================================
--- administrator/components/com_newsfeeds/admin.newsfeeds.php	(revision 1753)
+++ administrator/components/com_newsfeeds/admin.newsfeeds.php	(working copy)
@@ -89,6 +89,7 @@
 	$limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
 
 	// get the total number of records
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT count(*) FROM #__newsfeeds"
 	. ( $catid ? "\n WHERE catid='$catid'" : '' )
 	;
Index: administrator/components/com_frontpage/admin.frontpage.php
===================================================================
--- administrator/components/com_frontpage/admin.frontpage.php	(revision 1753)
+++ administrator/components/com_frontpage/admin.frontpage.php	(working copy)
@@ -281,6 +281,7 @@
 	$order 		= mosGetParam( $_POST, 'order', array(0) );
 
 	for( $i=0; $i < $total; $i++ ) {
+		// @RawSQLUse, trivial_implementation, UPDATE
 		$query = "UPDATE #__content_frontpage SET ordering='$order[$i]' WHERE content_id = $cid[$i]";
 		$database->setQuery( $query );
 		if (!$database->query()) {
Index: administrator/components/com_menus/content_typed/content_typed.class.php
===================================================================
--- administrator/components/com_menus/content_typed/content_typed.class.php	(revision 1753)
+++ administrator/components/com_menus/content_typed/content_typed.class.php	(working copy)
@@ -43,6 +43,7 @@
 	
 		if ( $uid ) {
 			$temp = explode( 'id=', $menu->link );
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			 $query = "SELECT a.title, a.title_alias, a.id"
 			. "\n FROM #__content AS a"
 			. "\n WHERE a.id = '". $temp[1] ."'"
Index: administrator/components/com_menus/contact_item_link/contact_item_link.class.php
===================================================================
--- administrator/components/com_menus/contact_item_link/contact_item_link.class.php	(revision 1753)
+++ administrator/components/com_menus/contact_item_link/contact_item_link.class.php	(working copy)
@@ -46,6 +46,7 @@
 	
 		if ( $uid ) {
 			$temp = explode( 'contact_id=', $menu->link );
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT *"
 			. "\n FROM #__contact_details AS a"
 			. "\n WHERE a.id = '". $temp[1] ."'"
Index: administrator/components/com_menus/component_item_link/component_item_link.class.php
===================================================================
--- administrator/components/com_menus/component_item_link/component_item_link.class.php	(revision 1753)
+++ administrator/components/com_menus/component_item_link/component_item_link.class.php	(working copy)
@@ -45,6 +45,7 @@
 	
 		if ( $uid ) {
 			$temp = explode( '&Itemid=', $menu->link );
+			// @RawSQLUse, trivial_implementation, SELECT
 			 $query = "SELECT a.name"
 			. "\n FROM #__menu AS a"
 			. "\n WHERE a.link = '". $temp[0] ."'"
Index: administrator/components/com_menus/contact_category_table/contact_category_table.class.php
===================================================================
--- administrator/components/com_menus/contact_category_table/contact_category_table.class.php	(revision 1753)
+++ administrator/components/com_menus/contact_category_table/contact_category_table.class.php	(working copy)
@@ -46,6 +46,7 @@
 		// build list of categories
 		$lists['componentid']	= mosAdminMenus::ComponentCategory( 'componentid', 'com_contact_details', intval( $menu->componentid ), NULL, 'ordering', 5, 0 ); 
 		if ( $uid ) {
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT name"
 			. "\n FROM #__categories"
 			. "\n WHERE section = 'com_contact_details'"
Index: administrator/components/com_menus/weblink_category_table/weblink_category_table.class.php
===================================================================
--- administrator/components/com_menus/weblink_category_table/weblink_category_table.class.php	(revision 1753)
+++ administrator/components/com_menus/weblink_category_table/weblink_category_table.class.php	(working copy)
@@ -46,6 +46,7 @@
 		// build list of categories
 		$lists['componentid']	= mosAdminMenus::ComponentCategory( 'componentid', 'com_weblinks', intval( $menu->componentid ), NULL, 'ordering', 5, 0 ); 
 		if ( $uid ) {
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT name"
 			. "\n FROM #__categories"
 			. "\n WHERE section = 'com_weblinks'"
Index: administrator/components/com_menus/content_blog_section/content_blog_section.class.php
===================================================================
--- administrator/components/com_menus/content_blog_section/content_blog_section.class.php	(revision 1753)
+++ administrator/components/com_menus/content_blog_section/content_blog_section.class.php	(working copy)
@@ -39,6 +39,7 @@
 			$params =& new mosParameters( $menu->params );
 			$secids = $params->def( 'sectionid', '' );
 			if ( $secids ) {
+				// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 				$query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`"
 				. "\n FROM #__sections AS s"
 				. "\n WHERE s.scope = 'content'"
@@ -61,6 +62,7 @@
 
 		// build the html select list for section
 		$rows[] = mosHTML::makeOption( '', T_('All Sections') );
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`"
 		. "\n FROM #__sections AS s"
 		. "\n WHERE s.scope = 'content'"
Index: administrator/components/com_menus/admin.menus.php
===================================================================
--- administrator/components/com_menus/admin.menus.php	(revision 1753)
+++ administrator/components/com_menus/admin.menus.php	(working copy)
@@ -439,6 +439,7 @@
 	$state = "-2";
 	//seperate contentids
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$query = 	"UPDATE #__menu SET published = '". $state ."', ordering = '0'"
 	. "\n WHERE id IN ( ". $cids ." )"
 	;
@@ -528,11 +529,13 @@
 
 	## query to list selected menu items
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( ". $cids ." )";
 	$database->setQuery( $query );
 	$items = $database->loadObjectList();
 
 	## query to choose menu
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.params FROM #__modules AS a WHERE a.module = 'mod_mainmenu' ORDER BY a.title";
 	$database->setQuery( $query );
 	$modules = $database->loadObjectList();
@@ -557,6 +560,7 @@
 {
 	global $database;
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
     $database->setQuery("SELECT id FROM #__menu WHERE parent=$id");
     $rows = $database->loadObjectList();
     if ($database->getErrorNum()) {
@@ -633,6 +637,7 @@
 
 	## query to list selected menu items
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( ". $cids ." )";
 	$database->setQuery( $query );
 	$items = $database->loadObjectList();
Index: administrator/components/com_menus/newsfeed_category_table/newsfeed_category_table.class.php
===================================================================
--- administrator/components/com_menus/newsfeed_category_table/newsfeed_category_table.class.php	(revision 1753)
+++ administrator/components/com_menus/newsfeed_category_table/newsfeed_category_table.class.php	(working copy)
@@ -46,6 +46,7 @@
 		// build list of categories
 		$lists['componentid']	= mosAdminMenus::ComponentCategory( 'componentid', 'com_newsfeeds', intval( $menu->componentid ), NULL, 'name', 10, 0 ); 
 		if ( $uid ) {
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT name"
 			. "\n FROM #__categories"
 			. "\n WHERE section = 'com_newsfeeds'"
Index: administrator/components/com_menus/content_item_link/content_item_link.class.php
===================================================================
--- administrator/components/com_menus/content_item_link/content_item_link.class.php	(revision 1753)
+++ administrator/components/com_menus/content_item_link/content_item_link.class.php	(working copy)
@@ -48,6 +48,7 @@
 			$link 	= 'javascript:submitbutton( \'redirect\' );';
 			
 			$temp 	= explode( 'id=', $menu->link );
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			 $query = "SELECT a.title, c.name AS category, s.name AS section"
 			. "\n FROM #__content AS a"
 			. "\n LEFT JOIN #__categories AS c ON a.catid = c.id"
@@ -89,6 +90,7 @@
 			$contents = '';
 			$lists['content'] .= '<input type="hidden" name="content_item_link" value="'. $temp[1] .'" />';
 		} else {
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid "
 			. "\n FROM #__content AS a"
 			. "\n INNER JOIN #__categories AS c ON a.catid = c.id"
@@ -100,6 +102,7 @@
 			$contents = $database->loadObjectList( );
 	
 			foreach ( $contents as $content ) {
+				// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 				$database->setQuery( "SELECT s.title"
 				. "\n FROM #__sections AS s"
 				. "\n WHERE s.scope = 'content'"
@@ -107,6 +110,7 @@
 				);
 				$section = $database->loadResult();
 	
+				// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 				$database->setQuery( "SELECT c.title"
 				. "\n FROM #__categories AS c"
 				. "\n WHERE c.id = '". $content->catid ."'"
Index: administrator/components/com_menus/toolbar.menus.php
===================================================================
--- administrator/components/com_menus/toolbar.menus.php	(revision 1753)
+++ administrator/components/com_menus/toolbar.menus.php	(working copy)
@@ -38,6 +38,7 @@
 		$path 	= $mosConfig_absolute_path .'/administrator/components/com_menus/';	
 
 		if ( $cid[0] ) {
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT type FROM #__menu WHERE id = $cid[0]";
 			$database->setQuery( $query );
 			$type = $database->loadResult();
Index: administrator/components/com_admin/admin.admin.html.php
===================================================================
--- administrator/components/com_admin/admin.admin.html.php	(revision 1753)
+++ administrator/components/com_admin/admin.admin.html.php	(working copy)
@@ -353,6 +353,7 @@
 					</td>
 				</tr>
 				<?php
+				// @RawSQLUse, trivial_implementation, SELECT
 				$query = "SELECT name FROM #__mambots"
 				. "\nWHERE folder='editors' AND published='1'"
 				. "\nLIMIT 1";
Index: administrator/components/com_contact/admin.contact.php
===================================================================
--- administrator/components/com_contact/admin.contact.php	(revision 1753)
+++ administrator/components/com_contact/admin.contact.php	(working copy)
@@ -233,6 +233,7 @@
 
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__contact_details WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
Index: administrator/components/com_installer/mambot/mambot.php
===================================================================
--- administrator/components/com_installer/mambot/mambot.php	(revision 1753)
+++ administrator/components/com_installer/mambot/mambot.php	(working copy)
@@ -26,6 +26,7 @@
 function showInstalledMambots( $_option ) {
 	global $database, $mosConfig_absolute_path;
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT id, name, folder, element, client_id"
 	. "\n FROM #__mambots"
 	. "\n WHERE iscore='0'"
Index: administrator/components/com_installer/component/component.php
===================================================================
--- administrator/components/com_installer/component/component.php	(revision 1753)
+++ administrator/components/com_installer/component/component.php	(working copy)
@@ -29,6 +29,7 @@
 function showInstalledComponents( $option ) {
 	global $database, $mosConfig_absolute_path;
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT *"
 	. "\n FROM #__components"
 	. "\n WHERE parent = 0 AND iscore = 0"
Index: administrator/components/com_installer/installer.class.php
===================================================================
--- administrator/components/com_installer/installer.class.php	(revision 1753)
+++ administrator/components/com_installer/installer.class.php	(working copy)
@@ -222,6 +222,7 @@
         $this->user_dir = mosPathName(mamboCore::get('mosConfig_absolute_path').'/components/'.$com_name);
         $this->admin_dir = mosPathName(mamboCore::get('mosConfig_absolute_path').'/administrator/components/'.$com_name);
         $database =& mamboDatabase::getInstance();
+        // @RawSQLUse, trivial_implementation, SELECT
         $sql = "SELECT COUNT(id) FROM #__components WHERE `option`='$com_name'";
         $database->setQuery($sql);
 		if ($count = $database->loadResult()) {
@@ -297,6 +298,7 @@
         $special = $this->special_file[0];
         $database =& mamboDatabase::getInstance();
         $client_id = $this->client == 'administrator' ? 1 : 0;
+        // @RawSQLUse, trivial_implementation, SELECT
         $sql = "SELECT COUNT(id) FROM #__modules WHERE module='$special' AND client_id='$client_id'";
         $database->setQuery($sql);
         if ($database->loadResult()) {
@@ -327,6 +329,7 @@
             $this->errors->addErrorDetails(sprintf(T_('Installer error with %s: %s %s SQL error %s'), $this->xmlfile, 'mambot', $this->name, $database->stderr(true)), _MOS_ERROR_FATAL);
         }
         
+        // @RawSQLUse, trivial_implementation, INSERT
         $database->setQuery("INSERT INTO #__modules_menu VALUES ('$module->id', 0)");
         if (!$database->query()) {
             $this->errors->addErrorDetails(sprintf(T_('Installer error with %s: %s %s SQL error %s'), $this->xmlfile, 'module', $this->name, $database->stderr(true)), _MOS_ERROR_FATAL);
@@ -341,6 +344,7 @@
         }
         $database =& mamboDatabase::getInstance();
         $name = $this->name;
+        // @RawSQLUse, trivial_implementation, SELECT
         $sql = "SELECT COUNT(id) FROM #__mambots WHERE element='$name'";
         $database->setQuery($sql);
         if ($database->loadResult()) {
@@ -412,6 +416,7 @@
     function install_parameter () {
         $database =& mamboDatabase::getInstance();
         $name = $this->name;
+        // @RawSQLUse, trivial_implementation, SELECT
         $sql = "SELECT COUNT(id) FROM #__parameters WHERE param_name='$name'";
         $database->setQuery($sql);
         if ($database->loadResult()) {
@@ -423,6 +428,7 @@
         $xmlfile = $this->xmlfile;
         $filexmlfile = basename($xmlfile);
         $fmanager->forceCopy($xmlfile, $this->user_dir.basename($filexmlfile));
+        // @RawSQLUse, trivial_implementation, INSERT
         $sql = "INSERT INTO #__parameters (param_name, param_file, param_version, params) VALUES ('$name', '$filexmlfile', '', '')";
         $database->setQuery($sql);
         if (!$database->query()) {
@@ -478,6 +484,7 @@
             $dir->deleteAll();
         }
         $com_name = 'com_'.strtolower($this->name);
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__components WHERE `option`='$com_name'";
         $database =& mamboDatabase::getInstance();
         $database->setQuery($sql);
@@ -486,6 +493,7 @@
 
     function kill_module () {
         $name = $this->name;
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__modules WHERE title='$name'";
         $database =& mamboDatabase::getInstance();
         $database->setQuery($sql);
@@ -494,6 +502,7 @@
 
     function kill_mambot () {
         $name = $this->name;
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__mambots WHERE name='$name'";
         $database =& mamboDatabase::getInstance();
         $database->setQuery($sql);
@@ -516,6 +525,7 @@
     function kill_parameter () {
         $database =& mamboDatabase::getInstance();
         $name = $this->name;
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__parameters WHERE param_name='$name'";
         $database->setQuery($sql);
         $database->query();
@@ -580,6 +590,7 @@
         $udir->deleteAll();
         $adir = new mosDirectory($this->admin_dir);
         $adir->deleteAll();
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__components WHERE `option`='$com_name'";
         $database->setQuery($sql);
         if (!$database->query()) {
@@ -602,6 +613,7 @@
         $special = $this->special_file[0];
         $database =& mamboDatabase::getInstance();
         $name = $this->getName('module');
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__modules WHERE module='$special' AND client_id='$client_id'";
         $database->setQuery($sql);
         if (!$database->query()) {
@@ -621,6 +633,7 @@
         $name = $this->getName('mambot');
         $element = $this->special_file[0];
         $group = $this->group;
+        // @RawSQLUse, trivial_implementation, DELETE
         $sql = "DELETE FROM #__mambots WHERE element='$element' AND folder='$group'";
         $database->setQuery($sql);
         if (!$database->query()) {
Index: administrator/components/com_installer/admin.installer.php
===================================================================
--- administrator/components/com_installer/admin.installer.php	(revision 1753)
+++ administrator/components/com_installer/admin.installer.php	(working copy)
@@ -327,6 +327,7 @@
 	*/
 	function component_uninstall( $cid, $option, $client=0 ) {
 		$database =& mamboDatabase::getInstance();
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$sql = "SELECT * FROM #__components WHERE id=$cid";
 		$database->setQuery($sql);
 		if (!$database->loadObject( $row )) {
@@ -359,6 +360,7 @@
 			$dir->deleteAll();
 			$dir = new mosDirectory(mosPathName(mamboCore::get('mosConfig_absolute_path').'/administrator/components/'.$com_name));
 			$dir->deleteAll();
+			// @RawSQLUse, trivial_implementation, DELETE
 			$sql = "DELETE FROM #__components WHERE `option`='$com_name'";
 			$database->setQuery($sql);
 			$database->query();
@@ -377,6 +379,7 @@
 	function module_uninstall( $id, $option, $client=0 ) {
 		$database =& mamboDatabase::getInstance();
 		$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT module, iscore, client_id FROM #__modules WHERE id = '$id'";
 		$database->setQuery( $query );
 		$database->loadObject( $row );
@@ -385,6 +388,7 @@
 			HTML_installer::showInstallMessage($message, 'Uninstall -  error', returnTo( $option, 'module', $row->client_id ? '' : 'admin' ) );
 			exit();
 		}
+		// @RawSQLUse, trivial_implementation, DELETE
 		$query = "DELETE FROM #__modules_menu WHERE moduleid=$id";
 		$database->setQuery( $query );
 		if (!$database->query()) {
@@ -411,6 +415,7 @@
 	function mambot_uninstall( $id, $option, $client=0 ) {
 		$database =& mamboDatabase::getInstance();
 		$mosConfig_absolute_path = mamboCore::get('mosConfig_absolute_path');
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT name, folder, element, iscore FROM #__mambots WHERE id = $id" );
 		$database->loadObject( $row );
 		if ($database->getErrorNum()) {
@@ -436,6 +441,7 @@
 			$showerrors = $parser->getErrors();
 		}
 		else {
+			// @RawSQLUse, trivial_implementation, DELETE
 			$database->setQuery("DELETE FROM #__mambots WHERE id = $id");
 			$ret = $database->query();
 			$showerrors = new mosError (T_('Uninstaller did its best with no XML file present'), _MOS_ERROR_WARN);
Index: administrator/components/com_templates/admin.templates.php
===================================================================
--- administrator/components/com_templates/admin.templates.php	(revision 1753)
+++ administrator/components/com_templates/admin.templates.php	(working copy)
@@ -115,8 +115,10 @@
 	$id = intval( $client == 'admin' );
 
 	if ($client=='admin') {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT template FROM #__templates_menu WHERE client_id='1' AND menuid='0'" );
 	} else {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'" );
 	}
 	$cur_template = $database->loadResult();
@@ -199,15 +201,19 @@
 	global $database;
 
 	if ($client=='admin') {
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery("DELETE FROM #__templates_menu WHERE client_id='1' AND menuid='0'");
 		$database->query();
 
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery("INSERT INTO #__templates_menu SET client_id='1', template='$p_tname', menuid='0'");
 		$database->query();
 	} else {
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery("DELETE FROM #__templates_menu WHERE client_id='0' AND menuid='0'");
 		$database->query();
 
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery("INSERT INTO #__templates_menu SET client_id='0', template='$p_tname', menuid='0'");
 		$database->query();
 
@@ -225,6 +231,7 @@
 
 	$client_id = $client=='admin' ? 1 : 0;
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery("SELECT template FROM #__templates_menu WHERE client_id='$client_id' AND menuid='0'");
 	$cur_template = $database->loadResult();
 
@@ -377,6 +384,7 @@
 
 	// get selected pages for $menulist
 	if ( $p_tname ) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT menuid AS value FROM #__templates_menu WHERE client_id='0' AND template='$p_tname'" );
 		$lookup = $database->loadObjectList();
 	}
@@ -402,8 +410,10 @@
 			// If 'None' is not in array
 			if ( $menuid <> -999 ) {
 				// check if there is already a template assigned to this menu item
+				// @RawSQLUse, trivial_implementation, DELETE
 				$database->setQuery( "DELETE FROM #__templates_menu WHERE client_id='0' AND menuid='$menuid'" );
 				$database->query();
+				// @RawSQLUse, trivial_implementation, INSERT
 				$database->setQuery( "INSERT INTO #__templates_menu SET client_id='0', template='$template', menuid='$menuid'" );
 				$database->query();
 			}
@@ -419,6 +429,7 @@
 function editPositions( $option ) {
 	global $database;
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT * FROM #__template_positions" );
 	$positions = $database->loadObjectList();
 
@@ -433,6 +444,7 @@
 	$positions = mosGetParam( $_POST, 'position', array() );
 	$descriptions = mosGetParam( $_POST, 'description', array() );
 
+	// @RawSQLUse, trivial_implementation, DELETE
 	$query = 'DELETE FROM #__template_positions';
 	$database->setQuery( $query );
 	$database->query();
@@ -442,6 +454,7 @@
 	    $description = mosGetParam( $descriptions, $id, '' );
 		if ($position != '') {
 		    $id = intval( $id );
+		    // @RawSQLUse, trivial_implementation, INSERT
 		    $query = "INSERT INTO #__template_positions"
 				. "\nVALUES ($id,'$position','$description')";
 			$database->setQuery( $query );
Index: administrator/components/com_menumanager/admin.menumanager.php
===================================================================
--- administrator/components/com_menumanager/admin.menumanager.php	(revision 1753)
+++ administrator/components/com_menumanager/admin.menumanager.php	(working copy)
@@ -101,6 +101,7 @@
 	}
 
 	// Query to get published menu item counts
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.menutype, count( a.menutype ) as num"
 	. "\n FROM #__menu AS a"
 	. "\n WHERE a.published = 1"
@@ -111,6 +112,7 @@
 	$published = $database->loadObjectList();
 
 	// Query to get unpublished menu item counts
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.menutype, count( a.menutype ) as num"
 	. "\n FROM #__menu AS a"
 	. "\n WHERE a.published = 0"
@@ -122,6 +124,7 @@
 	if (!$unpublished) $unpublished = array();
 
 	// Query to get trash menu item counts
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.menutype, count( a.menutype ) as num"
 	. "\n FROM #__menu AS a"
 	. "\n WHERE a.published = -2"
@@ -213,6 +216,7 @@
 	}
 	
 	// check for unique menutype for new menus
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT params"
 	. "\n FROM #__modules"
 	. "\n WHERE module = 'mod_mainmenu'"
@@ -251,6 +255,7 @@
 			
 			// module assigned to show on All pages by default
 			// ToDO: Changed to become a mambo db-object
+			// @RawSQLUse, trivial_implementation, INSERT
 			$query = "INSERT INTO #__modules_menu VALUES ( $row->id, 0 )";
 			$database->setQuery( $query );
 			if ( !$database->query() ) {
@@ -307,6 +312,7 @@
 			
 		// change menutype of all menuitems using old menutype
 			if ( $menutype <> $old_menutype ) {
+				// @RawSQLUse, trivial_implementation, UPDATE
 				$query = "UPDATE #__menu SET menutype = '$menutype' WHERE menutype = '$old_menutype'";
 				$database->setQuery( $query );
 				$database->query();
@@ -332,6 +338,7 @@
 
 	$menus = implode("','",$types);
 	// list of menu items to delete
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = 	"SELECT a.name, a.id"
 	. "\n FROM #__menu AS a"
 	. "\n WHERE ( a.menutype IN ( '$menus' ) )"
@@ -361,6 +368,7 @@
 	}
 
 	@$mids = implode( ',', $mid );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT id, title"
 	. "\n FROM #__modules"
 	. "\n WHERE id IN ( $mids )"
@@ -388,6 +396,7 @@
 		$mids = implode( ',', $mids );
 	}
 	// delete menu items
+	// @RawSQLUse, trivial_implementation, DELETE
 	$query = 	"DELETE FROM #__menu"
 	. "\n WHERE ( id IN ( $mids ) )"
 	;
@@ -406,12 +415,14 @@
 	// checks whether any modules to delete
 	if ( $cids ) {		
 		// delete modules
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__modules WHERE id IN ( $cids )" );
 		if ( !$database->query() ) {
 			echo "<script> alert('". $database->getErrorMsg() ."'); window.history.go(-1); </script>\n";
 			exit;
 		}
 		// delete all module entires in mos_modules_menu
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__modules_menu WHERE moduleid IN ( ". $cids ." )" );
 		if ( !$database->query() ) {
 			echo "<script> alert('". $database->getErrorMsg() ."');</script>\n";
@@ -437,6 +448,7 @@
 	global $database;
 
 	// Content Items query
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = 	"SELECT a.name, a.id"
 	. "\n FROM #__menu AS a"
 	. "\n WHERE ( a.menutype IN ( '". $type ."' ) )"
@@ -459,6 +471,7 @@
 	$module_name 	= mosGetParam( $_POST, 'module_name', 'New Module' );
 	
 	// check for unique menutype for new menu copy
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT params"
 	. "\n FROM #__modules"
 	. "\n WHERE module = 'mod_mainmenu'"
@@ -522,6 +535,7 @@
 	$row->updateOrder( "position='". $row->position ."'" );
 	// module assigned to show on All pages by default
 	// ToDO: Changed to become a mambo db-object
+	// @RawSQLUse, trivial_implementation, INSERT
 	$query = "INSERT INTO #__modules_menu VALUES ( $row->id, 0 )";
 	$database->setQuery( $query );
 	if ( !$database->query() ) {
Index: administrator/components/com_comment/admin.comment.php
===================================================================
--- administrator/components/com_comment/admin.comment.php	(revision 1753)
+++ administrator/components/com_comment/admin.comment.php	(working copy)
@@ -75,11 +75,13 @@
 	if ($search) {
 		$where[] = "LOWER(comments) LIKE '%$search%'";
 	}
+
 	$database->setQuery( "SELECT count(*) FROM #__comment AS a" . (count( $where ) ? "\nWHERE " . implode( ' AND ', $where ) : "") );
 	$total = $database->loadResult();
 	echo $database->getErrorMsg();
 	include_once( "includes/pageNavigation.php" );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit  );
+
 	$database->setQuery( "SELECT c.title, a.* FROM #__comment as a"
 		. "\n LEFT JOIN #__content AS c ON a.articleid = c.id"
 		. (count( $where ) ? "\n WHERE " . implode( ' AND ', $where ) : "")
@@ -104,6 +106,7 @@
 	$row = new moscomment( $database );
 	$row->load( $uid );
 	$contentitem[] = mosHTML::makeOption( '0', 'Select Content Item' );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT id AS value, title AS text FROM #__content ORDER BY title" );
 	$contentitem = array_merge( $contentitem, $database->loadObjectList() );
 	if (count( $contentitem ) < 1) {
@@ -155,6 +158,7 @@
     exit;
   }
   $cids = implode( ',', $cid );
+  // @RawSQLUse, trivial_implementation, UPDATE
   $database->setQuery( "UPDATE #__comment SET published='$publish' WHERE id IN ($cids)" );
   if (!$database->query()) {
     echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
@@ -193,6 +197,7 @@
       <td align="left" valign="top"><select size="5" name="mcselections[]" class="inputbox" multiple="multiple">
       <?php
         $seclistarray = explode (",", $allow_comments_in_sections);
+        // @RawSQLUse, trivial_implementation, SELECT
         $database -> setQuery("SELECT id,title FROM #__sections ORDER BY title ASC");
         $dbsectionlist = $database -> loadObjectList();
 				echo "<option value='0' ";
@@ -342,6 +347,7 @@
 	global $database;
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__comment WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
Index: administrator/components/com_config/admin.config.php
===================================================================
--- administrator/components/com_config/admin.config.php	(revision 1753)
+++ administrator/components/com_config/admin.config.php	(working copy)
@@ -286,6 +286,7 @@
 	reset($langs);
 
 	// compile list of the editors
+
 	$query = "SELECT id AS value, name AS text"
 	. "\n FROM #__mambots"
 	. "\n WHERE folder='editors' AND published >= 0"
@@ -294,6 +295,7 @@
 	$database->setQuery( $query );
 	$edits = $database->loadObjectList();
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT id"
 	. "\n FROM #__mambots"
 	. "\n WHERE folder='editors' AND published = 1"
@@ -469,6 +471,7 @@
 
 	$editor = intval( mosGetParam( $_POST, 'editor', 0 ) );
 	if ($editor > 0) {
+
 		$query = "UPDATE #__mambots"
 	    . "\n SET published = 0"
 	    . "\n WHERE published >= 0 AND folder='editors'"
@@ -476,6 +479,7 @@
 		$database->setQuery( $query );
 		$database->query() or die( $database->getErrorMsg() );
 
+		// @RawSQLUse, trivial_implementation, UPDATE
 		$query = "UPDATE #__mambots"
 	    . "\n SET published = 1"
 	    . "\n WHERE id = $editor"
Index: administrator/components/com_poll/poll.class.php
===================================================================
--- administrator/components/com_poll/poll.class.php	(revision 1753)
+++ administrator/components/com_poll/poll.class.php	(working copy)
@@ -50,6 +50,7 @@
 			return false;
 		}
 		// check for existing title
+		// @RawSQLUse, trivial_implementation, SELECT
 		$this->_db->setQuery( "SELECT id FROM #__polls WHERE title='$this->title'"
 		);
 
@@ -74,16 +75,19 @@
 		}
 
 		if (mosDBTable::delete( $oid )) {
+			// @RawSQLUse, trivial_implementation, DELETE
 			$this->_db->setQuery( "DELETE FROM #__poll_data WHERE pollid='".$this->$k."'" );
 			if (!$this->_db->query()) {
 				$this->_error .= $this->_db->getErrorMsg() . "\n";
 			}
 
+			// @RawSQLUse, trivial_implementation, DELETE
 			$this->_db->setQuery( "DELETE FROM #__poll_date WHERE pollid='".$this->$k."'" );
 			if (!$this->_db->query()) {
 				$this->_error .= $this->_db->getErrorMsg() . "\n";
 			}
 
+			// @RawSQLUse, trivial_implementation, DELETE
 			$this->_db->setQuery( "DELETE from #__poll_menu where pollid='".$this->$k."'" );
 			if (!$this->_db->query()) {
 				$this->_error .= $this->_db->getErrorMsg() . "\n";
Index: administrator/components/com_poll/toolbar.poll.html.php
===================================================================
--- administrator/components/com_poll/toolbar.poll.html.php	(revision 1753)
+++ administrator/components/com_poll/toolbar.poll.html.php	(working copy)
@@ -34,6 +34,7 @@
 		global $database;
 		global $id;
 		
+		// @RawSQLUse, trivial_implementation, SELECT
 		$sql = "SELECT template FROM #__templates_menu WHERE client_id='0' AND menuid='0'";
 		$database->setQuery( $sql );
 		$cur_template = $database->loadResult();
Index: administrator/components/com_poll/admin.poll.php
===================================================================
--- administrator/components/com_poll/admin.poll.php	(revision 1753)
+++ administrator/components/com_poll/admin.poll.php	(working copy)
@@ -72,6 +72,7 @@
 	$limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
 	$limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT COUNT(*) FROM #__polls" );
 	$total = $database->loadResult();
 
@@ -114,6 +115,7 @@
 
 	if ($uid) {
 		$row->checkout( $my->id );
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT id, text FROM #__poll_data"
 		. "\n WHERE pollid='$uid'"
 		. "\n ORDER BY id"
@@ -126,6 +128,7 @@
 
 	// get selected pages
 	if ( $uid ) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT menuid AS value FROM #__poll_menu WHERE pollid='$row->id'" );
 		$lookup = $database->loadObjectList();
 	} else {
@@ -169,9 +172,11 @@
 		}
 
 		if ($isNew) {
+			// @RawSQLUse, trivial_implementation, INSERT
 			$database->setQuery( "INSERT INTO #__poll_data (pollid,text) VALUES ($row->id,'$text')" );
 			$database->query();
 		} else {
+			// @RawSQLUse, trivial_implementation, UPDATE
 			$database->setQuery( "UPDATE #__poll_data SET text='$text' WHERE id='$i' AND pollid='$row->id'" );
 			$database->query();
 		}
@@ -180,10 +185,12 @@
 	// update the menu visibility
 	$selections = mosGetParam( $_POST, 'selections', array() );
 
+	// @RawSQLUse, trivial_implementation, DELETE
 	$database->setQuery( "DELETE from #__poll_menu where pollid='$row->id'" );
 	$database->query();
 
 	for ($i=0, $n=count($selections); $i < $n; $i++) {
+		// @RawSQLUse, trivial_implementation, INSERT
 		$database->setQuery( "INSERT INTO #__poll_menu SET pollid='$row->id', menuid='$selections[$i]'" );
 		$database->query();
 	}
Index: administrator/components/com_poll/toolbar.poll.php
===================================================================
--- administrator/components/com_poll/toolbar.poll.php	(revision 1753)
+++ administrator/components/com_poll/toolbar.poll.php	(working copy)
@@ -27,6 +27,7 @@
 			$cid = array(0);
 		}
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT published FROM #__polls WHERE id='$cid[0]'" );
 		$published = $database->loadResult();
 
@@ -38,6 +39,7 @@
 	case 'editA':
 		$id = mosGetParam( $_REQUEST, 'id', 0 );
 		
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT published FROM #__polls WHERE id='$id'" );
 		$published = $database->loadResult();
 
Index: administrator/components/com_weblinks/admin.weblinks.php
===================================================================
--- administrator/components/com_weblinks/admin.weblinks.php	(revision 1753)
+++ administrator/components/com_weblinks/admin.weblinks.php	(working copy)
@@ -228,6 +228,7 @@
 	}
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__weblinks WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
Index: administrator/components/com_typedcontent/admin.typedcontent.php
===================================================================
--- administrator/components/com_typedcontent/admin.typedcontent.php	(revision 1753)
+++ administrator/components/com_typedcontent/admin.typedcontent.php	(working copy)
@@ -229,18 +229,21 @@
 			$row->publish_down = "Never";
 		}
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name from #__users"
 		. "\n WHERE id=$row->created_by"
 		;
 		$database->setQuery( $query );
 		$row->creator = $database->loadResult();
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name from #__users"
 		. "\n WHERE id=$row->modified_by"
 		;
 		$database->setQuery( $query );
 		$row->modifier = $database->loadResult();
 		
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT content_id from #__content_frontpage"
 		. "\n WHERE content_id=$row->id"
 		;
@@ -361,6 +364,7 @@
 		// toggles go to first place
 		if (!$fp->load( $row->id )) {
 			// new entry
+			// @RawSQLUse, trivial_implementation, INSERT
 			$database->setQuery( "INSERT INTO #__content_frontpage VALUES ('$row->id','1')" );
 			if (!$database->query()) {
 				echo "<script> alert('".$database->stderr()."');</script>\n";
@@ -425,6 +429,7 @@
 	$ordering = '0';
 	//seperate contentids
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$query = 	"UPDATE #__content SET state = '". $state ."', ordering = '". $ordering ."'"
 	. "\n WHERE id IN ( ". $cids ." )"
 	;
@@ -647,6 +652,7 @@
 			$fp->ordering = 0;
 		} else {
 			// new entry
+			// @RawSQLUse, trivial_implementation, INSERT
 			$database->setQuery( "INSERT INTO #__content_frontpage VALUES ('$id','0')" );
 			if (!$database->query()) {
 				echo "<script> alert('".$database->stderr()."');</script>\n";
Index: administrator/components/com_trash/admin.trash.php
===================================================================
--- administrator/components/com_trash/admin.trash.php	(revision 1753)
+++ administrator/components/com_trash/admin.trash.php	(working copy)
@@ -131,6 +131,7 @@
 
 	if ( $cids ) {
 		// Content Items query
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = 	"SELECT a.title AS name"
 		. "\n FROM #__content AS a"
 		. "\n WHERE ( a.id IN (". $cids .") )"
@@ -142,6 +143,7 @@
 		$type = "content";
 	} else if ( $mids ) {
 		// Content Items query
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = 	"SELECT a.name"
 		. "\n FROM #__menu AS a"
 		. "\n WHERE ( a.id IN (". $mids .") )"
@@ -199,6 +201,7 @@
 
 	if ( $cids ) {
 		// Content Items query
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = 	"SELECT a.title AS name"
 		. "\n FROM #__content AS a"
 		. "\n WHERE ( a.id IN (". $cids .") )"
@@ -210,6 +213,7 @@
 		$type = "content";
 	} else if ( $mids ) {
 		// Content Items query
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = 	"SELECT a.name"
 		. "\n FROM #__menu AS a"
 		. "\n WHERE ( a.id IN (". $mids .") )"
@@ -241,10 +245,12 @@
 	$cids = implode( ',', $cid );
 
 	if ( $type == "content" ) {
+		// @RawSQLUse, trivial_implementation, UPDATE
 		$query = 	"UPDATE #__content SET state = '". $state ."', ordering = '". $ordering ."'"
 		. "\n WHERE id IN ( ". $cids ." )"
 		;
 	} else if ( $type == "menu" ) {
+		// @RawSQLUse, trivial_implementation, UPDATE
 		$query = 	"UPDATE #__menu SET published = '". $state ."', ordering = '9999'"
 		. "\n WHERE id IN ( ". $cids ." )"
 		;
Index: administrator/components/com_syndicate/admin.syndicate.php
===================================================================
--- administrator/components/com_syndicate/admin.syndicate.php	(revision 1753)
+++ administrator/components/com_syndicate/admin.syndicate.php	(working copy)
@@ -44,6 +44,7 @@
 function showSyndicate( $option ) {
 	global $database, $mainframe, $mosConfig_list_limit;
 	
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.id"
 	. "\n FROM #__components AS a"
 	. "\n WHERE a.name = 'Syndicate'"
Index: administrator/components/com_categories/admin.categories.php
===================================================================
--- administrator/components/com_categories/admin.categories.php	(revision 1753)
+++ administrator/components/com_categories/admin.categories.php	(working copy)
@@ -122,6 +122,7 @@
 	if (intval( $section ) > 0) {
 		$table = 'content';
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name FROM #__sections WHERE id='$section'";
 		$database->setQuery( $query );
 		$section_name = $database->loadResult();
@@ -131,6 +132,7 @@
 	} else if (strpos( $section, 'com_' ) === 0) {
 		$table = substr( $section, 4 );
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name FROM #__components WHERE link='option=$section'";
 		$database->setQuery( $query );
 		$section_name = $database->loadResult();
@@ -148,6 +150,7 @@
 	}
 
 	// get the total number of records
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT count(*) FROM #__categories WHERE section='$section'";
 	$database->setQuery( $query );
 	$total = $database->loadResult();
@@ -162,6 +165,7 @@
 		$order 			= "\n ORDER BY c.section, c.ordering, c.name";
 		$section_name 	= 'All Content';
 		// get the total number of records
+
 		$database->setQuery( "SELECT count(*) FROM #__categories INNER JOIN #__sections AS s ON s.id = section" );
 		$total = $database->loadResult();
 		$type 			= 'content';
@@ -177,6 +181,7 @@
 	require_once( $mosConfig_absolute_path . '/administrator/includes/pageNavigation.php' );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit );
 
+
 	$query = "SELECT  c.*, c.checked_out as checked_out_contact_category, g.name AS groupname, u.name AS editor,"
 	. "COUNT(DISTINCT s2.checked_out) AS checked_out"
 	. $content_add
@@ -209,6 +214,7 @@
 	$count = count( $rows );
 	// number of Active Items
 	for ( $i = 0; $i < $count; $i++ ) {
+
 		$query = "SELECT COUNT( a.id )"
 		. "\n FROM #__content AS a"
 		. "\n WHERE a.catid = ". $rows[$i]->id
@@ -220,6 +226,7 @@
 	}
 	// number of Trashed Items
 	for ( $i = 0; $i < $count; $i++ ) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT COUNT( a.id )"
 		. "\n FROM #__content AS a"
 		. "\n WHERE a.catid = ". $rows[$i]->id
@@ -263,6 +270,7 @@
 		$row->checkout( $my->id );
 		// code for Link Menu
 		if ( $row->section > 0 ) {
+
 			$query = "SELECT *"
 			. "\n FROM #__menu"
 			. "\n WHERE componentid = ". $row->id
@@ -298,6 +306,7 @@
 
 	// make order list
 	$order = array();
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT COUNT(*) FROM #__categories WHERE section='$row->section'" );
 	$max = intval( $database->loadResult() ) + 1;
 
@@ -307,6 +316,7 @@
 
 	// build the html select list for sections
 	if ( $section == 'content' ) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT s.id AS value, s.title AS text"
 		. "\n FROM #__sections AS s"
 		. "\n ORDER BY s.ordering"
@@ -343,6 +353,7 @@
 	$lists['link_type'] 		= mosHTML::selectList( $types, 'link_type', 'class="inputbox" size="1"', 'value', 'text' );;
 
 	// build the html select list for ordering
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT ordering AS value, title AS text"
 	. "\n FROM #__categories"
 	. "\n WHERE section = '$row->section'"
@@ -396,6 +407,7 @@
 
 	if ( $oldtitle ) {
 		if ($oldtitle != $row->title) {
+			// @RawSQLUse, trivial_implementation, UPDATE
 			$database->setQuery( "UPDATE #__menu SET name='$row->title' WHERE name='$oldtitle' AND type='content_category'" );
 			$database->query();
 		}
@@ -405,6 +417,7 @@
 	if ($row->section != 'com_contact_details' &&
 		$row->section != 'com_newsfeeds' &&
 		$row->section != 'com_weblinks') {
+		// @RawSQLUse, trivial_implementation, UPDATE, CONCEPT
 		$query = "UPDATE #__sections SET count=count+1"
 		. "\n WHERE id = '$row->section'"
 		;
@@ -469,6 +482,7 @@
 		$table = $section;
 	}
 
+
 	$query = "SELECT c.id, c.name, COUNT(s.catid) AS numcat"
 	. "\n FROM #__categories AS c"
 	. "\n LEFT JOIN #__$table AS s ON s.catid=c.id"
@@ -493,6 +507,7 @@
 
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__categories WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
@@ -597,16 +612,19 @@
 
 	## query to list selected categories
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name, a.section FROM #__categories AS a WHERE a.id IN ( ". $cids ." )";
 	$database->setQuery( $query );
 	$items = $database->loadObjectList();
 
 	## query to list items from categories
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.title FROM #__content AS a WHERE a.catid IN ( ". $cids ." ) ORDER BY a.catid, a.title";
 	$database->setQuery( $query );
 	$contents = $database->loadObjectList();
 
 	## query to choose section to move to
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name AS `text`, a.id AS `value` FROM #__sections AS a WHERE a.published = '1' ORDER BY a.name";
 	$database->setQuery( $query );
 	$sections = $database->loadObjectList();
@@ -629,6 +647,7 @@
 	$cids = implode( ',', $cid );
 	$total = count( $cid );
 
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$query = 	"UPDATE #__categories SET section = '". $sectionMove ."' "
 	. "WHERE id IN ( ". $cids ." )"
 	;
@@ -637,6 +656,7 @@
 		echo "<script> alert('". $database->getErrorMsg() ."'); window.history.go(-1); </script>\n";
 		exit();
 	}
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$query = 	"UPDATE #__content SET sectionid = '". $sectionMove ."' "
 	. "WHERE catid IN ( ". $cids ." )"
 	;
@@ -667,16 +687,19 @@
 
 	## query to list selected categories
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name, a.section FROM #__categories AS a WHERE a.id IN ( ". $cids ." )";
 	$database->setQuery( $query );
 	$items = $database->loadObjectList();
 
 	## query to list items from categories
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.title, a.id FROM #__content AS a WHERE a.catid IN ( ". $cids ." ) ORDER BY a.catid, a.title";
 	$database->setQuery( $query );
 	$contents = $database->loadObjectList();
 
 	## query to choose section to move to
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name AS `text`, a.id AS `value` FROM #__sections AS a WHERE a.published = '1' ORDER BY a.name";
 	$database->setQuery( $query );
 	$sections = $database->loadObjectList();
Index: administrator/components/com_sections/admin.sections.php
===================================================================
--- administrator/components/com_sections/admin.sections.php	(revision 1753)
+++ administrator/components/com_sections/admin.sections.php	(working copy)
@@ -112,6 +112,7 @@
 	$limitstart = $mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
 
 	// get the total number of records
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT count(*) FROM #__sections WHERE scope='$scope'" );
 	$total = $database->loadResult();
 
@@ -288,6 +289,7 @@
 	}
 	if ( $oldtitle ) {
 		if ( $oldtitle <> $row->title ) {
+			// @RawSQLUse, trivial_implementation, UPDATE
 			$database->setQuery( "UPDATE #__menu SET name='$row->title' WHERE name='$oldtitle' AND type='content_section'" );
 			$database->query();
 		}
@@ -365,6 +367,7 @@
 
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__sections WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
@@ -424,11 +427,13 @@
 
 	// check if section linked to menu items if unpublishing
 	if ( $publish == 0 ) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$database->setQuery( "SELECT id FROM #__menu WHERE type='content_section' AND componentid IN ($cids)" );
 		$menus = $database->loadObjectList();
 
 		if ($menus) {
 			foreach ($menus as $menu) {
+				// @RawSQLUse, trivial_implementation, UPDATE
 				$database->setQuery( "UPDATE #__menu SET published=$publish WHERE id=$menu->id" );
 				$database->query();
 			}
@@ -483,6 +488,7 @@
 
 	## query to list selected categories
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.name, a.id"
 	. "\n FROM #__categories AS a"
 	. "\n WHERE a.section IN ( ". $cids ." )"
@@ -491,6 +497,7 @@
 	$categories = $database->loadObjectList();
 
 	## query to list items from categories
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT a.title, a.id"
 	. "\n FROM #__content AS a"
 	. "\n WHERE a.sectionid IN ( ". $cids ." )"
Index: administrator/components/com_banners/admin.banners.php
===================================================================
--- administrator/components/com_banners/admin.banners.php	(revision 1753)
+++ administrator/components/com_banners/admin.banners.php	(working copy)
@@ -103,6 +103,7 @@
 	$limitstart = $mainframe->getUserStateFromRequest( "viewban{$option}limitstart", 'limitstart', 0 );
 
 	// get the total number of records
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT count(*) FROM #__banner" );
 	$total = $database->loadResult();
 
@@ -134,6 +135,7 @@
   }
   
 	// Build Client select list
+	// @RawSQLUse, trivial_implementation, SELECT
 	$sql	= "SELECT cid as value, name as text FROM #__bannerclient";
 	$database->setQuery($sql);
 	if (!$database->query()) {
@@ -246,6 +248,7 @@
 	$limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
 	$limitstart = $mainframe->getUserStateFromRequest( "viewcli{$option}limitstart", 'limitstart', 0 );
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	// get the total number of records
 	$database->setQuery( "SELECT count(*) FROM #__bannerclient" );
 	$total = $database->loadResult();
@@ -329,6 +332,7 @@
 	global $database;
 
 	for ($i = 0; $i < count($cid); $i++) {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT COUNT(bid) FROM #__banner WHERE cid='".$cid[$i]."'";
 		$database->setQuery($query);
 
@@ -340,10 +344,12 @@
 			mosRedirect( "index2.php?option=$option&task=listclients",
 			T_("Cannot delete client at this time as they have a banner still running") );
 		} else {
+			// @RawSQLUse, trivial_implementation, DELETE
 			$query="DELETE FROM #__bannerfinish WHERE `cid`='".$cid[$i]."'";
 			$database->setQuery($query);
 			$database->query();
 
+			// @RawSQLUse, trivial_implementation, DELETE
 			$query="DELETE FROM #__bannerclient WHERE `cid`='".$cid[$i]."'";
 			$database->setQuery($query);
 			$database->query();
Index: administrator/components/com_statistics/admin.statistics.php
===================================================================
--- administrator/components/com_statistics/admin.statistics.php	(revision 1753)
+++ administrator/components/com_statistics/admin.statistics.php	(working copy)
@@ -76,6 +76,7 @@
 			break;
 	}
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT * FROM #__stats_agents WHERE type='0' ORDER BY $order_by" );
 	$browsers = $database->loadObjectList();
 
@@ -84,6 +85,7 @@
 	$database->loadObject( $bstats );
 
 	// platform statistics
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT * FROM #__stats_agents WHERE type='1' ORDER BY hits DESC" );
 	$platforms = $database->loadObjectList();
 
@@ -92,6 +94,7 @@
 	$database->loadObject( $pstats );
 
 	// domain statistics
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT * FROM #__stats_agents WHERE type='2' ORDER BY hits DESC" );
 	$tldomains = $database->loadObjectList();
 
@@ -105,6 +108,7 @@
 function showPageImpressions( $option, $task ) {
 	global $database, $mainframe, $mosConfig_list_limit;
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT count(id) FROM #__content";
 	$database->setQuery($query);
 	$total = $database->loadResult();
@@ -115,6 +119,7 @@
 	require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit  );
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT id, title, created, hits FROM #__content ORDER BY hits DESC LIMIT $pageNav->limitstart, $pageNav->limit";
 	$database->setQuery($query);
 
@@ -131,12 +136,14 @@
 	$limitstart = $mainframe->getUserStateFromRequest( "view{$option}{$task}limitstart", 'limitstart', 0 );
 
 	// get the total number of records
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT count(*) FROM #__core_log_searches");
 	$total = $database->loadResult();
 
 	require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit );
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT *"
 	. "\nFROM #__core_log_searches"
 	. "\nORDER BY hits DESC"
Index: administrator/components/com_users/admin.users.php
===================================================================
--- administrator/components/com_users/admin.users.php	(revision 1753)
+++ administrator/components/com_users/admin.users.php	(working copy)
@@ -115,6 +115,7 @@
 		$where[] = "(a.gid NOT IN (" . implode( ',', $pgids ) . "))";
 	}
 
+
 	$query = "SELECT COUNT(a.id)"
 	. "\n FROM #__users AS a";
 
@@ -152,6 +153,7 @@
 		return false;
 	}
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$template = 'SELECT COUNT(s.userid) FROM #__session AS s WHERE s.userid = %d';
 	$n = count( $rows );
 	for ($i = 0; $i < $n; $i++) {
@@ -162,6 +164,7 @@
 	}
 
 	// get list of Groups for dropdown filter
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT name AS value, name AS text"
 	. "\n FROM #__core_acl_aro_groups"
 	. "\n WHERE name != 'ROOT'"
@@ -188,6 +191,7 @@
 	// load the row from the db table
 	$row->load( $uid );
 	if ( $uid ) {
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$query = "SELECT * FROM #__contact_details WHERE user_id='". $row->id ."'";
 		$database->setQuery( $query );
 		$contact = $database->loadObjectList();
@@ -287,6 +291,7 @@
 	}
 
 	// save usertype to usetype column
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT name"
 	. "\n FROM #__core_acl_aro_groups"
 	. "\n WHERE group_id = $row->gid"
@@ -313,10 +318,12 @@
 		if ($pwd) $mambothandler->trigger('userChange', array($loginfo));
 		if ($row->block) $mambothandler->trigger('userBlock', array($loginfo));
 		else $mambothandler->trigger('userUnblock', array($loginfo));
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT aro_id FROM #__core_acl_aro WHERE value='$row->id'";
 		$database->setQuery( $query );
 		$aro_id = $database->loadResult();
 
+		// @RawSQLUse, trivial_implementation, UPDATE
 		$query = "UPDATE #__core_acl_groups_aro_map"
 		. "\n SET group_id = '$row->gid'"
 		. "\n WHERE aro_id = '$aro_id'"
@@ -330,6 +337,7 @@
 		$mambothandler->trigger('userRegister', array($loginfo));
 		$mambothandler->trigger('userActivate', array($loginfo));
 		if ($row->block) $mambothandler->trigger('userBlock', array($loginfo));
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$query = "SELECT email FROM #__users WHERE id=$my->id";
 		$database->setQuery( $query );
 		$adminEmail = $database->loadResult();
@@ -352,6 +360,7 @@
 			$adminName = $mosConfig_fromname;
 			$adminEmail = $mosConfig_mailfrom;
 		} else {
+			// @RawSQLUse, trivial_implementation, SELECT
 			$query = "SELECT name, email FROM #__users WHERE usertype='super administrator'";
 			$database->setQuery( $query );
 			$rows = $database->loadObjectList();
@@ -401,6 +410,7 @@
 	$super_gid = $acl->get_group_id('super administrator');
 	$admin_gid = $acl->get_group_id('administrator');
 	$cids = implode( ',', $cid );
+
 	$database->setQuery("SELECT COUNT(id) FROM #__users WHERE id IN ($cids) AND gid IN ($super_gid,$admin_gid)");
 	if ( $database->getErrorMsg() ) {
 		echo $database->stderr();
@@ -426,6 +436,7 @@
 			$mambothandler =& mosMambotHandler::getInstance();
 			$mambothandler->loadBotGroup('authenticator');
 			$cids = implode(',', $deleted);
+			// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 			$query = "SELECT username FROM #__users WHERE id IN ($cids)";
 			$database->setQuery($query);
 			$results = $database->loadResultArray();
@@ -462,6 +473,7 @@
 
 	$cids = implode( ',', $cid );
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "UPDATE #__users SET block='$block' WHERE id IN ($cids)";
 	$database->setQuery( $query );
 	if (!$database->query()) {
@@ -470,6 +482,7 @@
 	}
 	$mambothandler =& mosMambotHandler::getInstance();
 	$mambothandler->loadBotGroup('authenticator');
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT username FROM #__users WHERE id IN ($cids)";
 	$database->setQuery($query);
 	$results = $database->loadResultArray();
@@ -496,6 +509,7 @@
 		$cids = implode( ',', $cid );
 	}
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "DELETE FROM #__session WHERE userid IN ($cids)";
 	$database->setQuery( $query );
 	$database->query();
Index: administrator/components/com_mambots/admin.mambots.php
===================================================================
--- administrator/components/com_mambots/admin.mambots.php	(revision 1753)
+++ administrator/components/com_mambots/admin.mambots.php	(working copy)
@@ -131,6 +131,7 @@
 	}
 
 	// get list of Positions for dropdown filter
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT folder AS value, folder AS text"
 	. "\n FROM #__mambots"
 	. "\n WHERE client_id = '$client_id'"
Index: administrator/components/com_mambots/toolbar.mambots.html.php
===================================================================
--- administrator/components/com_mambots/toolbar.mambots.html.php	(revision 1753)
+++ administrator/components/com_mambots/toolbar.mambots.html.php	(working copy)
@@ -39,6 +39,7 @@
                 $cid = (int) $_GET['id'];
             }
             $database =& mamboDatabase::getInstance();
+            // @RawSQLUse, trivial_implementation, SELECT
             $database->setQuery('select element from #__mambots where id = '.$cid);
             $result = $database->loadResult();
             mosMenuBar::help( $result ? $result : 'edit' );
Index: administrator/components/com_mostlydbadmin/admin.mostlydbadmin.php
===================================================================
--- administrator/components/com_mostlydbadmin/admin.mostlydbadmin.php	(revision 1753)
+++ administrator/components/com_mostlydbadmin/admin.mostlydbadmin.php	(working copy)
@@ -55,6 +55,7 @@
 function dbBackup( $p_option ) {
 	global $database;
 
+	// @RawSQLUse, trivial_implementation
 	$database->setQuery( "SHOW tables" );
 	$tables = $database->loadResultArray();
 	$tables2 = array( mosHTML::makeOption( 'all', T_('All Mambo Tables') ) );
@@ -112,6 +113,7 @@
 
 	if ($tables[0] == "all") {
 		array_pop($tables);
+		// @RawSQLUse, trivial_implementation
 		$database->setQuery("SHOW tables");
 		$database->query();
 		$tables = array_merge($tables, $database->loadResultArray());
@@ -122,6 +124,7 @@
 	{
 		foreach ($tables as $tblval)
 		{
+			// @RawSQLUse, trivial_implementation
 			$database->setQuery("SHOW CREATE table $tblval");
 			$database->query();
 			$CreateTable[$tblval] = $database->loadResultArray(1);
@@ -133,6 +136,7 @@
 	{
 		foreach ($tables as $tblval)
 		{
+			// @RawSQLUse, trivial_implementation
 			$database->setQuery("SHOW FIELDS FROM $tblval");
 			$database->query();
 			$fields = $database->loadObjectList();
@@ -172,6 +176,7 @@
 			if ($OutType == 'html') {
 				$OutBuffer .= "<div align=\"left\">";
 				$OutBuffer .= "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">";
+				// @RawSQLUse, trivial_implementation, SELECT
 				$database->setQuery("SELECT * FROM $tblval");
 				$rows = $database->loadObjectList();
 
@@ -209,6 +214,7 @@
 				$OutBuffer .= "</table></div><br />";
 			} else {
 				$OutBuffer .= "#\n# Dumping data for table `$tblval`\n#\n";
+				// @RawSQLUse, trivial_implementation, SELECT
 				$database->setQuery("SELECT * FROM $tblval");
 				$rows = $database->loadObjectList(); if (!$rows) $rows = array();
 				foreach($rows as $row)
Index: administrator/components/com_massmail/admin.massmail.php
===================================================================
--- administrator/components/com_massmail/admin.massmail.php	(revision 1753)
+++ administrator/components/com_massmail/admin.massmail.php	(working copy)
@@ -80,6 +80,7 @@
 	$rows = array();
 	if ( count( $to['users'] ) || $gou === '0' ) {
 		// Get sending email address
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT email FROM #__users WHERE id='$my->id'";
 		$database->setQuery( $query );
 		$my->email = $database->loadResult();
Index: administrator/components/com_messages/admin.messages.php
===================================================================
--- administrator/components/com_messages/admin.messages.php	(revision 1753)
+++ administrator/components/com_messages/admin.messages.php	(working copy)
@@ -64,6 +64,7 @@
 function editConfig( $option ) {
 	global $database, $my;
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT cfg_name, cfg_value FROM #__messages_cfg WHERE user_id='$my->id'" );
 	$data = $database->loadObjectList( 'cfg_name' );
 
@@ -78,12 +79,14 @@
 function saveConfig( $option ) {
 	global $database, $my;
 
+	// @RawSQLUse, trivial_implementation, DELETE
 	$database->setQuery( "DELETE FROM #__messages_cfg WHERE user_id='$my->id'" );
 	$database->query();
 
 	$vars = mosGetParam( $_POST, 'vars', array() );
 	foreach ($vars as $k=>$v) {
 		$v = $database->getEscaped( $v );
+		// @RawSQLUse, trivial_implementation, INSERT
 		$database->setQuery( "INSERT INTO #__messages_cfg (user_id,cfg_name,cfg_value)"
 			. "\nVALUES ('$my->id','$k','$v')"
 		);
@@ -102,6 +105,7 @@
 
 	// get list of usernames
 	$recipients = array( mosHTML::makeOption( '0', '- Select User -' ) );
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT id AS value, username AS text FROM #__users"
 	."\n WHERE gid IN ($gids)"
 	. "\n ORDER BY name" );
@@ -142,6 +146,7 @@
 
 	$msg	 = $row->subject.' - '.$row->message;
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$sql = "SELECT a.id, a.name, a.email"
 		. "\nFROM #__users AS a"
 		. "\nWHERE a.sendEmail = '1'"
@@ -214,6 +219,7 @@
 	);
 	$database->loadObject( $row );
 
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$database->setQuery( "UPDATE #__messages SET state='1' WHERE message_id='$uid'" );
 	$database->query();
 
@@ -229,6 +235,7 @@
 	}
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE
 		$database->setQuery( "DELETE FROM #__messages WHERE message_id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
Index: administrator/components/com_modules/toolbar.modules.php
===================================================================
--- administrator/components/com_modules/toolbar.modules.php	(revision 1753)
+++ administrator/components/com_modules/toolbar.modules.php	(working copy)
@@ -28,6 +28,7 @@
 		
 		$published = 0;
 		if ( $mid ) {
+			// @RawSQLUse, trivial_implementation, SELECT
 			$query = "SELECT published FROM #__modules WHERE id='$mid'";
 			$database->setQuery( $query );
 			$published = $database->loadResult();
Index: administrator/components/com_modules/toolbar.modules.html.php
===================================================================
--- administrator/components/com_modules/toolbar.modules.html.php	(revision 1753)
+++ administrator/components/com_modules/toolbar.modules.html.php	(working copy)
@@ -58,6 +58,7 @@
 		    $cid = (int) $_GET['id'];
 		}
 		$database =& mamboDatabase::getInstance();
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$database->setQuery('select module from #__modules where id = '.$cid);
 		$result = substr($database->loadResult(), 4);
 
Index: administrator/components/com_modules/admin.modules.php
===================================================================
--- administrator/components/com_modules/admin.modules.php	(revision 1753)
+++ administrator/components/com_modules/admin.modules.php	(working copy)
@@ -160,6 +160,7 @@
 	$lists['position']	= mosHTML::selectList( $positions, 'filter_position', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_position" );
 
 	// get list of Positions for dropdown filter
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT module AS value, module AS text"
 	. "\n FROM #__modules"
 	. "\n WHERE client_id = '$client_id'"
@@ -206,10 +207,12 @@
 	}
 	$row->updateOrder( "position='$row->position' AND ($where)" );
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$database->setQuery( "SELECT menuid FROM #__modules_menu WHERE moduleid='$uid'" );
 	$rows = $database->loadResultArray();
 
 	foreach($rows as $menuid) {
+		// @RawSQLUse, trivial_implementation, INSERT
 		$database->setQuery( "INSERT INTO #__modules_menu"
 		. "\nSET moduleid='$row->id', menuid='$menuid'"
 		);
@@ -266,12 +269,14 @@
 
 	$menus = mosGetParam( $_POST, 'selections', array() );
 
+	// @RawSQLUse, trivial_implementation, DELETE
 	$database->setQuery( "DELETE FROM #__modules_menu WHERE moduleid='$row->id'" );
 	$database->query();
 
 	foreach ($menus as $menuid){
 		// this check for the blank spaces in the select box that have been added for cosmetic reasons
-		if ( $menuid <> "-999" && $menuid <> "-998") {  
+		if ( $menuid <> "-999" && $menuid <> "-998") {
+			// @RawSQLUse, trivial_implementation, INSERT 
 			$query = "INSERT INTO #__modules_menu SET moduleid='$row->id', menuid='$menuid'";
 			$database->setQuery( $query );
 			$database->query();
@@ -339,6 +344,7 @@
 		$path				= 'mod0_xml';
 	}
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT position, ordering, showtitle, title"
 	. "\n FROM #__modules"
 	. "\n WHERE ". $where
@@ -351,6 +357,7 @@
 		return false;
 	}
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT position, description"
 	. "\n FROM #__template_positions"
 	. "\n WHERE position <> ''"
@@ -384,6 +391,7 @@
 
 	// get selected pages for $lists['selections']
 	if ( $uid ) {
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$query = 'SELECT menuid AS value FROM #__modules_menu WHERE moduleid='. $row->id;
 		$database->setQuery( $query );
 		$lookup = $database->loadObjectList();
@@ -441,6 +449,7 @@
 
 	$cids = implode( ',', $cid );
 
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$database->setQuery( "SELECT id, module, title, iscore, params FROM #__modules WHERE id IN ($cids)" );
 	if (!($rows = $database->loadObjectList())) {
 		echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
@@ -466,11 +475,13 @@
 
 	if (count( $cid )) {
 		$cids = implode( ',', $cid );
+		// @RawSQLUse, trivial_implementation, DELETE, CONCEPT
 		$database->setQuery( "DELETE FROM #__modules WHERE id IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
 			exit;
 		}
+		// @RawSQLUse, trivial_implementation, DELETE, CONCEPT
 		$database->setQuery( "DELETE from #__modules_menu WHERE moduleid IN ($cids)" );
 		if (!$database->query()) {
 			echo "<script> alert('".$database->getErrorMsg()."');</script>\n";
Index: administrator/components/com_content/admin.content.php
===================================================================
--- administrator/components/com_content/admin.content.php	(revision 1753)
+++ administrator/components/com_content/admin.content.php	(working copy)
@@ -194,6 +194,7 @@
 	}
 
 	// get the total number of records
+
 	$database->setQuery( "SELECT count(*) FROM #__content AS c, #__categories AS cc, #__sections AS s"
 	. (count( $where ) ? "\nWHERE " . implode( ' AND ', $where ) : "")
 	);
@@ -201,6 +202,7 @@
 	require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit );
 
+
 	$query = "SELECT c.*, g.name AS groupname, cc.name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author"
 	. "\n FROM #__categories AS cc, #__sections AS s, #__content AS c"
 	. "\n LEFT JOIN #__groups AS g ON g.id = c.access"
@@ -233,6 +235,7 @@
 	$lists['sectionid']	= mosAdminMenus::SelectSection( 'filter_sectionid', $filter_sectionid, $javascript );
 
 	// get list of Authors for dropdown filter
+
 	$query = "SELECT c.created_by AS value, u.name AS text"
 	. "\n FROM #__content AS c"
 	. "\n INNER JOIN #__sections AS s ON s.id = c.sectionid"
@@ -304,6 +307,7 @@
 	}
 
 	// get the total number of records
+
 	$query = "SELECT count(*)"
 	. "FROM #__content AS c, #__categories AS cc, #__sections AS s"
 	. ( count( $where ) ? "\n WHERE " . implode( ' AND ', $where ) : '' )
@@ -314,6 +318,7 @@
 	require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
 	$pageNav = new mosPageNav( $total, $limitstart, $limit  );
 
+
 	$query = "SELECT c.*, g.name AS groupname, cc.name, v.name AS author"
 	. "\n FROM #__categories AS cc, #__sections AS s, #__content AS c"
 	. "\n LEFT JOIN #__groups AS g ON g.id = c.access"
@@ -330,6 +335,7 @@
 	}
 
 	// get list of categories for dropdown filter
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT c.id AS value, c.title AS text"
 	. "\n FROM #__categories AS c"
 	. $filter
@@ -345,6 +351,7 @@
 	$section->load( $sectionid );
 
 	// get list of Authors for dropdown filter
+
 	$query = "SELECT c.created_by AS value, u.name AS text"
 	. "\n FROM #__content AS c"
 	. "\n INNER JOIN #__sections AS s ON s.id = c.sectionid"
@@ -396,11 +403,13 @@
 
 	// get the type name - which is a special category
 	 if ($row->sectionid){
+	 	// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name FROM #__sections WHERE id=$row->sectionid";
 		$database->setQuery( $query );
 		$section = $database->loadResult();
 		$contentSection = $section;
 	} else {
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name FROM #__sections WHERE id=$sectionid";
 		$database->setQuery( $query );
 		$section = $database->loadResult();
@@ -428,18 +437,21 @@
 			$row->publish_down = T_('Never');
 		}
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name from #__users"
 		. "\n WHERE id=$row->created_by"
 		;
 		$database->setQuery( $query );
 		$row->creator = $database->loadResult();
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT name from #__users"
 		. "\n WHERE id=$row->modified_by"
 		;
 		$database->setQuery( $query );
 		$row->modifier = $database->loadResult();
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT content_id from #__content_frontpage"
 		. "\n WHERE content_id=$row->id"
 		;
@@ -467,6 +479,7 @@
 
 	$javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\"";
 
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = "SELECT s.id AS value, s.title AS text"
 	. "\n FROM #__sections AS s"
 	. "\n ORDER BY s.ordering";
@@ -490,6 +503,7 @@
 	$sectioncategories[-1][] 	= mosHTML::makeOption( '-1', T_('Select Category') );
 	if ($sections) foreach($sections as $section) {
 		$sectioncategories[$section->value] = array();
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT id AS value, name AS text"
 			. "\n FROM #__categories"
 			. "\n WHERE section='$section->value'"
@@ -505,6 +519,7 @@
  		$categories[] 		= mosHTML::makeOption( '-1', T_('Select Category') );
  		$lists['catid'] 	= mosHTML::selectList( $categories, 'catid', 'class="inputbox" size="1"', 'value', 'text' );
   	} else {
+
  		$query = "SELECT id AS value, name AS text"
  		. "\n FROM #__categories"
  		. $where
@@ -516,6 +531,7 @@
   	}
 
 	// build the html select list for ordering
+
 	$query = "SELECT ordering AS value, title AS text"
 	. "\n FROM #__content"
 	. "\n WHERE catid='$row->catid'"
@@ -639,6 +655,7 @@
 		// toggles go to first place
 		if (!$fp->load( $row->id )) {
 			// new entry
+			// @RawSQLUse, trivial_implementation, INSERT
 			$database->setQuery( "INSERT INTO #__content_frontpage VALUES ('$row->id','1')" );
 			if (!$database->query()) {
 				echo "<script> alert('".$database->stderr()."');</script>\n";
@@ -709,6 +726,7 @@
 	$total = count ( $cid );
 	$cids = implode( ',', $cid );
 
+
 	$database->setQuery( "UPDATE #__content SET state='$state'"
 	. "\nWHERE id IN ($cids) AND (checked_out=0 OR (checked_out='".$my->id."'))"
 	);
@@ -770,6 +788,7 @@
 			$fp->ordering = 0;
 		} else {
 			// new entry
+			// @RawSQLUse, trivial_implementation, INSERT
 			$database->setQuery( "INSERT INTO #__content_frontpage VALUES ('$id','0')" );
 			if (!$database->query()) {
 				echo "<script> alert('".$database->stderr()."');</script>\n";
@@ -796,6 +815,7 @@
 	$ordering = '0';
 	//seperate contentids
 	$cids = implode( ',', $cid );
+	// @RawSQLUse, trivial_implementation, UPDATE
 	$query = 	"UPDATE #__content SET state = '". $state ."', ordering = '". $ordering ."'"
 	. "\n WHERE id IN ( ". $cids ." )"
 	;
@@ -856,6 +876,7 @@
 	//seperate contentids
 	$cids = implode( ',', $cid );
 	// Content Items query
+	// @RawSQLUse, trivial_implementation, SELECT
 	$query = 	"SELECT a.title"
 	. "\n FROM #__content AS a"
 	. "\n WHERE ( a.id IN (". $cids .") )"
@@ -864,6 +885,7 @@
 	$database->setQuery( $query );
 	$items = $database->loadObjectList();
 
+
 	$database->setQuery(
 	$query = 	"SELECT CONCAT_WS( ', ', s.id, c.id ) AS `value`, CONCAT_WS( '/', s.name, c.name ) AS `text`"
 	. "\n FROM #__sections AS s"
@@ -892,6 +914,7 @@
 	}
 
 	// find section name
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT a.name"
 	. "\n FROM #__sections AS a"
 	. "\n WHERE a.id = ". $newsect .""
@@ -900,6 +923,7 @@
 	$section = $database->loadResult();
 
 	// find category name
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = "SELECT  a.name"
 	. "\n FROM #__categories AS a"
 	. "\n WHERE a.id = ". $newcat .""
@@ -919,6 +943,7 @@
 		$row->updateOrder( "catid='$row->catid' AND state >= 0" );
 	}
 
+
 	$query = "UPDATE #__content SET sectionid = '". $newsect ."', catid='". $newcat ."'"
 	. "\n WHERE id IN ($cids)"
 	. "\n AND ( checked_out='0' OR ( checked_out='". $my->id ."') )"
@@ -956,6 +981,7 @@
 	//seperate contentids
 	$cids = implode( ',', $cid );
 	## Content Items query
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = 	"SELECT a.title"
 	. "\n FROM #__content AS a"
 	. "\n WHERE ( a.id IN (". $cids .") )"
@@ -965,6 +991,7 @@
 	$items = $database->loadObjectList();
 
 	## Section & Category query
+
 	$query = 	"SELECT CONCAT_WS(',',s.id,c.id) AS `value`, CONCAT_WS(' // ', s.name, c.name) AS `text`"
 	. "\n FROM #__sections AS s"
 	. "\n INNER JOIN #__categories AS c ON c.section = s.id"
@@ -996,6 +1023,7 @@
 	}
 
 	// find section name
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = 	"SELECT a.name"
 	. "\n FROM #__sections AS a"
 	. "\n WHERE a.id = ". $newsect .""
@@ -1004,6 +1032,7 @@
 	$section = $database->loadResult();
 
 	// find category name
+	// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 	$query = 	"SELECT  a.name"
 	. "\n FROM #__categories AS a"
 	. "\n WHERE a.id = ". $newcat .""
@@ -1016,6 +1045,7 @@
 		$row = new mosContent( $database );
 
 		// main query
+		// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 		$query =	"SELECT a.* FROM #__content AS a"
 		. "\n WHERE a.id = ". $cid[$i] ."";
 		;
Index: administrator/includes/menubar.html.php
===================================================================
--- administrator/includes/menubar.html.php	(revision 1753)
+++ administrator/includes/menubar.html.php	(working copy)
@@ -111,6 +111,7 @@
         return $script;
     }
 
+    // @RawSQLUse, trivial_implementation, SELECT
     function getTemplate () {
         global $database;
         $sql = "SELECT template FROM #__templates_menu WHERE client_id='1' AND menuid='0'";
Index: administrator/includes/mosAdminMenus.php
===================================================================
--- administrator/includes/mosAdminMenus.php	(revision 1753)
+++ administrator/includes/mosAdminMenus.php	(working copy)
@@ -89,6 +89,7 @@
 	function Access( &$row ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = 'SELECT id AS value, name AS text FROM #__groups ORDER BY id';
 		$database->setQuery( $query );
 		$groups = $database->loadObjectList();
@@ -322,6 +323,7 @@
 	function Section( &$menu, $id, $all=0 ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`"
 		. "\n FROM #__sections AS s"
 		. "\n WHERE s.scope = 'content'"
@@ -356,6 +358,7 @@
 	function Component( &$menu, $id ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT c.id AS value, c.name AS text, c.link"
 		. "\n FROM #__components AS c"
 		. "\n WHERE c.link <> ''"
@@ -499,6 +502,7 @@
 	function ComponentCategory( $name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1 ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT id AS value, name AS text"
 		. "\n FROM #__categories"
 		. "\n WHERE section = '". $section ."'"
@@ -521,6 +525,7 @@
 		global $database;
 
 		$categories[] = mosHTML::makeOption( '0', T_('- All Sections -') );
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT id AS value, title AS text"
 		. "\n FROM #__sections"
 		. "\n WHERE published = '1'"
@@ -541,6 +546,7 @@
 	function Links2Menu( $type, $_and ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT *"
 		. "\n FROM #__menu"
 		. "\n WHERE type = '". $type ."'"
@@ -559,6 +565,7 @@
 	function MenuSelect( $name='menuselect', $javascript=NULL ) {
 		global $database;
 
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT params"
 		. "\n FROM #__modules"
 		. "\n WHERE module = 'mod_mainmenu'"
Index: administrator/includes/admin.php
===================================================================
--- administrator/includes/admin.php	(revision 1753)
+++ administrator/includes/admin.php	(working copy)
@@ -296,6 +296,7 @@
 	*/
 	function _form_mos_section( $name, $value, $control_name ) {
 		$database =& mamboDatabase::getInstance();
+		// @RawSQLUse, trivial_implementation, SELECT
 		$query = "SELECT id AS value, title AS text"
 		. "\n FROM #__sections"
 		. "\n WHERE published='1' AND scope='content'"
@@ -315,6 +316,7 @@
 	*/
 	function _form_mos_category( $name, $value, $control_name ) {
 		$database =& mamboDatabase::getInstance();
+
 		$query 	= "SELECT c.id AS value, CONCAT_WS( '/',s.title, c.title ) AS text"
 		. "\n FROM #__categories AS c"
 		. "\n LEFT JOIN #__sections AS s ON s.id=c.section"
@@ -374,6 +376,7 @@
 
 	function mosSpecialAdminParameters ($name, $version='') {
 	    $database =& mamboDatabase::getInstance();
+	    // @RawSQLUse, trivial_implementation, SELECT
 	    $sql = "SELECT * FROM #__parameters WHERE param_name='$name'";
 	    if ($version) $sql .= " AND param_version='$version'";
 	    $database->setQuery($sql);
Index: administrator/popups/pollwindow.php
===================================================================
--- administrator/popups/pollwindow.php	(revision 1753)
+++ administrator/popups/pollwindow.php	(working copy)
@@ -27,9 +27,11 @@
 $pollid = (int) mosGetParam( $_REQUEST, 'pollid', 0 );
 $css = mosGetParam( $_REQUEST, 't', '' );
 
+// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 $database->setQuery( "SELECT title FROM #__polls WHERE id='$pollid'" );
 $title = $database->loadResult();
 
+// @RawSQLUse, trivial_implementation, SELECT, CONCEPT
 $database->setQuery( "SELECT text FROM #__poll_data WHERE pollid='$pollid' order by id" );
 $options = $database->loadResultArray();
 ?>
Index: administrator/modules/mod_unread.php
===================================================================
--- administrator/modules/mod_unread.php	(revision 1753)
+++ administrator/modules/mod_unread.php	(working copy)
@@ -13,6 +13,7 @@
 /** ensure this file is being included by a parent file */
 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
 
+// @RawSQLUse, trivial_implementation, SELECT
 $database->setQuery( "SELECT COUNT(*) FROM #__messages WHERE state='0' AND user_id_to='$my->id'" );
 $unread = $database->loadResult();
 
Index: administrator/modules/mod_components.php
===================================================================
--- administrator/modules/mod_components.php	(revision 1753)
+++ administrator/modules/mod_components.php	(working copy)
@@ -25,6 +25,7 @@
 $canMassMail 		= $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_massmail' );
 $canManageUsers 	= $acl->acl_check( 'administration', 'manage', 'users', $my->usertype, 'components', 'com_users' );
 
+// @RawSQLUse, trivial_implementation, SELECT
 $query = "SELECT * FROM #__components ORDER BY ordering,name";
 $database->setQuery( $query );
 $comps = $database->loadObjectList();	// component list
