12 changed files with 170 additions and 19 deletions
@ -0,0 +1,16 @@ |
|||
<?php |
|||
|
|||
$DATAhst="localhost"; |
|||
$DATAusr="root"; |
|||
$DATApwd="root"; |
|||
$DATAdtb="www_dslak_it"; |
|||
|
|||
/* |
|||
$DATAhst="localhost"; |
|||
$DATAusr="token"; |
|||
$DATApwd="tokendbpwd"; |
|||
$DATAdtb="www_dslak_it"; |
|||
*/ |
|||
|
|||
|
|||
?> |
@ -0,0 +1,93 @@ |
|||
<?php |
|||
@include 'conn.conn'; |
|||
$GLOBALS['conn']; |
|||
$conn=@mysqli_connect($DATAhst,$DATAusr,$DATApwd,$DATAdtb)or die("CONNECTION ERROR"); |
|||
|
|||
$content = null; |
|||
$content->items = array(); |
|||
|
|||
$filter = array("portfolio", "installations", "entertainment", "performances", "workshops"); |
|||
|
|||
switch($_GET['query']) { |
|||
case "portfolio": |
|||
case "installations": |
|||
case "entertainment": |
|||
case "performances": |
|||
case "workshops": |
|||
if($_GET['query'] == 'portfolio') {$filter = '';} else {$filter = "WHERE type='".$_GET['query']."'";} |
|||
$qe = mysqli_query($conn,"SELECT * FROM `works` $filter ORDER BY id DESC"); |
|||
if(mysqli_num_rows($qe) > 0) { |
|||
$content = null; |
|||
$content->items = array(); |
|||
while($re = mysqli_fetch_array($qe)) { |
|||
$item = null; |
|||
$item->id = $re['id']; |
|||
$item->title = $re['title']; |
|||
$item->type = $re['type']; |
|||
$item->tags = $re['tags']; |
|||
$item->image = $re['image']; |
|||
array_push($content->items, $item); |
|||
} |
|||
} |
|||
break; |
|||
case "exhibitions": |
|||
$qe = mysqli_query($conn,"SELECT * FROM `exhibitions` ORDER BY date_from DESC"); |
|||
if(mysqli_num_rows($qe) > 0) { |
|||
$content = null; |
|||
$content->items = array(); |
|||
while($re = mysqli_fetch_array($qe)) { |
|||
$item = null; |
|||
$item->id = $re['id']; |
|||
$item->title = $re['title']; |
|||
$item->date_from = $re['date_from']; |
|||
$item->date_to = $re['date_to']; |
|||
$item->tags = $re['tags']; |
|||
$item->image = $re['image']; |
|||
array_push($content->items, $item); |
|||
} |
|||
} |
|||
break; |
|||
case "detail": |
|||
$qe = mysqli_query($conn,"SELECT * FROM `".$_GET['type']."` WHERE id=".$_GET['id']); |
|||
if(mysqli_num_rows($qe)>0) { |
|||
$content = null; |
|||
$re = mysqli_fetch_array($qe); |
|||
$item = null; |
|||
$item->id = $re['id']; |
|||
$item->title = $re['title']; |
|||
$item->content = $re['content']; |
|||
$item->tags = $re['tags']; |
|||
$item->image = $re['image']; |
|||
if($_GET['type'] == 'exhibitions') { |
|||
$item->date_from = $re['date_from']; |
|||
$item->date_to = $re['date_to']; |
|||
$item->works = array(); |
|||
$qx = mysqli_query($conn,"SELECT id,title FROM `works` WHERE id IN (".$re['works'].")"); |
|||
while($re = mysqli_fetch_array($qx)) { |
|||
$ex = null; |
|||
$ex->id = $re['id']; |
|||
$ex->title = $re['title']; |
|||
array_push($item->works, $ex); |
|||
} |
|||
} else if($_GET['type'] == 'works') { |
|||
$item->type = $re['type']; |
|||
$item->exhibitions = array(); |
|||
$qx = mysqli_query($conn,"SELECT id,title FROM `exhibitions` WHERE id IN (".$re['exhibitions'].")"); |
|||
while($re = mysqli_fetch_array($qx)) { |
|||
$ex = null; |
|||
$ex->id = $re['id']; |
|||
$ex->title = $re['title']; |
|||
array_push($item->exhibitions, $ex); |
|||
} |
|||
} |
|||
$content->item = $item; |
|||
} |
|||
break; |
|||
} |
|||
|
|||
|
|||
header('Access-Control-Allow-Origin: *'); |
|||
header('Content-Type: application/json'); |
|||
echo json_encode($content); |
|||
|
|||
?> |
@ -1,5 +1,5 @@ |
|||
export const environment = { |
|||
production: false, |
|||
|
|||
API_URL: `http://localhost/dslak_website/apis/` |
|||
API_URL: `http://dslakng.local/apis/` |
|||
} |
|||
|
Loading…
Reference in new issue