Merge branch 'master' of ssh://gitolite@asdynamics.com:50005/projects/fdn2.git
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 19/apr/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
$pdo = new PDO("mysql:host=localhost;dbname=fdn_old","root","root",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") );
|
||||
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
|
||||
|
||||
$count = 0;
|
||||
$statement = $pdo->query("select * from notizia order by id desc limit $count,100");
|
||||
$dati = $statement->fetchALL(PDO::FETCH_CLASS,"stdClass");
|
||||
|
||||
while (is_array($dati) && sizeof($dati)>0){
|
||||
|
||||
foreach ($dati as $ele){
|
||||
|
||||
$notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("titolo"=>$ele->mainTitle));
|
||||
|
||||
if (is_null($notizia)){
|
||||
$notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("titolo"=>htmlspecialchars_decode($ele->mainTitle)));
|
||||
}
|
||||
|
||||
if (!is_null($notizia)){
|
||||
$notizia->oldId = intval($ele->id);
|
||||
|
||||
GlobalVariables::get("dao")->save($notizia);
|
||||
}
|
||||
else {
|
||||
echo "Failed id ". $ele->id."\n";
|
||||
}
|
||||
|
||||
}
|
||||
$count+=100;
|
||||
$statement = $pdo->query("select * from notizia order by id desc limit $count,100");
|
||||
$dati = $statement->fetchALL(PDO::FETCH_CLASS,"stdClass");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -69,10 +69,21 @@ class PipelineHelper {
|
||||
|
||||
public static function getDailyVisualizationPipelineByStartAndEnd($startDate,$endDate){
|
||||
$rval = array(
|
||||
array(
|
||||
'$project'=>array(
|
||||
'tdate'=>array(
|
||||
'$add'=>array(
|
||||
'$date',60*60*1000
|
||||
)
|
||||
),
|
||||
"statType"=>'$statType',
|
||||
'user'=>'$user',
|
||||
)
|
||||
),
|
||||
array(
|
||||
'$match'=>array(
|
||||
'statType'=>StatisticModel::STAT_TYPE_PAGE,
|
||||
'date'=>array(
|
||||
'tdate'=>array(
|
||||
'$gte'=>new MongoDate($startDate),
|
||||
'$lte'=>new MongoDate($endDate)
|
||||
)
|
||||
@@ -82,9 +93,9 @@ class PipelineHelper {
|
||||
'$group'=>array(
|
||||
"_id"=>array(
|
||||
'date'=>array(
|
||||
"day"=>array('$dayOfMonth'=>'$date'),
|
||||
"month"=>array('$month'=>'$date'),
|
||||
"year"=>array('$year'=>'$date')
|
||||
"day"=>array('$dayOfMonth'=>'$tdate'),
|
||||
"month"=>array('$month'=>'$tdate'),
|
||||
"year"=>array('$year'=>'$tdate')
|
||||
),
|
||||
'user'=>'$user.id',
|
||||
),
|
||||
|
||||
@@ -307,23 +307,28 @@ class GUIHandler {
|
||||
}
|
||||
|
||||
public static function generateFooter(){
|
||||
if (!self::hasSeenCookieMessage()){
|
||||
?>
|
||||
<div class="cookieAdvice">
|
||||
<div>Questo sito utilizza cookie tecnici per offrirti una migliore esperienza di navigazione sul sito.</div>
|
||||
<div>Navigando su questo sito accetti l'utilizzo dei cookie.</div><br/>
|
||||
<a class="closeAdvice">Chiudi</a>
|
||||
<br/><br/>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.closeAdvice').click(function(){
|
||||
$('.cookieAdvice').hide();
|
||||
});
|
||||
$('.cookieAdvice').click(function(){
|
||||
$('.cookieAdvice').hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
self::setCookieSeen();
|
||||
}
|
||||
?>
|
||||
<div class="cookieAdvice">
|
||||
<div>Questo sito utilizza cookie tecnici per offrirti una migliore esperienza di navigazione sul sito.</div>
|
||||
<div>Navigando su questo sito accetti l'utilizzo dei cookie.</div><br/>
|
||||
<a class="closeAdvice">Chiudi</a>
|
||||
<br/><br/>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.closeAdvice').click(function(){
|
||||
$('.cookieAdvice').hide();
|
||||
});
|
||||
$('.cookieAdvice').click(function(){
|
||||
$('.cookieAdvice').hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="footer">
|
||||
<div class="footerCategory">
|
||||
<a href="index.php">Home</a>
|
||||
@@ -455,5 +460,22 @@ class GUIHandler {
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* ritorna true se bisogna mostrare il messaggio dei cookie
|
||||
* Il messaggio è basato su SESSIONE
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasSeenCookieMessage(){
|
||||
return ASDSessionHandler::sessionValueExists("cookieShown") && ASDSessionHandler::getSessionValue("cookieShown")===true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chiamare quando viene mostrato il messaggio dei cookies
|
||||
*/
|
||||
public static function setCookieSeen(){
|
||||
ASDSessionHandler::setSessionValue("cookieShown",true);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -27,11 +27,11 @@ if (!is_null($action) && strcmp($action, "show")==0){
|
||||
$showGraph = true;
|
||||
|
||||
|
||||
$date = new DateTime(PostHandler::get("start")." 00:00", new DateTimeZone("Europe/Rome"));
|
||||
$start = $date->format('U');
|
||||
$date = new DateTime(PostHandler::get("start")." 00:00", new DateTimeZone("GMT"));
|
||||
$start = $date->getTimestamp();
|
||||
|
||||
$date = new DateTime(PostHandler::get("end")." 23:59", new DateTimeZone("Europe/Rome"));
|
||||
$end = $date->format('U');
|
||||
$date = new DateTime(PostHandler::get("end")." 23:59", new DateTimeZone("GMT"));
|
||||
$end = $date->getTimestamp();
|
||||
|
||||
|
||||
// $start = strtotime(PostHandler::get("start")." 00:00");
|
||||
@@ -60,7 +60,7 @@ if (!is_null($action) && strcmp($action, "show")==0){
|
||||
$result[$i]["mktime"] = mktime(0,1,0,$ele["_id"]["date"]["month"],$ele["_id"]["date"]["day"],$ele["_id"]["date"]["year"]) *1000;
|
||||
}
|
||||
|
||||
var_dump($result);
|
||||
// var_dump($result);
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ try {
|
||||
$idArray = array_map(function ($ele){ return new MongoId($ele["_id"]["notizia"]);}, $stats);
|
||||
|
||||
$lastsNews = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"_id"=>array('$in'=>$idArray),"about.data"=>array('$lte'=>new MongoDate())),
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"_id"=>array('$in'=>$idArray),"about.data"=>array('$lte'=>new MongoDate(),'$gte'=>new MongoDate(strtotime('-2 months')))),
|
||||
array("sort"=>array("about.data"=>-1))
|
||||
);
|
||||
if (sizeof($lastsNews)<5){
|
||||
@@ -520,4 +520,4 @@ catch (Exception $ex){
|
||||
GUIHandler::generateFooter();
|
||||
GUIHandler::generateGoogleAnalyticsScripts();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 19/apr/2016
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__)."/load.php");
|
||||
|
||||
if (array_key_exists("id", $_GET)){
|
||||
$id = intval($_GET["id"]);
|
||||
$notizia = $notizia = GlobalVariables::get("dao")->getFirst("NotiziaModel",array("oldId"=>$id));
|
||||
|
||||
if (!is_null($notizia)){
|
||||
Header( "HTTP/1.1 301 Moved Permanently" );
|
||||
Header( "Location: http://www.ifattidinapoli.it/articolo.php?id=".$notizia->id );
|
||||
|
||||
// GUIHandler::redirect("articolo.php?id=".$notizia->id);
|
||||
}
|
||||
else {
|
||||
echo "asd";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
+1
-1
@@ -46,7 +46,7 @@ foreach(NotiziaModel::$NOTIZIE_CATEGORY as $category=>$data){
|
||||
|
||||
$latestArticles = GlobalVariables::get("dao")->query("NotiziaModel",
|
||||
array("status"=>NotiziaModel::STATUS_ACCEPTED,"about.data"=>array('$lte'=>new MongoDate())),
|
||||
array("sort"=>array("about.data"=>-1),"limit"=>100)
|
||||
array("sort"=>array("about.data"=>-1),"limit"=>1000)
|
||||
);
|
||||
|
||||
if (sizeof($latestArticles)>0){
|
||||
|
||||
Reference in New Issue
Block a user