From 2bc9e45ee8d093959e1a051619bcc3c83b190170 Mon Sep 17 00:00:00 2001
From: Frog23 <code@frog23.net>
Date: Wed, 22 Jul 2020 15:00:56 +0200
Subject: [PATCH] fixed issue T258595 [QuickStatements] allow the creation of
 properties

---
 public_html/quickstatements.php | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/public_html/quickstatements.php b/public_html/quickstatements.php
index 77322cb..bd31bc7 100644
--- a/public_html/quickstatements.php
+++ b/public_html/quickstatements.php
@@ -1214,6 +1214,19 @@ exit ( 1 ) ; // Force bot restart
 			} else if ( $first == 'CREATE' ) {
 				$cmd = array ( 'action'=>'create' , 'type'=>'item' ) ;
 				if ( $comment != '' ) $cmd['summary'] = $comment ;
+			} else if ( $first == 'CREATE_PROPERTY' and count ( $cols ) >= 2) {
+				$cmd = array ( 'action'=>'create' , 'type'=>'property' , 'data'=>'' ) ;
+				$datatype = trim($cols[1]) ;
+				$datatype = strtolower($datatype) ;
+				if ($datatype == "commonsmedia") {
+					$datatype = "commonsMedia" ;
+				}
+				if (!in_array($datatype,array("commonsMedia","globe-coordinate","wikibase-item","wikibase-property","string","monolingualtext","external-id","quantity","time","url","math","geo-shape","musical-notation","tabular-data","wikibase-lexeme","wikibase-form","wikibase-sense")) ) {
+					$cmd['error'] = 'Unknown datatype: "'.$datatype.'".' ;
+					//continue ;
+				}
+				$cmd['data'] = array ( 'datatype'=>$datatype );
+				if ( $comment != '' ) $cmd['summary'] = $comment ;
 			} else if ( $first == 'STATEMENT' and count($cols) == 2 ) {
 				$id = trim ( $cols[1] ) ;
 				$cmd = array ( 'action'=>$action , 'what'=>'statement' , 'id'=>$id ) ;
-- 
2.11.0

