--- includes/SMW_ParserExtensions.php	2014-10-16 18:45:32.306625670 +0200
+++ includes/SMW_ParserExtensions.php	2014-10-16 18:44:57.474452944 +0200
@@ -168,6 +168,9 @@
 		}
 
 		$result = $dv->getShortWikitext( true );
+/*op-patch|TS|2010-07-13|HaloACL|Semantic protection|start|doc|http://dmwiki.ontoprise.com:8888/dmwiki/index.php/Semantic_protection*/
+		wfRunHooks('PropertyBeforeOutput', array(&$dv, &$result));
+/*op-patch|TS|2010-07-13|end*/		
 
 		if ( ( $smwgInlineErrors && $smwgStoreAnnotations && SMWParserExtensions::$mTempStoreAnnotations ) && ( !$dv->isValid() ) ) {
 			$result .= $dv->getErrorText();
--- includes/storage/SMW_QueryResult.php	2014-10-16 18:45:32.294625611 +0200
+++ includes/storage/SMW_QueryResult.php	2014-10-16 18:44:57.442452786 +0200
@@ -87,6 +87,39 @@
 		$this->mStore = $store;
 	}
 
+	/*op-patch|TS|2009-06-19|HaloACL|Semantic protection|start|doc|http://dmwiki.ontoprise.com:8888/dmwiki/index.php/Semantic_protection*/
+	/**
+	 * Creates a new query result based on $this query result. Everything
+	 * but the content of $this query result is copied into the new one.
+	 * This is useful for query result filters which copy the content only partly.
+	 *
+	 * @param SMWQueryResult $this
+	 * 		The following parts of this query result are copied into the new q.r.:
+	 * 		- print requests
+	 * 		- query, querystring
+	 * 	 	- furtherres
+	 * 	 	- extra printouts
+	 * @param array
+	 * 		An array of results e.g. the set of filtered results of the original query.
+	 * 		If the new q.r. should have no results then pass an empty array.
+	 *
+	 * @return SMWQueryResult
+	 * 		A partly copied $queryResult
+	 */
+	public function newFromQueryResult($results) {
+		$classname = get_class($this);
+
+		$qr = new $classname($this->mPrintRequests,
+							 $this->mQuery,
+							 $results,
+							 $this->mStore,
+							 $this->mFurtherResults);
+
+		return $qr;
+	}
+	/*op-patch|TS|2009-06-19|end*/
+		
+
 	/**
 	 * Get the SMWStore object that this result is based on.
 	 *
--- includes/storage/SMW_ResultArray.php	2014-10-16 18:45:32.294625611 +0200
+++ includes/storage/SMW_ResultArray.php	2014-10-16 18:44:57.454452841 +0200
@@ -56,7 +56,7 @@
 	 * @return SMWStore
 	 */
 	public function getStore() {
-		return $this->mStore;
+		$this->mStore = smwfGetStore();
 	}
 
 	/**
--- includes/storage/SQLStore/SMW_SQLStore3_Queries.php	2014-10-16 18:45:32.294625611 +0200
+++ includes/storage/SQLStore/SMW_SQLStore3_Queries.php	2014-10-16 18:44:57.410452618 +0200
@@ -592,7 +592,25 @@
 						// No defaultnamespaces here; If any, these are already in the concept.
 						// Unescaping is the same as in SMW_DV_Conept's getWikiValue().
 						$desc = $qp->getQueryDescription( str_replace( array( '&lt;', '&gt;', '&amp;' ), array( '<', '>', '&' ), $row->concept_txt ) );
-						$qid = $this->compileQueries( $desc );
+/*op-patch|TS|2010-07-14|HaloACL|Semantic protection|start*/
+						global $haclgProtectProperties;
+						if (isset($haclgProtectProperties) && $haclgProtectProperties) {
+							$query = new SMWQuery($desc);
+							wfRunHooks('RewriteQuery', array(&$query, &$queryEmpty) );
+							$errors = $query->getErrors();
+							if (!empty($errors)) {
+								$this->m_errors += $errors;
+							}
+							if ($queryEmpty) {
+								$qid = -1;
+							} else {
+								$desc = $query->getDescription();
+								$qid = $this->compileQueries( $desc );
+							}
+						} else {
+ 						$qid = $this->compileQueries( $desc );
+						}
+/*op-patch|TS|2010-07-14|end*/
 						if ($qid != -1) {
 							$query = $this->m_queries[$qid];
 						} else { // somehow the concept query is no longer valid; maybe some syntax changed (upgrade) or global settings were modified since storing it