class_PDOFunction.inc.php 22.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
<?php
/**
 * @file	PDOFunction.inc.php
 * @category freeSN
 * @mailto	code [at] netz.coop
 * @version 0.4.200901
 * @link http://netz.coop
 * 
 *  @copyright Copyright by netz.coop e.G. 2015
 *  
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 * @class Funktionen die MySql Funktionen aufrufen
 */
abstract class PDOFunction  extends PDORightManagement {

	/**
	 * @auth
	 * löst Verknüpfungen zwischen BasisElemente
	 *
	 *
	 *	@param BasisClipboard $param_BasisClipboard
	 *	@param int param_AttachID
	 *
	 *	@return boolean
	 *
	 * @since losp-v-0.2 - 29.01.2008
	 */
	public function removeMTextFromClipboard(Account &$param_HostAccount, BasisClipboard $param_BasisClipboard, $param_AttachID) {
		$var_PartOfID = $param_BasisClipboard->getObjVar('PartOfID');
		$var_ObjVar = $param_BasisClipboard->ThisClassName;
		$var_CategoryName = $param_BasisClipboard->getObjVar('CategoryName');

		$var_LinkerProfileID =$param_HostAccount->getAuthorProfileID();		

		$var_PartOfObj = MultimediaText::loadElement($param_HostAccount, $this, '*', $var_PartOfID);
		
		$var_ObjVarCat = $param_BasisClipboard->getPartOfObjVarName();
		
		if(!$var_PartOfObj->getObjVar('RightManagement')->getObjVar('RightManagementBC')->checkWriteBC($var_ObjVarCat, $var_LinkerProfileID, true)) {
			$var_LinkerProfileID = false;
			foreach($param_HostAccount->getPossibleProfileIDArray() as $var_PossibleRequestPID => $var_PossiblePArray) {
				if($var_PartOfObj->getObjVar('RightManagement')->getObjVar('RightManagementBC')->checkWriteBC($var_ObjVarCat, $var_PossibleRequestPID, true)){
					$var_LinkerProfileID = $var_PossibleRequestPID;
					break;
				}
			}
		}
		$var_BindValues = array(
				':RequestProfileID' => $var_LinkerProfileID,
				':PartOfID' => $var_PartOfID,
				':AttachID' => $param_AttachID,
				':ObjVar' => $var_ObjVar,
				':CategoryName' => $var_CategoryName.'',
		);
		
		$stmt = $this->PDO_query('select removeMTextFromClipboard( :RequestProfileID , :PartOfID , :AttachID , :ObjVar , :CategoryName ) as ID', $var_BindValues);

		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];
	}

	/**
	 * @auth
	 * Funktion die MTextIDs verknüpft
	 *
	 *
	 *	@param int 		param_PartOfID
	 *	@param int		param_AttachID
	 *	@param String 	param_State
	 *
	 *	@return boolean
	 *
	 * 	@since losp-v-0.2 - 29.01.2008
	 */
	public function insertMTextIntoClipboard( Account &$param_HostAccount, $param_PartOfID, $param_AttachID, $param_ObjVar, $param_PartOfObjVarCategory, $param_State){
//D::li("insertMTextIntoClipboard( Account &$param_HostAccount, $param_PartOfID, $param_AttachID, $param_ObjVar, $param_PartOfObjVarCategory, $param_State)",1,1)		;
		$var_LinkerProfileID =$param_HostAccount->getAuthorProfileID();

		if( is_object($param_PartOfID) &&  (is_subclass_of($param_PartOfID, "MultimediaText") || get_class($param_PartOfID)==="MultimediaText")) {
			$var_PartOfObj = $param_PartOfID;
			$param_PartOfID = $param_PartOfID->getID();
		} else {
			$var_PartOfObj = MultimediaText::loadElement($param_HostAccount, $this, '*', $param_PartOfID);
	//		$var_PartOfObj = MultimediaText::getFromMTextArray($param_PartOfID);
		}

		$var_PartOf_CONFIG_Data = CONFIG::getMT_BasisClipboards(get_class($var_PartOfObj), 'BasisClipboards');

		if($param_PartOfObjVarCategory) {
			$var_ObjVarCat = $param_ObjVar.CONFIG::getDelimiter('category').$param_PartOfObjVarCategory;
		} else {
			$var_ObjVarCat = $param_ObjVar;
		}

		if(is_array($var_PartOf_CONFIG_Data[$var_ObjVarCat]) && array_key_exists('Singleton', $var_PartOf_CONFIG_Data[$var_ObjVarCat])
		&& $var_PartOf_CONFIG_Data[$var_ObjVarCat]['Singleton'] && array_search($var_ObjVarCat, $var_PartOfObj->getObjVar('HasBasisClipboards'))!==false) {
			D::li('if Singleton: geht nicht, es existiert schon ein Element im BasisClipboard '.$var_ObjVarCat);
			return Error::newError('DevError',"Verknüpfung ist Fehlgeschlagen ",'if Singleton: geht nicht, es existiert schon ein Element im BasisClipboard '.$var_ObjVarCat);
		} else {
			if( is_object($param_AttachID) &&  (is_subclass_of($param_AttachID, "MultimediaText") || get_class($param_AttachID)==="MultimediaText")) {
				$param_AttachID = $param_AttachID->getID();
			}
			if($param_State==null) {
				$param_State = "unreaded";
			}
			else if(is_numeric($param_State)){
				$param_State=BasisClipboard::getStateName($this,$param_State);
			}

			$var_BindValues = array(
					':RequestProfileID' => $var_LinkerProfileID,
					':PartOfID' => $param_PartOfID,
					':AttachID' => $param_AttachID,
					':ObjVar' => $param_ObjVar,
					':PartOfObjVarCategory' => $param_PartOfObjVarCategory.'',
					':State' => $param_State.'',
			);
//D::ulli('1 $var_LinkerProfileID('.$var_LinkerProfileID.')  $param_State('.$param_State.')',1,1)			;
			/**
			 * @todo Frage: soll das so? Falls LinkerProfileID kein Recht besitzt, wird nachgesehen ob eine andere möglich ist!!!! im Zweifel gegen den Willen des Nutzers! 100427 @f
			 */
			if(!$var_PartOfObj->getObjVar('RightManagement')->getObjVar('RightManagementBC')->checkWriteBC($var_ObjVarCat, $var_LinkerProfileID, true)) {
				$var_LinkerProfileID = false;
				foreach($param_HostAccount->getPossibleProfileIDArray() as $var_PossibleRequestPID => $var_PossiblePArray) {
					if($var_PartOfObj->getObjVar('RightManagement')->getObjVar('RightManagementBC')->checkWriteBC($var_ObjVarCat, $var_PossibleRequestPID, true)){
						$var_LinkerProfileID = $var_PossibleRequestPID;
						break;
					}
				}
			}
//D::ulli('2 $var_LinkerProfileID('.$var_LinkerProfileID.')  $param_State('.$param_State.')',1,1)			;
			if($var_LinkerProfileID) {
				$stmt = $this->PDO_query('select insertMTextIntoClipboard( :RequestProfileID, :PartOfID, :AttachID, :ObjVar, :PartOfObjVarCategory, :State) as ID ', $var_BindValues);
				$row = $this->PDO_getResultRow($stmt);
//D::show($var_BindValues, $row["ID"]."  select insertMTextIntoClipboard( $var_LinkerProfileID, $param_PartOfID, $param_AttachID, $param_ObjVar, $param_PartOfObjVarCategory, $param_State) as ID ",1,1);
				if($row["ID"]) {
					return $row["ID"];

				} else {
                                   D::show($row["ID"],'ERROR');
					D::show($var_BindValues);
					D::backtrace('$var_LinkerProfileID  '.$var_LinkerProfileID);
					return Error::newError('DevError','insert Failed, may be the Element already exist?!',E_USER_ERROR);
				}
			}

			return Error::newError('UserError','you have no rights to connect the new element ('.$param_AttachID.') with '.$var_PartOfObj.' object',E_USER_ERROR);
		}
	}
	/**
	 * @auth_author
	 *	Funktion fügt einen neuen Date (extends MultimediaText) in die Datenbank
	 *
	 *	@Attention	ruft spezielle MySQL Datenbankfunction auf
	 *	@param Date param_Object save this Object
	 */
	protected function insertDateBE(DateBE $param_Object) {
		if ($param_Object->getObjVar('Start')) {
			if(!$param_Object->getObjVar('State')) {
				$param_Object->setObjVar('State', 'unreaded');
			}

			$var_RightManagement = &$param_Object->getObjVar('RightManagement');
			$var_BindValues = array(
					':State' => $param_Object->getObjVar('State'),
					':Start' => $param_Object->getObjVar('Start'),
					':End' => $param_Object->getObjVar('End'),
					':Cycle' => $param_Object->getObjVar('Cycle'),
					':AuthorID' => $param_Object->getAuthor()->getID(),
					':Subject' => $param_Object->getObjVar('Subject'),
					':Text' => $param_Object->getObjVar('Text'),
					':LanguageCode' => $param_Object->getObjVar('LanguageCode'),
					':ReadListID' => $var_RightManagement->getReadListID(),
					':WriteListID' => $var_RightManagement->getWriteListID(),
					':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
					':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
			);

			$stmt = $this->PDO_query('SELECT insertDateBE( :State, :Start, :End, :Cycle, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID) as ID', $var_BindValues);
			$row = $this->PDO_getResultRow($stmt);


			return $row["ID"];
		} else {
			return false;
		}
	}


	/**
	 * @auth_author
	 *	Funktion fügt einen neuen MultimediaText in die Datenbank
	 *
	 *	@param MultimediaText param_Object save this Object
	 */
	protected function insertMultimediaText(MultimediaText $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
			':ThisClassName' =>  $param_Object->ThisClassName,
		);
		//D::show($var_BindValues,'#############################',1,1);
		$stmt = $this->PDO_query('SELECT insertMultimediaText( :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID, :ThisClassName) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];

	}

	/**
	 * @auth_author
	 */
	protected function insertThreadMessageBE(ThreadMessageBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' => $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
			':LastInsertDate' => time()
		);
		$stmt = $this->PDO_query('SELECT insertThreadMessageBE(:LastInsertDate, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID ) as ID', $var_BindValues);
		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];
	}


	/**
	 * @auth_author
	 *	Funktion fügt einen neuen TopicBE (extends MultimediaText) in die Datenbank
	 *
	 *	@param TopicBE param_Object save this Object
	 */
	protected function insertTopicBE(TopicBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Name' => $param_Object->getObjVar('Name'),
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertTopicBE( :Name, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID ) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);

		if(!$row["ID"]) {
			$query2 = ' select Name from losp_BE_topic where Name=:Name ';
			$var_bindValueArray2 = array( ':Name'	=>	$param_Object->getObjVar('Name'), );
			$stmt2 = $this->PDO_query($query2, $var_bindValueArray2 );
			$row2 = $this->PDO_getResultRow($stmt2);
			if($row2['Name']) {
				return Error::newError('UserError',' name ('.$row2['Name'].') already exists',E_USER_ERROR);
			}

		}

		return $row["ID"];
	}

	/**
	 * @auth_author
	 */
	protected function insertLocationBE(LocationBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Name' => $param_Object->getObjVar('Name'),
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertLocationBE( :Name, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID ) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];
	}

	/**
	 * @auth_author
	 */
	protected function insertTreepart(Treepart $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Name' => $param_Object->getObjVar('Name'),
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertTreepart( :Name, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID ) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);


		return $row["ID"];
	}

	/**
	 * @auth_author
	 *	Funktion fügt einen neuen NewsfeedBE (extends MultimediaText) in die Datenbank
	 *
	 *	@param NewsfeedBE param_Object save this Object
	 */
	protected function insertNewsfeedBE(NewsfeedBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Url' => $param_Object->getObjVar('Url'),
			':AuthorID' => $param_Object->getAuthor()->getID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertNewsfeedBE( :Url, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID , :PCAuthReadListID, :PCAuthWriteListID) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];
	}

	/**
	 * @auth_author
	 */
	protected function insertUrlBE(UrlBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Url' => $param_Object->getObjVar('Url'),
			':AuthorID' => $param_Object->getAuthor_ProfileID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertUrlBE( :Url, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID, :PCAuthReadListID, :PCAuthWriteListID ) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);

		return $row["ID"];
	}


	/**
	 * @auth_author
	 *	Funktion fügt eine Datei (extends MultimediaText) in die Datenbank
	 *
	 *	@param FileBE param_Object save this Object
	 */
	protected function insertFileBE(FileBE $param_Object) {
		$var_RightManagement = &$param_Object->getObjVar('RightManagement');
		$var_BindValues = array(
			':Link' => $param_Object->getObjVar('Link'),
			':FileContentTypeLink' =>  $param_Object->getFileContentType($param_Object->getObjVar('Link')),
			':AuthorID' => $param_Object->getAuthor_ProfileID(),
			':Subject' => $param_Object->getObjVar('Subject'),
			':Text' => $param_Object->getObjVar('Text'),
			':LanguageCode' =>  $param_Object->getObjVar('LanguageCode'),
			':ReadListID' =>  $var_RightManagement->getReadListID(),
			':WriteListID' => $var_RightManagement->getWriteListID(),
			':PCAuthReadListID' =>  $var_RightManagement->getPCAuthReadListID(),
			':PCAuthWriteListID' => $var_RightManagement->getPCAuthWriteListID(),
		);

		$stmt = $this->PDO_query('SELECT insertFileBE( :Link, :FileContentTypeLink, :AuthorID, :Subject, :Text, :LanguageCode, :ReadListID, :WriteListID , :PCAuthReadListID, :PCAuthWriteListID) as ID', $var_BindValues );
		$row = $this->PDO_getResultRow($stmt);
		return $row["ID"];
	}


	/**
	 * @auth_author
	 *	Funktion fügt einen neuen Profile (extends MultimediaText) in die Datenbank
	 *
	 *	@param Profile param_Object save this Object
	 */
	protected function insertProfile(Profile $param_Object) {
		$var_private = 0;
		$var_MemberProfileIDList = $param_Object->getObjVar('MemberProfileIDList');

		$var_bindValueArray = array(
			':NickName'	=>	$param_Object->getObjVar('NickName'),
			':EMail'	=>	$param_Object->getObjVar('EMail'),
			':Fingerprint'	=>	$param_Object->getObjVar('Fingerprint'),
			':Jabber'	=>	$param_Object->getObjVar('Jabber'),
			':Url'		=>	$param_Object->getObjVar('Url'),
			':Subject'	=>	$param_Object->getObjVar('Subject'),
			':Text'		=>	$param_Object->getObjVar('Text'),
			':LanguageCode'	=>	$param_Object->getObjVar('LanguageCode'),
			':Name'		=>	$param_Object->getObjVar('Name'),
			':private'	=>	$var_private,
			':Avatar'	=>	$param_Object->getObjVar('Avatar'),
			':Signature'	=>	$param_Object->getObjVar('Signature')

		);

		if(is_array($var_MemberProfileIDList) && !empty($var_MemberProfileIDList) && count($var_MemberProfileIDList)==1 && $var_keyarray=array_keys($var_MemberProfileIDList) ) {
			$query ="SELECT insertSubGroupProfile( :NickName, :EMail, :Fingerprint, :Jabber, :Url, :Subject, :Text, :LanguageCode, :Name, :private, :MemberProfileIDKeyArray, :Avatar, :Signature) as ID";
			$var_bindValueArray[':MemberProfileIDKeyArray'] = $var_keyarray[0];
		} else {
			$query ="SELECT insertProfile('Profile', :NickName, :EMail, :Fingerprint, :Jabber, :Url, :Subject, :Text, :LanguageCode, :Name, :private, :Avatar, :Signature) as ID";
		}
		$Resource = $this->PDO_query($query, $var_bindValueArray);
		$row = $this->PDO_getResultRow($Resource);

		if(!$row["ID"]) {

			$query2 = ' select NickName from losp_BE_profile where NickName=:NickName ';
			$var_bindValueArray2 = array( ':NickName'	=>	$param_Object->getObjVar('NickName'), );
			$stmt2 = $this->PDO_query($query2, $var_bindValueArray2 );
			$row2 = $this->PDO_getResultRow($stmt2);
			if($row2['NickName']) {
				return Error::newError('UserError',' nickname ('.$row2['NickName'].') already exists',E_USER_ERROR);
			}

		}

		$param_Object->setObjVar('ID', $row["ID"]);
		return $row["ID"];
	}

	/**
	 * @auth_author
	 *	Funktion fügt eine Datei (extends MultimediaText) in die Datenbank
	 *
	 *	@param FileBE param_Object save this Object
	 */
	protected function insertGroupProfileBE(GroupProfileBE $param_Object) {
		$var_private = 0;
		$var_bindValueArray = array(
			':NickName'	=>	$param_Object->getObjVar('NickName'),
			':EMail'	=>	$param_Object->getObjVar('EMail'),
			':Fingerprint'	=>	$param_Object->getObjVar('Fingerprint'),
			':Jabber'	=>	$param_Object->getObjVar('Jabber'),
			':Url'		=>	$param_Object->getObjVar('Url'),
			':Subject'	=>	$param_Object->getObjVar('Subject'),
			':Text'		=>	$param_Object->getObjVar('Text'),
			':LanguageCode'	=>	$param_Object->getObjVar('LanguageCode'),
			':Name'		=>	$param_Object->getObjVar('Name'),
			':private'	=>	$var_private,
			':Avatar'	=>	$param_Object->getObjVar('Avatar'),
			':Signature'	=>	$param_Object->getObjVar('Signature'),
			':AuthorID'	=>	$param_Object->getObjVar('Author_ProfileID')

		);

		$stmt = $this->PDO_query('SELECT insertGroupProfileBE( :NickName, :EMail, :Fingerprint, :Jabber, :Url, :Subject, :Text, :LanguageCode, :Name, :private, :AuthorID, :Avatar, :Signature) as ID', $var_bindValueArray );
		$row = $this->PDO_getResultRow($stmt);

		if(!$row["ID"]) {

			$query2 = ' select NickName from losp_BE_profile where NickName=:NickName ';
			$var_bindValueArray2 = array( ':NickName'	=>	$param_Object->getObjVar('NickName'), );
			$stmt2 = $this->PDO_query($query2, $var_bindValueArray2 );
			$row2 = $this->PDO_getResultRow($stmt2);
			if($row2['NickName']) {
				return Error::newError('UserError',' nickname ('.$row2['NickName'].') already exists',E_USER_ERROR);
			}

		}

		return $row["ID"];
	}


	protected function insertAccount(Account $param_Object) {
		if(!$param_Object->getObjVar('State')) {
			$param_Object->setObjVar('State', 'unreaded');
		}
		$qery = 'SELECT insertAccount( \''.$param_Object->getObjVar('Password').'\',  \''.$param_Object->getObjVar('ProfileID').'\',  \''.$param_Object->getObjVar('FirstName').'\',  \''.$param_Object->getObjVar('SurName').'\',  \''.$param_Object->getObjVar('Street').'\',  \''.$param_Object->getObjVar('Streetnumber').'\',  \''.$param_Object->getObjVar('City').'\',  \''.$param_Object->getObjVar('ZipCode').'\',  \''.$param_Object->getObjVar('EMail').'\')';
		$Resource = $this->PDO_query($query);
		$row = $this->PDO_getResultRow($Resource);
		return $row["ID"];
	}





	protected function insertBasisElementDesign(BasisElementDesign $param_Object) {
		if(!$param_Object->getObjVar('RequestProfileID')) {
			return false;
		}

		$query ="SELECT insertBasisElementDesign( :BEClassName, :RequestProfileID, :CSS ) as ID";
		$var_bindValueArray = array(
			':BEClassName'	=>	$param_Object->getObjVar('BEClassName'),
			':RequestProfileID'	=>	$param_Object->getObjVar('RequestProfileID'),
			':CSS'	=>	$param_Object->getObjVar('CSS').'',
		);

		$Resource = $this->PDO_query($query, $var_bindValueArray);
		$row = $this->PDO_getResultRow($Resource);

		return $row["ID"];

	}


}
?>