-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
111 additions
and
125 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
include "includes/init_sql.php"; | ||
|
||
//dabū 10 jaunākos tvītus | ||
$latest = mysqli_query($connection, "SELECT distinct media_url, expanded_url, date, text FROM media JOIN tweets ON tweets.id = media.tweet_id GROUP BY media_url ORDER BY date DESC limit 0, 25"); | ||
|
||
while($p=mysqli_fetch_array($latest)){ | ||
$media_url = $p["media_url"]; | ||
$expanded_url = $p["expanded_url"]; | ||
$ttime = $p["date"]; | ||
$ttext = $p["text"]; | ||
|
||
if (@getimagesize($media_url)) { | ||
?> | ||
<div style="<?php if ((time()-StrToTime($ttime))<5){echo"opacity:".((time()-StrToTime($ttime))/5).";";}?> display:inline;" > | ||
<a target="_blank" href="<?php echo $expanded_url; ?>"> | ||
<img alt="<?php echo $ttext;?>" src="<?php echo str_replace('http://', 'https://', $media_url); ?>" /> | ||
</a> | ||
</div> | ||
<?php | ||
}else{ | ||
//Delete this one - probably doesn't exist anymore... | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
include "includes/init_sql.php"; | ||
include "classify/evaluate_bayes.php"; | ||
|
||
//dabū 10 jaunākos tvītus | ||
$latest = mysqli_query($connection, "SELECT * FROM tweets ORDER BY created_at DESC limit 0, 10"); | ||
|
||
|
||
while($p=mysqli_fetch_array($latest)){ | ||
$username = $p["screen_name"]; | ||
$text = $p["text"]; | ||
$ttime = $p["created_at"]; | ||
|
||
$automatic = classify($text); | ||
switch ($automatic){ | ||
case "pos": | ||
$color = "#00FF00"; | ||
break; | ||
case "neg": | ||
$color = "#FF3D3D"; | ||
break; | ||
case "nei": | ||
$color = "black"; | ||
break; | ||
default: | ||
$color = "black"; | ||
} | ||
|
||
#Iekrāso un izveido saiti uz katru pieminēto lietotāju tekstā | ||
#Šo vajadzētu visur... | ||
$matches = array(); | ||
if (preg_match_all('/@[^[:space:]]+/', $text, $matches)) { | ||
foreach ($matches[0] as $match){ | ||
$text = str_replace(trim($match), '<a style="text-decoration:none;color:#658304;" href="/draugs/'.str_replace('@','',trim($match)).'">'.trim($match).'</a> ', $text); | ||
} | ||
} | ||
|
||
if (preg_match_all('/http[^[:space:]]+/', $text, $matches)) { | ||
foreach ($matches[0] as $match){ | ||
$text = str_replace(trim($match), '<a style="text-decoration:none;color:#658304;" target="_blank" href="'.trim($match).'">'.trim($match).'</a> ', $text); | ||
} | ||
} | ||
|
||
?> | ||
<div style="<?php if ((time()-StrToTime($ttime))<5){echo"opacity:".((time()-StrToTime($ttime))/5).";";}?>" class="tweet"> | ||
<div class="lietotajs" style="border-bottom: 0.18em dashed <?php echo $color; ?>;"><?php echo '<a style="text-decoration:none;color:#658304;" href="/draugs/'.trim($username).'">@'.trim($username).'</a> ';?> ( <?php echo $ttime;?> )</div> | ||
<?php echo $text."<br/>"; | ||
?><br/> | ||
</div> | ||
<?php | ||
} | ||
?> |