<commit_before><?php include "config/db_config.php"; ?>

<?php
session_start();
if (!isset($_SESSION['user']) || !$_SESSION['user']) {
  header('Location: index.php');
}
?>
<?php
$conn = new mysqli(SERVERNAME, USERNAME, PASSWORD, DBNAME);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Change character set to utf8
mysqli_set_charset($conn,"utf8");


$sql = "
        SELECT korisnici.Ime, korisnici.Prezime, korisnici.SlikaKorisnika,korisnici.KID, statusi.KID, slike.LinkIzvoraSlike, slike.VremePostavljanja AS v1, slike.JavnaPrivatna, slike.KID, statusi.TekstStatusa, statusi.VremePostavljanja AS v2 FROM 
        ( (statusi INNER JOIN korisnici ON statusi.KID = korisnici.KID) 
        LEFT JOIN slike ON statusi.VremePostavljanja = slike.VremePostavljanja) UNION 
        SELECT korisnici.Ime, korisnici.Prezime, korisnici.SlikaKorisnika, korisnici.KID, statusi.KID, slike.LinkIzvoraSlike, slike.VremePostavljanja AS v1, slike.JavnaPrivatna, slike.KID, statusi.TekstStatusa, statusi.VremePostavljanja AS v2 FROM 
        ( (statusi INNER JOIN korisnici ON statusi.KID = korisnici.KID) 
        RIGHT JOIN slike ON statusi.VremePostavljanja = slike.VremePostavljanja) ORDER BY v1 DESC;";
$result = $conn->query($sql);

?>
<!DOCTYPE html>
<html>
<head>
	<title>social network</title>
	<link href="css/dashboard.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<style>
		form {
			display: inline;
		}
	</style>
</head>
<body>
	<?php include "sections/navbar.php"; ?>
    <div align="center" id="insertPost">
        <img src="img/profile.gif"/>

       <form action="uploadimg.php" method="post" enctype="multipart/form-data">
          <input type="text" name="statusContent" id="onYourMind" placeholder="What's on your mind ?"/>

          <input type="file" name="fileToUpload" id="fileToUpload" placeholder="Odaberi datoteku:"
        style="visibility: hidden">
     <div class="btnUpload">
       <label for="fileToUpload" class="dgm">Odaberi datoteku:</label>
     </div>
       <div class="rightSide">
       <select name="pubSelect" id="pubSelect">
         <option value="0">Javna</option>
         <option value="1">Privatna</option>
       </select>

       <input type="submit" name="insertPost" id="kreirajPost" value="Kreiraj post" />
       </div>
       </form>

    </div>
<?php
    if ($result->num_rows > 0) { 
    // output data of each row
    ?>
    <?php while($row = $result->fetch_assoc()): ?>
       <div align="center" id="printText">
         <div class="row">
          <div class="usrPict">
            <img src="img/<?php echo $row['SlikaKorisnika']; ?>">
          </div>
           <span id="fullName">
               <?php echo $row["Ime"]." ".$row["Prezime"]; ?></span>
          <div class="outPict"></div>
           <div id="postTxt">
             <?php 
            if (($row['JavnaPrivatna'] === 1) || $row['KID'] === $_SESSION['KID']) {
                  echo '<img src="'.$row['LinkIzvoraSlike'].'">'; 

              } elseif ($row['JavnaPrivatna'] === 0) {
                  echo '<img src="'.$row['LinkIzvoraSlike'].'">';

              } else {
                  echo " ";
              }
                          
             echo $row["TekstStatusa"];
            ?>
           </div>
           <div class="imgDiv" >
            <img class="postImg clickableImage" id="<?php echo $row['SID']?>" src="uploads/<?php echo $row['ImeSlike']?>"> <!-- potrebno dodati ovaj PHP id kako bi se pokretala js funkcija --> 
            </div>
           <br><div id="like">Like Comment</div>
         </div>
    <?php endwhile; 
        
    } else {
        echo "0 results";
    }
    // zatvaramo konekciju ka bazi
    $conn->close();
?>

<div id="popupContainer">
  <div id="popupContent">
    <div class="leftColumn" id="photoContainer" name=""></div>
    <div class="rightColumn"><commit_msg>Merging Team 1 and Team 3 html<commit_after><?php include "config/db_config.php"; ?>

