summaryrefslogtreecommitdiff
path: root/admin/admin_feed_inc.php
blob: 86115c1c96033d78af33b7be5ca5779a699d2721 (plain)
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
<?php

global $gBitSmarty;


$contentTypes = get_content_types();

if( !empty( $_REQUEST['store_feed'] ) ) {

	$deleteSql = "DELETE FROM feed_conjugation";
	$gBitDb->query($deleteSql);

	foreach ( array_keys( $contentTypes ) as $type ){
		if( !empty( $_REQUEST[$type]['conjugation_phrase'] ) || !empty( $_REQUEST[$type]['is_target_linked'] ) ) {
			$insertSql = "INSERT INTO feed_conjugation (content_type_guid, conjugation_phrase, is_target_linked) VALUES ( ?, ?, ?)";
			$gBitDb->query($insertSql, array( $type, $_REQUEST[$type]['conjugation_phrase'], empty($_REQUEST[$type]['is_target_linked'])?'y' : NULL ) );	
		}
	}

}

$contentTypes = get_content_types();
$gBitSmarty->assignByRef('contentTypes',$contentTypes);



function get_content_types(){
	global $gBitDb;
	$selectSql = "SELECT lct.content_type_guid,conjugation_phrase, is_target_linked FROM liberty_content_types lct LEFT JOIN feed_conjugation fc ON (fc.content_type_guid = lct.content_type_guid)";
	$contentTypes = $gBitDb->getAssoc($selectSql);
	return $contentTypes;

}

?>