<?php
session_start();
if (!isset($_SESSION['user']) || !$_SESSION['user']) {
  header('Location: index.php');
}
?>
<?php
$conn = new mysqli(SERVERNAME, USERNAME, PASSWORD, DBNAME);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Change character set to utf8
mysqli_set_charset($conn,"utf8");


$sql = "
        SELECT korisnici.Ime, korisnici.Prezime, korisnici.SlikaKorisnika,korisnici.KID, statusi.KID, slike.LinkIzvoraSlike, slike.VremePostavljanja AS v1, slike.JavnaPrivatna, slike.KID, statusi.TekstStatusa, statusi.VremePostavljanja AS v2 FROM 
        ( (statusi INNER JOIN korisnici ON statusi.KID = korisnici.KID) 
        LEFT JOIN slike ON statusi.VremePostavljanja = slike.VremePostavljanja) UNION 
        SELECT korisnici.Ime, korisnici.Prezime, korisnici.SlikaKorisnika, korisnici.KID, statusi.KID, slike.LinkIzvoraSlike, slike.VremePostavljanja AS v1, slike.JavnaPrivatna, slike.KID, statusi.TekstStatusa, statusi.VremePostavljanja AS v2 FROM 
        ( (statusi INNER JOIN korisnici ON statusi.KID = korisnici.KID) 
        RIGHT JOIN slike ON statusi.VremePostavljanja = slike.VremePostavljanja) ORDER BY v1 DESC;";
$result = $conn->query($sql);

?>
<!DOCTYPE html>
<html>
<head>
	<title>social network</title>
	<link href="css/dashboard.css" rel="stylesheet">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<style>
		form {
			display: inline;
		}
	</style>
</head>
<body>
	<?php include "sections/navbar.php"; ?>
    <div align="center" id="insertPost">
        <img src="img/profile.gif"/>

       <form action="uploadimg.php" method="post" enctype="multipart/form-data">
          <input type="text" name="statusContent" id="onYourMind" placeholder="What's on your mind ?"/>

          <input type="file" name="fileToUpload" id="fileToUpload" placeholder="Odaberi datoteku:"
        style="visibility: hidden">
     <div class="btnUpload">
       <label for="fileToUpload" class="dgm">Odaberi datoteku:</label>
     </div>
       <div class="rightSide">
       <select name="pubSelect" id="pubSelect">
         <option value="0">Javna</option>
         <option value="1">Privatna</option>
       </select>

       <input type="submit" name="insertPost" id="kreirajPost" value="Kreiraj post" />
       </div>
       </form>

    </div>
<?php
    if ($result->num_rows > 0) { 
    // output data of each row
    ?>
    <?php while($row = $result->fetch_assoc()): ?>
       <div align="center" id="printText">
         <div class="row">
          <div class="usrPict">
            <img src="img/<?php echo $row['SlikaKorisnika']; ?>">
          </div>
           <span id="fullName">
               <?php echo $row["Ime"]." ".$row["Prezime"]; ?></span>
          <div class="outPict"></div>
           <div id="postTxt">
             <?php 
            if (($row['JavnaPrivatna'] === 1) || $row['KID'] === $_SESSION['KID']) {
                  echo '<img class="postImg clickableImage" id="'.$row['SID'].'" src="'.$row['LinkIzvoraSlike'].'">'; 

              } elseif ($row['JavnaPrivatna'] === 0) {
                  echo '<img src="'.$row['LinkIzvoraSlike'].'">';

              } else {
                  echo " ";
              }
                          
             echo $row["TekstStatusa"];
            ?>
           </div>
    <?php endwhile; 
        
    } else {
        echo "0 results";
    }
    // zatvaramo konekciju ka bazi
    $conn->close();
?>

<div id="popupContainer">
  <div id="popupContent">
    <div class="leftColumn" id="photoContainer" name=""></div>
    <div class="rightColumn">
{'fraction_non_alphanumeric': 0.1707042957042957, 'fraction_numerical': 0.004745254745254745, 'mean_word_length': 2.9030214424951266, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 151, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1944165', 'n_tokens_mistral': 2865, 'n_tokens_neox': 2768, 'n_words': 539}