Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69ab1c94b1 | ||
|
|
b550cbda4a | ||
|
|
2ef1efe1c9 | ||
|
|
58962bb97e | ||
|
|
38bae579e5 | ||
|
|
3633c94366 | ||
|
|
55b5bb2395 | ||
|
|
ed384b28e7 | ||
|
|
d47dba6898 | ||
|
|
cc4bdb2e0f | ||
|
|
e99d00f22f | ||
|
|
8694ac5224 | ||
|
|
6815e672fd | ||
|
|
cd0ced6cf4 | ||
|
|
ed69ff4923 | ||
|
|
fe355027ea | ||
|
|
45673894af | ||
|
|
5ab17889f4 | ||
|
|
25a8495c5c | ||
|
|
0dd8a47c51 | ||
|
|
6e07f1ad0b | ||
|
|
eb643bcb79 | ||
|
|
b1a33940ff | ||
|
|
b9be324698 | ||
|
|
40d0e6071a | ||
|
|
60dfebc676 | ||
|
|
0479701b70 | ||
|
|
f80dc6ec64 | ||
|
|
fc63d04c6b | ||
|
|
0cbf98d43e | ||
|
|
0359e12555 | ||
|
|
83e17cec7c | ||
|
|
05e4c00b7f | ||
|
|
69eb59b93b | ||
|
|
4883c53419 | ||
|
|
a0bafc453f | ||
|
|
b515760e6d | ||
|
|
ea4e0c0ec3 | ||
|
|
3f04905d22 | ||
|
|
0ab6391bf3 | ||
|
|
a66dfa8530 | ||
|
|
09cf83c31b | ||
|
|
aac8e9786d | ||
|
|
bcfea0cfad | ||
|
|
8a097b5956 | ||
|
|
effeae054e | ||
|
|
daabdbb566 | ||
|
|
2ed3a2bf3c | ||
|
|
3b12ce1786 | ||
|
|
6c3acfe5e9 | ||
|
|
93bb9b2610 | ||
|
|
e2fb0d6d89 | ||
|
|
617a3f50eb | ||
|
|
c666b50dd8 | ||
|
|
34fb57fa81 | ||
|
|
7680378f28 | ||
|
|
7bab6253cf | ||
|
|
f7db85cc13 | ||
|
|
09396f8c98 | ||
|
|
064eeec5a0 |
@@ -2,6 +2,10 @@
|
||||
|
||||
Versione dockerizzata di FDN2
|
||||
|
||||
# HTTPS - CSR
|
||||
|
||||
> openssl req -new -newkey rsa:2048 -nodes -out www_ifattidinapoli_it.csr -keyout www_ifattidinapoli_it.key -subj "/C=IT/ST=Na/L=Napoli/O=I Fatti di Napoli/CN=www.ifattidinapoli.it"
|
||||
|
||||
### Dependencies
|
||||
- AWS Cli
|
||||
|
||||
|
||||
@@ -19,12 +19,6 @@
|
||||
RewriteRule "Giornale/all/.*" "oldArticleRedirect.php" [L,QSA]
|
||||
|
||||
</Directory>
|
||||
|
||||
<IfModule xsendfile_module>
|
||||
XSendFile on
|
||||
XSendFilePath "/tmp/xsend"
|
||||
</IfModule>
|
||||
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
@@ -12,5 +12,8 @@ mkdir -p "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
|
||||
chown -R www-data:www-data "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
|
||||
chown -R www-data:www-data /var/log/${DDNINJA_AUTHOR}
|
||||
|
||||
mkdir -p "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
|
||||
chown -R www-data:www-data "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
|
||||
|
||||
asdphp-entrypoint & wait
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
function exit_func {
|
||||
echo "SIGTERM detected"
|
||||
exit 1
|
||||
}
|
||||
trap exit_func SIGTERM SIGINT
|
||||
|
||||
ASD_BINDIR="/home/${DDNINJA_AUTHOR}/private/${DDNINJA_BUILDNAME}/bin"
|
||||
|
||||
mkdir -p "/tmp/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}"
|
||||
mkdir -p "/home/${DDNINJA_AUTHOR}/storage/${DDNINJA_BUILDNAME}/media/"
|
||||
mkdir -p "/var/log/${DDNINJA_AUTHOR}/${DDNINJA_BUILDNAME}/"
|
||||
|
||||
php /home/${DDNINJA_AUTHOR}/private/${DDNINJA_BUILDNAME}/bin/worker.php & wait
|
||||
exit $?
|
||||
@@ -6,6 +6,7 @@
|
||||
* File : convertStats.php
|
||||
*******************************************/
|
||||
|
||||
die();
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
$iteration = 0;
|
||||
|
||||
Executable
+363
@@ -0,0 +1,363 @@
|
||||
#!/usr/local/bin/php
|
||||
<?php
|
||||
/******************************************
|
||||
* Author : Riccardo Di Dato
|
||||
* Created On : Tue Aug 30 2022
|
||||
* File : convertStats.php
|
||||
*******************************************/
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
|
||||
function getDailyBannerImpressionsPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$project' => [
|
||||
'tdate'=> [
|
||||
'$add' => [ '$date' , 60*60*1000 ]
|
||||
],
|
||||
"statType" => '$statType',
|
||||
'user' => '$user',
|
||||
'banner' => '$content.banner',
|
||||
]
|
||||
],
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => [
|
||||
'day' => [ '$dayOfMonth' => '$tdate' ],
|
||||
"month" => [ '$month' => '$tdate' ],
|
||||
"year" => [ '$year'=>'$tdate' ]
|
||||
],
|
||||
'banner' => '$banner',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function getDailyBannerClicksPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$project' => [
|
||||
'tdate'=> [
|
||||
'$add' => [ '$date' , 60*60*1000 ]
|
||||
],
|
||||
"statType" => '$statType',
|
||||
'user' => '$user',
|
||||
'banner' => '$content.banner',
|
||||
]
|
||||
],
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_BANNER_CLICK,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => [
|
||||
'day' => [ '$dayOfMonth' => '$tdate' ],
|
||||
"month" => [ '$month' => '$tdate' ],
|
||||
"year" => [ '$year'=>'$tdate' ]
|
||||
],
|
||||
'banner' => '$banner',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function getDailyNotiziaImpressionsPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$project' => [
|
||||
'tdate'=> [
|
||||
'$add' => [ '$date' , 60*60*1000 ]
|
||||
],
|
||||
"statType" => '$statType',
|
||||
'user' => '$user',
|
||||
"content" => '$content'
|
||||
]
|
||||
],
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_NOTIZIA,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => [
|
||||
'day' => [ '$dayOfMonth' => '$tdate' ],
|
||||
"month" => [ '$month' => '$tdate' ],
|
||||
"year" => [ '$year'=>'$tdate' ]
|
||||
],
|
||||
'notizia' => '$content.notizia',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function getYearlyNotiziaImpressionsPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$project' => [
|
||||
'tdate'=> [
|
||||
'$add' => [ '$date' , 60*60*1000 ]
|
||||
],
|
||||
"statType" => '$statType',
|
||||
'user' => '$user',
|
||||
"content" => '$content'
|
||||
]
|
||||
],
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_NOTIZIA,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'notizia' => '$content.notizia',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function getDailyPageImpressionsPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$project' => [
|
||||
'tdate'=> [
|
||||
'$add' => [ '$date' , 60*60*1000 ]
|
||||
],
|
||||
"statType" => '$statType',
|
||||
'user' => '$user',
|
||||
'content' => '$content',
|
||||
]
|
||||
],
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_PAGE,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => [
|
||||
'day' => [ '$dayOfMonth' => '$tdate' ],
|
||||
"month" => [ '$month' => '$tdate' ],
|
||||
"year" => [ '$year'=>'$tdate' ]
|
||||
],
|
||||
'user' => '$user.id',
|
||||
'content' => '$content',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => 1 ]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => '$_id.date',
|
||||
'content' => '$_id.content',
|
||||
],
|
||||
"visualizzazioni" => [ '$sum' => '$visualizzazioni' ],
|
||||
'isNewToday' => [ '$sum' => 1 ],
|
||||
'isAbsoluteNew' => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
function getMonthlyPageImpressionsPipeline($startDate, $endDate) {
|
||||
return [
|
||||
[
|
||||
'$match' => [
|
||||
'statType' => StatisticModel::STAT_TYPE_PAGE,
|
||||
'tdate' => [
|
||||
'$gte'=>new MongoDB\BSON\UTCDateTime($startDate * 1000),
|
||||
'$lte'=>new MongoDB\BSON\UTCDateTime($endDate * 1000)
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => [
|
||||
"month" => [ '$month' => '$tdate' ],
|
||||
"year" => [ '$year'=>'$tdate' ]
|
||||
],
|
||||
'user' => '$user.id',
|
||||
'content' => '$content',
|
||||
]
|
||||
]
|
||||
],
|
||||
[
|
||||
'$group' => [
|
||||
'_id' => [
|
||||
'date' => '$_id.date',
|
||||
'content' => '$_id.content',
|
||||
],
|
||||
"isMonthlyNew" => [ '$sum' => 1 ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$curYear = intval(date("Y"));
|
||||
for ($y = 2016; $y <= intval(date("Y")); $y++) {
|
||||
echo "Working on year : $y", PHP_EOL;
|
||||
|
||||
$from = strtotime($y."-01-01");
|
||||
$to = strtotime($y."-12-31");
|
||||
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$pipe = getDailyPageImpressionsPipeline( $from, $to );
|
||||
|
||||
echo " - Working on Daily Page Impressions", PHP_EOL;
|
||||
$data = $dao->aggregate(
|
||||
StatisticModel::class,
|
||||
$pipe,
|
||||
['cursor' => true]
|
||||
);
|
||||
|
||||
foreach ($data as $elem) {
|
||||
AnalyticsHelper::multiPageImpression(
|
||||
$elem->_id->content,
|
||||
$elem->_id->date->day,
|
||||
$elem->_id->date->month,
|
||||
$elem->_id->date->year,
|
||||
$elem->visualizzazioni,
|
||||
$elem->isNewToday,
|
||||
0,
|
||||
$elem->isAbsoluteNew
|
||||
);
|
||||
}
|
||||
|
||||
$pipe = getMonthlyPageImpressionsPipeline( $from, $to );
|
||||
|
||||
echo " - Working on Monthly Page Impressions", PHP_EOL;
|
||||
$data = $dao->aggregate(
|
||||
StatisticModel::class,
|
||||
$pipe,
|
||||
['cursor' => true]
|
||||
);
|
||||
|
||||
foreach ($data as $elem) {
|
||||
AnalyticsHelper::multiPageImpression(
|
||||
$elem->_id->content,
|
||||
1,
|
||||
$elem->_id->date->month,
|
||||
$elem->_id->date->year,
|
||||
0,
|
||||
0,
|
||||
$elem->isMonthlyNew,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ($y == $curYear) {
|
||||
$pipe = getDailyNotiziaImpressionsPipeline( $from, $to );
|
||||
}
|
||||
else {
|
||||
$pipe = getYearlyNotiziaImpressionsPipeline($from, $to);
|
||||
}
|
||||
|
||||
echo " - Working on Notizia Impressions", PHP_EOL;
|
||||
$data = $dao->aggregate(
|
||||
StatisticModel::class,
|
||||
$pipe,
|
||||
['cursor' => true]
|
||||
);
|
||||
|
||||
foreach ($data as $elem) {
|
||||
$day = $y == 2022 ? $elem->_id->date->day : 1;
|
||||
$month = $y == 2022 ? $elem->_id->date->month : 1;
|
||||
AnalyticsHelper::multiNotiziaImpression(
|
||||
$elem->_id->notizia,
|
||||
$day,
|
||||
$month,
|
||||
$y,
|
||||
$elem->visualizzazioni
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$pipe = getDailyBannerImpressionsPipeline( $from, $to );
|
||||
|
||||
echo " - Working on Banner Impressions", PHP_EOL;
|
||||
$data = $dao->aggregate(
|
||||
StatisticModel::class,
|
||||
$pipe,
|
||||
['cursor' => true]
|
||||
);
|
||||
|
||||
foreach ($data as $elem) {
|
||||
AnalyticsHelper::multiBannerImpression(
|
||||
$elem->_id->banner,
|
||||
$elem->_id->date->day,
|
||||
$elem->_id->date->month,
|
||||
$elem->_id->date->year,
|
||||
$elem->visualizzazioni
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$pipe = getDailyBannerClicksPipeline( $from, $to );
|
||||
|
||||
echo " - Working on Banner Clicks", PHP_EOL;
|
||||
$data = $dao->aggregate(
|
||||
StatisticModel::class,
|
||||
$pipe,
|
||||
['cursor' => true]
|
||||
);
|
||||
|
||||
foreach ($data as $elem) {
|
||||
AnalyticsHelper::multiBannerClick(
|
||||
$elem->_id->banner,
|
||||
$elem->_id->date->day,
|
||||
$elem->_id->date->month,
|
||||
$elem->_id->date->year,
|
||||
$elem->visualizzazioni
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
use ASD\ThresholdTimer;
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
require_once("/home/ddninja/private/asdphp/lib/core/ThresholdTimer.php");
|
||||
|
||||
|
||||
$timer = new ThresholdTimer(60);
|
||||
|
||||
function logInfo(string $msg) {
|
||||
echo date("Y-m-d H:i")." - ".$msg,PHP_EOL;
|
||||
}
|
||||
function execHour() {
|
||||
return intval(date('i')) == 0;
|
||||
}
|
||||
function execDay() {
|
||||
return execHour() && intval(date('H')) == 3;
|
||||
}
|
||||
function getMinuteTasks() {
|
||||
return [
|
||||
GenerateAdminActivationMailTask::class,
|
||||
GenerateUserActivationMailTask::class,
|
||||
GenerateAdminPasswordRecoveryMailTask::class,
|
||||
GenerateUserPasswordRecoveryMailTask::class,
|
||||
MailSendTask::class
|
||||
];
|
||||
}
|
||||
function getHourTasks() {
|
||||
return [
|
||||
// NewsletterCheckTask::class,
|
||||
DeleteOldPasswordResetRequestsTask::class,
|
||||
UpdateMeteoCacheTask::class,
|
||||
GenerateCommentiWarningMailTask::class
|
||||
];
|
||||
}
|
||||
function getDailyTasks() {
|
||||
return [
|
||||
// SendBackupTask::class
|
||||
];
|
||||
}
|
||||
|
||||
function execute($taskName) {
|
||||
try {
|
||||
if ($taskName::isActive()){
|
||||
logInfo("Executing task $taskName");
|
||||
$taskName::execute();
|
||||
logInfo("Task $taskName executed with success");
|
||||
}
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
logInfo("Task $taskName failed execution");
|
||||
var_dump($ex);
|
||||
}
|
||||
}
|
||||
|
||||
logInfo("Worker STARTED!!");
|
||||
|
||||
$count = 1;
|
||||
while (1) {
|
||||
logInfo("Executing Minute");
|
||||
foreach (getMinuteTasks() as $task ) {
|
||||
execute($task);
|
||||
}
|
||||
if (execHour()) {
|
||||
logInfo("Exec hourly");
|
||||
foreach (getHourTasks() as $task ) {
|
||||
execute($task);
|
||||
}
|
||||
}
|
||||
if (execDay()) {
|
||||
logInfo("Exec Daily");
|
||||
foreach (getDailyTasks() as $task ) {
|
||||
execute($task);
|
||||
}
|
||||
}
|
||||
|
||||
$timer->waitUntilThresholdReached(true);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -36,7 +36,7 @@ $currentSystem->apache->user = "var-www";
|
||||
$currentSystem->apache->group = "var-www";
|
||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||
|
||||
$currentSystem->remoteLocationPath = getenv('ASD_PUBLIC_URL')."/";
|
||||
$currentSystem->remoteLocationPath = getenv('DDNINJA_PUBLIC_URL')."/";
|
||||
|
||||
// Deprecato in quanto CBS2 รจ stato dismesso
|
||||
$backupSystem = new stdClass();
|
||||
@@ -132,4 +132,11 @@ $config->cbs2->serverPort = $cbs2->serverPort;
|
||||
|
||||
$config->database = $database;
|
||||
|
||||
$config->mailer = new stdClass();
|
||||
$config->mailer->address = "email-smtp.eu-west-1.amazonaws.com";
|
||||
$config->mailer->port = "587";
|
||||
$config->mailer->username = "AKIASMB7IW2MQPUP5CXS";
|
||||
$config->mailer->password = "BHv+82Nns1kIKg99Hx0sjKlEpR+X4+1EgX+ec64n/mBt";
|
||||
$config->mailer->smtpAuth = true;
|
||||
|
||||
?>
|
||||
|
||||
@@ -27,7 +27,7 @@ $currentSystem->apache->user = "var-www";
|
||||
$currentSystem->apache->group = "var-www";
|
||||
$currentSystem->apache->workdir = "/var/www"; // Il path in cui inserire la cartella con le pagine html
|
||||
|
||||
$currentSystem->remoteLocationPath = "http://www.ifattidinapoli.it/";
|
||||
$currentSystem->remoteLocationPath = "https://www.ifattidinapoli.it/";
|
||||
|
||||
$backupSystem = new stdClass();
|
||||
$backupSystem->account = "1582528f056a7ea7f391149fddc75553";
|
||||
|
||||
@@ -39,22 +39,22 @@ class AnalyticsHelper {
|
||||
);
|
||||
}
|
||||
|
||||
public static function pageImpression($content, $d, $m, $y, $isNewToday, $isNewMonth, $isNewAbsolute) {
|
||||
public static function multiPageImpression($content, $d, $m, $y, $incViews = 1, $incToday = 0, $incMonth = 0, $incAbsolute = 0) {
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$upd = [
|
||||
'$inc' => [
|
||||
'views' => 1
|
||||
'views' => $incViews
|
||||
]
|
||||
];
|
||||
if ($isNewAbsolute || $isNewMonth || $isNewToday) {
|
||||
$upd['$inc']['dayNewVisitors'] = 1;
|
||||
if ($incToday > 0) {
|
||||
$upd['$inc']['dayNewVisitors'] = $incToday;
|
||||
}
|
||||
if ($isNewAbsolute || $isNewMonth) {
|
||||
$upd['$inc']['monthNewVisitors'] = 1;
|
||||
if ($incMonth > 0) {
|
||||
$upd['$inc']['monthNewVisitors'] = $incMonth;
|
||||
}
|
||||
if ($isNewAbsolute) {
|
||||
$upd['$inc']['absNewVisitors'] = 1;
|
||||
if ($incAbsolute > 0) {
|
||||
$upd['$inc']['absNewVisitors'] = $incAbsolute;
|
||||
}
|
||||
$dao->rawUpsert(
|
||||
PageViewStatsModel::class,
|
||||
@@ -64,6 +64,19 @@ class AnalyticsHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static function pageImpression($content, $d, $m, $y, $isNewToday, $isNewMonth, $isNewAbsolute) {
|
||||
self::multiPageImpression(
|
||||
$content,
|
||||
$d,
|
||||
$m,
|
||||
$y,
|
||||
1,
|
||||
$isNewAbsolute || $isNewMonth || $isNewToday ? 1 : 0,
|
||||
$isNewAbsolute || $isNewMonth ? 1 : 0,
|
||||
$isNewAbsolute ? 1 : 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* La funzione si occupa del salvataggio vero e proprio della impression della pagina.
|
||||
* UTILIZZARE QUESTA FUNZIONE SOLO NELLA PAGINA DI BACKEND (stats/pageImpression.php). Nelle pagine base utilizzare invece la funzione di log
|
||||
@@ -99,8 +112,7 @@ class AnalyticsHelper {
|
||||
GUIHandler::addOnLoadJsEvent($function);
|
||||
}
|
||||
|
||||
|
||||
public static function notiziaImpression($content, $d, $m, $y) {
|
||||
public static function multiNotiziaImpression($content, $d, $m, $y, $incViews) {
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$dao->rawUpsert(
|
||||
@@ -108,12 +120,16 @@ class AnalyticsHelper {
|
||||
ArticleStatsModel::getFilter($content, $d, $m, $y),
|
||||
[
|
||||
'$inc' => [
|
||||
'views' => 1
|
||||
'views' => $incViews
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function notiziaImpression($content, $d, $m, $y) {
|
||||
self::multiNotiziaImpression($content, $d, $m, $y, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* La funzione si occupa del salvataggio vero e proprio della impression della notizia.
|
||||
@@ -160,7 +176,7 @@ class AnalyticsHelper {
|
||||
}
|
||||
|
||||
|
||||
public static function bannerImpression($bannerId, $d, $m, $y) {
|
||||
public static function multiBannerImpression($bannerId, $d, $m, $y, $views) {
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$dao->rawUpsert(
|
||||
@@ -168,25 +184,32 @@ class AnalyticsHelper {
|
||||
BannerStatsModel::getFilter($bannerId, $d, $m, $y),
|
||||
[
|
||||
'$inc' => [
|
||||
'views' => 1
|
||||
'views' => $views
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
public static function bannerImpression($bannerId, $d, $m, $y) {
|
||||
self::multiBannerImpression($bannerId, $d, $m, $y, 1);
|
||||
}
|
||||
|
||||
public static function multiBannerClick($bannerId, $d, $m, $y, $clicks) {
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$dao->rawUpsert(
|
||||
BannerStatsModel::class,
|
||||
BannerStatsModel::getFilter($bannerId, $d, $m, $y),
|
||||
[
|
||||
'$inc' => [
|
||||
'clicks' => $clicks
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
public static function bannerClick($bannerId, $d, $m, $y) {
|
||||
$dao = GlobalVariables::get("dao");
|
||||
if ($dao instanceof GenericDao) {
|
||||
$dao->rawUpsert(
|
||||
BannerStatsModel::class,
|
||||
BannerStatsModel::getFilter($bannerId, $d, $m, $y),
|
||||
[
|
||||
'$inc' => [
|
||||
'clicks' => 1
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
self::multiBannerClick($bannerId, $d, $m, $y, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,72 +298,6 @@ class AnalyticsHelper {
|
||||
return sizeof($ret) == 0 ? 0 : $ret[0]['tot'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce il banner da mostrare tenendo in considerazione quelli giร visualizzati e le visualizzazioni totali
|
||||
* @param int $position
|
||||
* @param string $replaced id del banner rimpiazzato
|
||||
*/
|
||||
public static function getBannerToShow($position, $replaced = null, $category = BannerModel::GENERAL_CATEGORY) {
|
||||
// ?TODO: Ragionaci
|
||||
// Rimuovi il replaced dalla lista
|
||||
$shown = array();
|
||||
$rval = null;
|
||||
if (ASDSessionHandler::sessionValueExists("bannerActive")){
|
||||
$shown = ASDSessionHandler::getSessionValue("bannerActive");
|
||||
|
||||
if (!is_null($replaced) && in_array($replaced, $shown)){
|
||||
$key = array_search($replaced, $shown);
|
||||
unset($shown[$key]);
|
||||
ASDSessionHandler::setSessionValue("bannerActive",$shown);
|
||||
}
|
||||
}
|
||||
|
||||
// idlist contiene gli id dei banner in ordine di visualizzazione crescente (esclusi quelli non visualizzati)
|
||||
$pipeline = PipelineHelper::getTodaysBannerVisualizationPipeline($position);
|
||||
$stats = GlobalVariables::get("dao")->aggregate("StatisticModel",$pipeline);
|
||||
// var_dump($stats);
|
||||
$idList = array();
|
||||
if (sizeof($stats)>0){
|
||||
foreach ($stats as $stat){
|
||||
$idList[] = $stat["_id"]["banner"];
|
||||
}
|
||||
}
|
||||
|
||||
// $baseSearchArray = array("position"=>$position,"end"=>array('$gte'=>new MongoDate(strtotime("tomorrow"))),"categories"=>$category);
|
||||
$baseSearchArray = array("position"=>$position,"end"=>array('$gte'=>new MongoDB\BSON\UTCDateTime( strtotime("tomorrow CET") * 1000 ) ),"categories"=>$category);
|
||||
// Prendi il primo dei "mai mostrati oggi" tra quelli non presenti nella pagina
|
||||
$todayPlusShown = array_merge($idList,$shown);
|
||||
if (sizeof($todayPlusShown)>0){
|
||||
$tmp = array_map(function ($id) {return new MongoDB\BSON\ObjectID($id);}, $todayPlusShown);
|
||||
$tmp = array('_id'=>array('$nin'=>$tmp));
|
||||
$rval = GlobalVariables::get("dao")->getFirst("BannerModel", array_merge($baseSearchArray, $tmp) );
|
||||
}
|
||||
else {
|
||||
$rval = GlobalVariables::get("dao")->getFirst("BannerModel", $baseSearchArray);
|
||||
}
|
||||
|
||||
if (is_null($rval)){
|
||||
$todayLessShown = array_values(array_diff($idList, $shown));
|
||||
if (sizeof($todayLessShown)>0){
|
||||
$i = 0;
|
||||
while (is_null($rval) && $i<sizeof($todayLessShown)){
|
||||
$condition = array_merge($baseSearchArray, array("id"=>$todayLessShown[$i]) );
|
||||
$rval = GlobalVariables::get("dao")->getFirst("BannerModel", $condition );
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!is_null($rval)){
|
||||
$shown[] = $rval->id;
|
||||
ASDSessionHandler::setSessionValue("bannerActive",$shown);
|
||||
}
|
||||
return $rval;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -19,9 +19,7 @@ class BannerHelper {
|
||||
}
|
||||
|
||||
public static function printBanner($position = BannerModel::POSITION_HEAD){
|
||||
$category = BannerModel::GENERAL_CATEGORY;
|
||||
|
||||
$cur = self::getPlaceholderId();
|
||||
$cur = self::getPlaceholderId();
|
||||
|
||||
if (!array_key_exists($position, self::$positions)) {
|
||||
self::$positions[$position] = [];
|
||||
@@ -63,17 +61,16 @@ class BannerHelper {
|
||||
|
||||
|
||||
private static function getBannerImpressions($bannerIds) {
|
||||
$time = strtotime("today");
|
||||
$stats = GlobalVariables::get("dao")->query(
|
||||
BannerStatsModel::class,
|
||||
[
|
||||
'_id' => [
|
||||
'$in' => array_map(
|
||||
function($banner) {
|
||||
return new \MongoDB\BSON\ObjectID($banner);
|
||||
},
|
||||
$bannerIds
|
||||
)
|
||||
'banner' => [
|
||||
'$in' => $bannerIds
|
||||
],
|
||||
'y' => intval(date('Y', $time)),
|
||||
'm' => intval(date('m', $time)),
|
||||
'd' => intval(date('d', $time))
|
||||
]
|
||||
);
|
||||
$rval = array_reduce(
|
||||
@@ -85,7 +82,7 @@ class BannerHelper {
|
||||
[]
|
||||
);
|
||||
foreach ($stats as $stat) {
|
||||
$rval[strval($stat->id)] = intval($stat->views);
|
||||
$rval[strval($stat->banner)] = intval($stat->views);
|
||||
}
|
||||
return $rval;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ class FDN_MailHelper {
|
||||
public static function generateMailFooter(){
|
||||
$footer = '<div style="background-color:#14477c;height:177px;margin-top:10px;">'.
|
||||
'<div style="text-align:center;color:#2e91d4;padding:10px;">'.
|
||||
'<a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/index.php">Home</a> | <a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/categorySummary.php?category=1>">Politica</a> | <a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/categorySummary.php?category=2>">Cronaca</a> | <a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/categorySummary.php?category=3>">Sport</a> | <a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/categorySummary.php?category=4>">Cultura&Spettacolo</a> | <a style="color:#2e91d4;margin:10px;" href="http://www.ifattidinapoli.it/categorySummary.php?category=5>">Gossip</a>'.
|
||||
'<a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/index.php">Home</a> | <a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/categorySummary.php?category=1>">Politica</a> | <a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/categorySummary.php?category=2>">Cronaca</a> | <a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/categorySummary.php?category=3>">Sport</a> | <a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/categorySummary.php?category=4>">Cultura&Spettacolo</a> | <a style="color:#2e91d4;margin:10px;" href="https://www.ifattidinapoli.it/categorySummary.php?category=5>">Gossip</a>'.
|
||||
'</div>'.
|
||||
'<div style="text-align:center;color:white;margin-top:25px;">TESTATA REGISTRATA PRESSO IL TRIBUNALE DI NAPOLI AUT. NR. 8 DEL 27 GENNAIO 2006</div>'.
|
||||
'<div style="text-align:center;color:white;margin-top:20px;">COPYRIGHT © 2016 <a href="http://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>'.
|
||||
'<div style="text-align:center;color:white;margin-top:20px;"><a href="http://www.ifattidinapoli.it/redazione.php" style="color:white;">REDAZIONE</a> | <a href="http://www.ifattidinapoli.it/archivio.php" style="color:white;">ARCHIVIO STORICO</a></div>'.
|
||||
'<div style="text-align:center;color:white;margin-top:20px;">COPYRIGHT © 2016 <a href="https://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>'.
|
||||
'<div style="text-align:center;color:white;margin-top:20px;"><a href="https://www.ifattidinapoli.it/redazione.php" style="color:white;">REDAZIONE</a> | <a href="https://www.ifattidinapoli.it/archivio.php" style="color:white;">ARCHIVIO STORICO</a></div>'.
|
||||
'</div>';
|
||||
return $footer;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class FDN_MailHelper {
|
||||
|
||||
$confirmLink = GUIHandler::getBaseUrl()."admin/confirmAdmin.php?regcode=".$admin->id."&email=".$admin->email;
|
||||
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$tmp->body = $mailHead."Per attivare il tuo account clicka sul link riportato in seguito o copialo e incollalo nel tuo browser.<br/><br/>";
|
||||
$tmp->body.='<a href="'.$confirmLink.'">'.$confirmLink.'</a><br/>'.self::generateMailFooter().'</div>';
|
||||
|
||||
@@ -49,7 +49,7 @@ class FDN_MailHelper {
|
||||
|
||||
$confirmLink = GUIHandler::getBaseUrl()."admin/passwordRecovery.php?req=".$request->id."&u=".$request->target->id;
|
||||
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
|
||||
$tmp->body = $mailHead."Hai ricevuto questo messaggio perchรจ hai effettuato una richiesta di recupero password dal nostro sito.<br/><br/>";
|
||||
$tmp->body.= "Se non hai effettuato nessuna richiesta, semplicemente ignora questo messaggio.<br/><br/>";
|
||||
@@ -70,7 +70,7 @@ class FDN_MailHelper {
|
||||
|
||||
$confirmLink = GUIHandler::getBaseUrl()."confirmUser.php?regcode=".$user->id."&email=".$user->email;
|
||||
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$tmp->body = $mailHead."Per attivare il tuo account clicka sul link riportato in seguito o copialo e incollalo nel tuo browser.<br/><br/>";
|
||||
$tmp->body.='<a href="'.$confirmLink.'">'.$confirmLink.'</a><br/>'.self::generateMailFooter().'</div>';
|
||||
|
||||
@@ -90,7 +90,7 @@ class FDN_MailHelper {
|
||||
|
||||
$confirmLink = GUIHandler::getBaseUrl()."passwordRecovery.php?req=".$request->id."&u=".$request->target->id;
|
||||
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
|
||||
$tmp->body = $mailHead."Hai ricevuto questo messaggio perchรจ hai effettuato una richiesta di recupero password dal nostro sito.<br/><br/>";
|
||||
$tmp->body.= "Se non hai effettuato nessuna richiesta, semplicemente ignora questo messaggio.<br/><br/>";
|
||||
@@ -111,7 +111,7 @@ class FDN_MailHelper {
|
||||
|
||||
$confirmLink = GUIHandler::getBaseUrl()."/admin/validateCommento.php?i=".$commento->id;
|
||||
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
$mailHead = '<div style="width:1024px; margin:auto;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png" alt="" /><div><br/><br/>';
|
||||
|
||||
$tmp->body = $mailHead."Un nuovo commento รจ stato inserito su I Fatti di Napoli ed รจ in attesa di essere accettato.<br/><br/>";
|
||||
$tmp->body.= "Verifica i contenuti del commento utilizzando il link di seguito.<br/><br/>";
|
||||
|
||||
@@ -193,7 +193,7 @@ class PipelineHelper {
|
||||
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
||||
'content.position'=>$position,
|
||||
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
|
||||
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today CET") * 1000) )
|
||||
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today") * 1000) )
|
||||
)
|
||||
),
|
||||
array(
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
|
||||
class SimpleConfigHelper {
|
||||
|
||||
private Memcached $memcached;
|
||||
private GenericDao $dao;
|
||||
|
||||
private stdClass $config;
|
||||
|
||||
public function __construct() {
|
||||
$this->memcached = new Memcached();
|
||||
$this->memcached->addServer('memcached', 11211);
|
||||
$this->dao = GlobalVariables::get("dao");
|
||||
|
||||
$this->reload();
|
||||
}
|
||||
|
||||
public function hasValue(string $name) : bool {
|
||||
return property_exists($this->config, $name);
|
||||
}
|
||||
|
||||
public function getValue(string $name) {
|
||||
return $this->config->$name;
|
||||
}
|
||||
|
||||
public function setValue(string $name, $val) {
|
||||
$model = $this->dao->getFirst(SimpleConfig::class);
|
||||
$model->details->$name = $val;
|
||||
$this->dao->save($model);
|
||||
$this->reload($model);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function reload($model = null) {
|
||||
if (!is_null($model)) {
|
||||
$this->memcached->set($this->getCacheKey(), json_encode($model->details, JSON_FORCE_OBJECT));
|
||||
}
|
||||
else if ( !$this->isCached() ) {
|
||||
$model = $this->dao->getFirst(SimpleConfig::class);
|
||||
if (is_null($model)) {
|
||||
$model = new SimpleConfig();
|
||||
$this->dao->save($model);
|
||||
}
|
||||
$this->memcached->set($this->getCacheKey(), json_encode($model->details, JSON_FORCE_OBJECT));
|
||||
}
|
||||
|
||||
$rval = $this->memcached->get(
|
||||
$this->getCacheKey()
|
||||
);
|
||||
$this->config = json_decode($rval, false);
|
||||
}
|
||||
|
||||
private function getCacheKey() {
|
||||
return 'glob.fdn2.simpleConfig';
|
||||
}
|
||||
|
||||
private function isCached(): bool {
|
||||
return $this->memcached->get( $this->getCacheKey() ) ? true : false;
|
||||
}
|
||||
|
||||
private function flush() {
|
||||
$this->memcached->set( $this->getCacheKey(), false );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -257,14 +257,20 @@ class GenericDao{
|
||||
'allowDiskUse' => true
|
||||
] );
|
||||
$cursor = $this->client->executeCommand( $this->dbName, $command );
|
||||
|
||||
if (array_key_exists('cursor', $options) && $options['cursor'] == true) {
|
||||
return $cursor;
|
||||
}
|
||||
else {
|
||||
$rval = [];
|
||||
foreach ($cursor as $ele){ // inganniamo il cursore, in realtร il risultato รจ uno
|
||||
//TODO CHECK
|
||||
$rval[] = json_decode( json_encode($ele) ,true );
|
||||
}
|
||||
|
||||
return $rval;
|
||||
}
|
||||
|
||||
$rval = [];
|
||||
foreach ($cursor as $ele){ // inganniamo il cursore, in realtร il risultato รจ uno
|
||||
//TODO CHECK
|
||||
$rval[] = json_decode( json_encode($ele) ,true );
|
||||
}
|
||||
|
||||
return $rval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ require_once(dirname(__FILE__)."/models/stats/ArticleStatsModel.php");
|
||||
require_once(dirname(__FILE__)."/models/stats/BannerStatsModel.php");
|
||||
require_once(dirname(__FILE__)."/models/stats/PageViewStatsModel.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/models/SimpleConfig.php");
|
||||
|
||||
$dao = new GenericDao($database->dbName,$database->connectionString);
|
||||
GlobalVariables::set("dao", $dao);
|
||||
?>
|
||||
|
||||
@@ -13,13 +13,18 @@ class BannerModel extends HasMediaModel{
|
||||
const POSITION_HEAD = 1;
|
||||
const POSITION_BODY = 2;
|
||||
const POSITION_LONG = 3;
|
||||
|
||||
const POSITION_TOP = 4;
|
||||
const POSITION_BOTTOM = 5;
|
||||
|
||||
const GENERAL_CATEGORY = 0;
|
||||
|
||||
public static $BANNER_POSITIONS = array(
|
||||
self::POSITION_HEAD=>array("label"=>"Testata"),
|
||||
self::POSITION_BODY=>array("label"=>"Corpo"),
|
||||
self::POSITION_LONG=>array("label"=>"Corpo Lungo")
|
||||
self::POSITION_LONG=>array("label"=>"Corpo Lungo"),
|
||||
self::POSITION_TOP=>array("label"=>"Inizio pagina"),
|
||||
self::POSITION_BOTTOM=>array("label"=>"Fine pagina")
|
||||
);
|
||||
|
||||
public function __construct($saveableObject = null){
|
||||
|
||||
@@ -42,36 +42,46 @@ class MailModel extends Model implements FDN_MailInterface{
|
||||
return parent::__set($attr, $value);
|
||||
}
|
||||
|
||||
public function getMailObject(){
|
||||
$email = new PHPMailer();
|
||||
$email->CharSet = "UTF-8";
|
||||
$email->isMail();
|
||||
|
||||
public function getMailObject() {
|
||||
$email = new PHPMailer();
|
||||
$email->CharSet = "UTF-8";
|
||||
$email->isMail();
|
||||
|
||||
$email->From = $this->from;
|
||||
$email->FromName = "I Fatti di Napoli";
|
||||
|
||||
$email->From = $this->from;
|
||||
if ($this->hasProperty("fromName")){
|
||||
$email->FromName = $this->fromName;
|
||||
}
|
||||
|
||||
$email->Subject = $this->subject;
|
||||
$email->Subject = $this->subject;
|
||||
|
||||
$email->IsHTML(true);
|
||||
|
||||
$email->Body = $this->body;
|
||||
|
||||
|
||||
$email->Body = $this->body;
|
||||
if ($this->hasProperty("altBody")){
|
||||
$email->AltBody = $this->altBody;
|
||||
}
|
||||
else {
|
||||
$email->AltBody = strip_tags($this->body);
|
||||
}
|
||||
|
||||
$email->AddAddress($this->recipient);
|
||||
|
||||
|
||||
$email->AddAddress($this->recipient);
|
||||
|
||||
if ($this->hasProperty("attachment")){
|
||||
$email->AddAttachment( $this->attachment , basename($this->attachment) );
|
||||
}
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
$cfg = GlobalVariables::get("config");
|
||||
|
||||
$email->IsSMTP();
|
||||
$email->Host = $cfg->mailer->address;
|
||||
$email->Port = $cfg->mailer->port;
|
||||
$email->Username = $cfg->mailer->username;
|
||||
$email->Password = $cfg->mailer->password;
|
||||
$email->SMTPAuth = $cfg->mailer->smtpAuth;
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "mail";
|
||||
|
||||
@@ -47,6 +47,8 @@ class NotiziaModel extends HasMediaModel implements DaoSearchable{
|
||||
const CATEGORY_CONSIGLI_ESPERTI = 18;
|
||||
|
||||
const CATEGORY_MONDO_SPOSI = 19;
|
||||
|
||||
const CATEGORY_VARIE = 99;
|
||||
|
||||
public static $NOTIZIE_CATEGORY = array(
|
||||
self::CATEGORY_POLITICA=>array("label"=>"Politica","mainMenu"=>true,"hidden"=>false,"pages"=>array("list"=>"politica.php"),"color"=>"#3e3e3e","isSubmenu"=>null),
|
||||
@@ -69,6 +71,8 @@ class NotiziaModel extends HasMediaModel implements DaoSearchable{
|
||||
self::CATEGORY_CONSIGLI_ESPERTI=>array("label"=>"I consigli degli esperti","mainMenu"=>false, "hidden"=>false,"pages"=>array("list"=>"consigliEsperti.php"),"color"=>"#3e3e3e","isSubmenu"=>null),
|
||||
|
||||
self::CATEGORY_MONDO_SPOSI=>array("label"=>"Mondo Sposi","mainMenu"=>false, "hidden"=>false,"pages"=>array("list"=>"mondoSposi.php"),"color"=>"#dd603a","isSubmenu"=>null),
|
||||
|
||||
self::CATEGORY_VARIE=>array("label"=>"Varie","mainMenu"=>false, "hidden"=>true,"pages"=>array("list"=>"varie.php"),"color"=>"#dd603a","isSubmenu"=>null),
|
||||
);
|
||||
|
||||
public function __construct($saveableObject = null){
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 13/gen/2016
|
||||
*/
|
||||
|
||||
|
||||
class SimpleConfig extends Model {
|
||||
const VARIE_LABEL = "varie_home_label";
|
||||
|
||||
|
||||
public function __construct($saveableObject = null) {
|
||||
parent::__construct($saveableObject);
|
||||
if (!$this->hasProperty("data") || !is_object($this->details)) {
|
||||
$this->details = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCollectionName(){
|
||||
return "simpleConfig";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -28,7 +28,7 @@ class ArticleStatsModel extends Model {
|
||||
}
|
||||
|
||||
public static function getFilter($articleId, $day, $month, $year) {
|
||||
$time = strtotime("$year-$month-$day CET");
|
||||
$time = strtotime("$year-$month-$day");
|
||||
return [
|
||||
'notizia' => $articleId,
|
||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||
|
||||
@@ -16,7 +16,7 @@ class BannerStatsModel extends Model {
|
||||
}
|
||||
|
||||
public static function new($bannerId, $day, $month, $year) {
|
||||
$time = strtotime("$year-$month-$day CET");
|
||||
$time = strtotime("$year-$month-$day");
|
||||
return new static(
|
||||
(object)[
|
||||
'banner' => $bannerId,
|
||||
@@ -30,7 +30,7 @@ class BannerStatsModel extends Model {
|
||||
);
|
||||
}
|
||||
public static function getFilter($bannerId, $day, $month, $year) {
|
||||
$time = strtotime("$year-$month-$day CET");
|
||||
$time = strtotime("$year-$month-$day");
|
||||
return [
|
||||
'banner' => $bannerId,
|
||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||
|
||||
@@ -15,7 +15,7 @@ class PageViewStatsModel extends Model {
|
||||
return "pageview_stats";
|
||||
}
|
||||
public static function new($page, $day, $month, $year) {
|
||||
$time = strtotime("$year-$month-$day CET");
|
||||
$time = strtotime("$year-$month-$day");
|
||||
|
||||
return new static(
|
||||
(object)[
|
||||
@@ -33,7 +33,7 @@ class PageViewStatsModel extends Model {
|
||||
}
|
||||
|
||||
public static function getFilter($page, $day, $month, $year) {
|
||||
$time = strtotime("$year-$month-$day CET");
|
||||
$time = strtotime("$year-$month-$day");
|
||||
return [
|
||||
'page' => $page,
|
||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||
|
||||
@@ -19,9 +19,7 @@ class GUIHandler {
|
||||
private static $onLoadEvents = array();
|
||||
|
||||
public static function generateHtmlHeaders(array $data = array(), $admin = false){
|
||||
if ($admin) {
|
||||
ASDSessionHandler::getSessionId();
|
||||
}
|
||||
ASDSessionHandler::getSessionId();
|
||||
$conf = GlobalVariables::get("config");
|
||||
|
||||
$title = $conf->info->projectName;
|
||||
@@ -59,7 +57,7 @@ class GUIHandler {
|
||||
}
|
||||
echo "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge,chrome=1\">\n";
|
||||
echo '<link rel="shortcut icon" href="images/favicon.ico">'."\n";
|
||||
echo '<link href="http://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext" rel="stylesheet" type="text/css">'."\n";
|
||||
echo '<link href="https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext" rel="stylesheet" type="text/css">'."\n";
|
||||
echo '<META http-equiv="Cache-Control" content="no-cache,no-store" />'."\n";
|
||||
echo '<META http-equiv="Pragma" content="no-cache" />'."\n";
|
||||
if (array_key_exists("additionalMetadata", $data) && is_array($data["additionalMetadata"]) && sizeof($data["additionalMetadata"])>0){
|
||||
@@ -217,12 +215,15 @@ class GUIHandler {
|
||||
<div class="leftBanner topBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
|
||||
</div>
|
||||
<div class="logo"><a href="http://ifattidinapoli.it/index.php"><img src="http://ifattidinapoli.it/images/logo_uff.png"></a></div>
|
||||
<div class="logo"><a href="https://www.ifattidinapoli.it/index.php"><img src="https://www.ifattidinapoli.it/images/logo_uff.png"></a></div>
|
||||
<div class="rightBanner topBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_HEAD);?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottomBar" style="height:40px;width:1000px;"></div>
|
||||
<div class="bottomBar" style="width:1000px;"></div>
|
||||
<div class="banner subheadBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_TOP);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -329,6 +330,9 @@ class GUIHandler {
|
||||
self::setCookieSeen();
|
||||
}
|
||||
?>
|
||||
<div class="banner footerBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_BOTTOM);?>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footerCategory">
|
||||
<a href="index.php">Home</a>
|
||||
@@ -344,7 +348,7 @@ class GUIHandler {
|
||||
?>
|
||||
</div>
|
||||
<div >TESTATA REGISTRATA PRESSO IL TRIBUNALE DI NAPOLI AUT. NR. 8 DEL 27 GENNAIO 2006</div>
|
||||
<div >COPYRIGHT © 2016 <a href="http://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>
|
||||
<div >COPYRIGHT © 2016 <a href="https://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>
|
||||
<div ><a href="redazione.php" style="color:white;">REDAZIONE</a> | <a href="archivio.php" style="color:white;">ARCHIVIO STORICO</a></div>
|
||||
|
||||
</div>
|
||||
@@ -354,22 +358,22 @@ class GUIHandler {
|
||||
|
||||
public static function getFacebookShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getTwitterShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."articolo.php?id=".$notizia->id;
|
||||
return 'window.open("http://twitter.com/home?source=ifdn&status="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://twitter.com/home?source=ifdn&status="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getGooglePlusShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getLinkedinShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +381,7 @@ class GUIHandler {
|
||||
|
||||
$stats = GlobalVariables::get("dao")->aggregate(
|
||||
ArticleStatsModel::class,
|
||||
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days CET"),5)
|
||||
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5)
|
||||
);
|
||||
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
|
||||
|
||||
@@ -445,19 +449,16 @@ class GUIHandler {
|
||||
|
||||
public static function generateGoogleAnalyticsScripts(){
|
||||
?>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
// ga('create', 'UA-75287906-1', 'auto');
|
||||
// ga('send', 'pageview');
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YTMS8G32Q"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-5YTMS8G32Q');
|
||||
</script>
|
||||
|
||||
ga('create', 'UA-6137905-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class GUIHandlerMobile {
|
||||
}
|
||||
echo "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge,chrome=1\">\n";
|
||||
echo '<link rel="shortcut icon" href="images/favicon.ico">'."\n";
|
||||
echo '<link href="http://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext" rel="stylesheet" type="text/css">'."\n";
|
||||
echo '<link href="https://fonts.googleapis.com/css?family=Lato&subset=latin,latin-ext" rel="stylesheet" type="text/css">'."\n";
|
||||
echo '<META http-equiv="Cache-Control" content="no-cache,no-store" />'."\n";
|
||||
echo '<META http-equiv="Pragma" content="no-cache" />'."\n";
|
||||
if (array_key_exists("additionalMetadata", $data) && is_array($data["additionalMetadata"]) && sizeof($data["additionalMetadata"])>0){
|
||||
@@ -199,7 +199,7 @@ class GUIHandlerMobile {
|
||||
<div class="upperBar">
|
||||
<div class="dateBar"><?php echo $day." ".$mesi[date("n")]." ".date("Y"); ?> - Aggiornato alle <span style="color:#f68235;"><?php echo date("H:i");?></span></div>
|
||||
</div>
|
||||
<div class="logo"><a href="http://ifattidinapoli.com/mobile/index.php"><img src="images/logo_uff.png" /></a></div>
|
||||
<div class="logo"><a href="https://ifattidinapoli.com/mobile/index.php"><img src="images/logo_uff.png" /></a></div>
|
||||
<div class="bottomBar">
|
||||
<img id="menuMobile" alt="" src="images/menuIcon.png">
|
||||
<?php
|
||||
@@ -343,12 +343,6 @@ class GUIHandlerMobile {
|
||||
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(){
|
||||
@@ -363,6 +357,9 @@ class GUIHandlerMobile {
|
||||
self::setCookieSeen();
|
||||
}
|
||||
?>
|
||||
<div class="banner footerBanner mediaContent">
|
||||
<?php BannerHelper::printBanner(BannerModel::POSITION_BOTTOM);?>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footerButton" style="text-align:center;">
|
||||
<a href="#">
|
||||
@@ -372,7 +369,7 @@ class GUIHandlerMobile {
|
||||
</div>
|
||||
|
||||
<p>TESTATA REGISTRATA PRESSO IL TRIBUNALE DI NAPOLI AUT. NR. 8 DEL 27 GENNAIO 2006</p>
|
||||
<p>COPYRIGHT © 2016 <a href="http://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</p>
|
||||
<p>COPYRIGHT © 2016 <a href="https://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</p>
|
||||
<p><a href="redazione.php" style="color:white;">REDAZIONE</a> | <a href="archivio.php" style="color:white;">ARCHIVIO STORICO</a></p>
|
||||
|
||||
</div>
|
||||
@@ -382,22 +379,22 @@ class GUIHandlerMobile {
|
||||
|
||||
public static function getFacebookShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getTwitterShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."articolo.php?id=".$notizia->id;
|
||||
return 'window.open("http://twitter.com/home?source=ifdn&status="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://twitter.com/home?source=ifdn&status="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getGooglePlusShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
public static function getLinkedinShareFunction(NotiziaModel $notizia){
|
||||
$url = self::getBaseUrl()."fbMetadata.php?id=".$notizia->id;
|
||||
return 'window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
return 'window.open("https://www.facebook.com/sharer.php?u="+encodeURIComponent("'.$url.'"))';
|
||||
}
|
||||
|
||||
|
||||
@@ -470,19 +467,16 @@ class GUIHandlerMobile {
|
||||
|
||||
public static function generateGoogleAnalyticsScripts(){
|
||||
?>
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-75287906-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-5YTMS8G32Q"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-5YTMS8G32Q');
|
||||
</script>
|
||||
|
||||
ga('create', 'UA-6137905-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ class HTMLHelper {
|
||||
$cont = file_get_contents($config->files->meteoCache);
|
||||
$json = json_decode($cont);
|
||||
|
||||
$todayImgUrl = " http://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png";
|
||||
$todayImgUrl = " https://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png";
|
||||
$todayTemp = $json->list[0]->main->temp;
|
||||
$todayMax = $json->list[0]->main->temp_max;
|
||||
$todayMin = $json->list[0]->main->temp_min;
|
||||
|
||||
$tomorrowImgUrl = " http://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png";
|
||||
$tomorrowImgUrl = " https://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png";
|
||||
$tomorrowTemp = $json->list[1]->main->temp;
|
||||
$tomorrowMax = $json->list[1]->main->temp_max;
|
||||
$tomorrowMin = $json->list[1]->main->temp_min;
|
||||
|
||||
@@ -28,9 +28,9 @@ class MenuGenerator {
|
||||
|
||||
array("label"=>"Utenti registrati","page"=>"listUsers.php","requires"=>AdminModel::ADMIN_TYPE_NORMALADMIN),
|
||||
array("label"=>"Newsletter", "subvoices"=>array(
|
||||
array("label"=>"Nuova","page"=>"editNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
array("label"=>"Da inviare","page"=>"pendingNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
array("label"=>"Inviate","page"=>"sentNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
// array("label"=>"Nuova","page"=>"editNewsletter.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
// array("label"=>"Da inviare","page"=>"pendingNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
// array("label"=>"Inviate","page"=>"sentNewsletters.php","requires"=>AdminModel::ADMIN_TYPE_NEWSLETTER),
|
||||
array("label"=>"Nuova Mail","page"=>"editMail.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Coda Mail","page"=>"listMail.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN)
|
||||
)),
|
||||
@@ -47,7 +47,9 @@ class MenuGenerator {
|
||||
array("label"=>"Config","page"=>"editConfig.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN),
|
||||
array("label"=>"Logs","page"=>"logs.php","requires"=>AdminModel::ADMIN_TYPE_SUPERADMIN)
|
||||
)),
|
||||
|
||||
|
||||
array("label"=>"Config","page"=>"simpleConfig.php"),
|
||||
|
||||
array("label"=>"Guida","page"=>"index.php"),
|
||||
|
||||
array("label"=>"Logout","page"=>"logout.php")
|
||||
|
||||
@@ -48,5 +48,8 @@ require_once(dirname(__FILE__)."/BannerHelper.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/RSSHelper.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/SimpleConfigHelper.php");
|
||||
|
||||
GlobalVariables::set("cfg", new SimpleConfigHelper());
|
||||
|
||||
?>
|
||||
@@ -22,7 +22,7 @@ class MediaYoutube extends MediaRenderer{
|
||||
}
|
||||
|
||||
public function getThumbnailLink(){
|
||||
return 'http://i.ytimg.com/vi/'.$this->link.'/0.jpg';
|
||||
return 'https://i.ytimg.com/vi/'.$this->link.'/0.jpg';
|
||||
}
|
||||
|
||||
public function getVideoLink(){
|
||||
|
||||
@@ -4,6 +4,8 @@ Author: Riccardo Di Dato
|
||||
Creation Date: 04/feb/2013
|
||||
*/
|
||||
|
||||
date_default_timezone_set("Europe/Rome");
|
||||
|
||||
require_once(dirname(__FILE__)."/common/config.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
|
||||
|
||||
@@ -91,9 +91,17 @@ try{
|
||||
<span class="label">Posizione:</span>
|
||||
<select name="position">
|
||||
<option disabled selected style="display:none;">Seleziona Posizione</option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_HEAD?"selected":"";?> value="<?php echo BannerModel::POSITION_HEAD;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_HEAD]["label"];?></option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_BODY?"selected":"";?> value="<?php echo BannerModel::POSITION_BODY;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BODY]["label"];?></option>
|
||||
<option <?php echo $banner->position==BannerModel::POSITION_LONG?"selected":"";?> value="<?php echo BannerModel::POSITION_LONG;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_LONG]["label"];?></option>
|
||||
<?php
|
||||
foreach (BannerModel::$BANNER_POSITIONS as $type => $data) {
|
||||
printf(
|
||||
'<option %s value="%s">%s</option>',
|
||||
$banner->position==$type ? "selected" : "",
|
||||
$type,
|
||||
$data['label']
|
||||
);
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -72,15 +72,15 @@ try {
|
||||
|
||||
$mailBody = $mail->body;
|
||||
if (strcmp($mailBody, "")==0){
|
||||
$mailBody = '<div style="margin:auto;width:1024px;"><div style="text-align:center;"><img src="http://www.ifattidinapoli.it/images/logo_uff.png"></div><div >Testo di prova</div><div></div>'.
|
||||
$mailBody = '<div style="margin:auto;width:1024px;"><div style="text-align:center;"><img src="https://www.ifattidinapoli.it/images/logo_uff.png"></div><div >Testo di prova</div><div></div>'.
|
||||
'<div style="background-color:#14477c;margin-top:10px;">
|
||||
<div style="text-align:center;color:#2e91d4;padding:10px;">
|
||||
<a style="color:#2e91d4;margin:10px;" href="http://www./index.php">Home</a> | <a style="color:#2e91d4;margin:10px;" href="http://www./categorySummary.php?category=1">Politica</a> | <a style="color:#2e91d4;margin:10px;" href="http://www./categorySummary.php?category=2">Cronaca</a> | <a style="color:#2e91d4;margin:10px;" href="http://www./categorySummary.php?category=3">Sport</a> | <a style="color:#2e91d4;margin:10px;" href="http://www./categorySummary.php?category=4">Cultura&Spettacolo</a>
|
||||
<a style="color:#2e91d4;margin:10px;" href="https://www./index.php">Home</a> | <a style="color:#2e91d4;margin:10px;" href="https://www./categorySummary.php?category=1">Politica</a> | <a style="color:#2e91d4;margin:10px;" href="https://www./categorySummary.php?category=2">Cronaca</a> | <a style="color:#2e91d4;margin:10px;" href="https://www./categorySummary.php?category=3">Sport</a> | <a style="color:#2e91d4;margin:10px;" href="https://www./categorySummary.php?category=4">Cultura&Spettacolo</a>
|
||||
</div>
|
||||
<div style="text-align:center;color:white;margin-top:25px;">TESTATA REGISTRATA PRESSO IL TRIBUNALE DI NAPOLI AUT. NR. 8 DEL 27 GENNAIO 2006</div>
|
||||
<div style="text-align:center;color:white;margin-top:20px;">COPYRIGHT ยฉ 2016 <a href="http://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>
|
||||
<div style="text-align:center;color:white;margin-top:20px;">COPYRIGHT ยฉ 2016 <a href="https://www.ifattidinapoli.it" style="color:white;">www.ifattidinapoli.it</a> - Giornale della Terza Metropoli Italiana</div>
|
||||
<div style="text-align:center;color:white;margin-top:20px;">
|
||||
<a href="http://www./redazione.php" style="color:white;">REDAZIONE</a> | <a href="http://www./archivio.php" style="color:white;">ARCHIVIO STORICO</a>
|
||||
<a href="https://www./redazione.php" style="color:white;">REDAZIONE</a> | <a href="https://www./archivio.php" style="color:white;">ARCHIVIO STORICO</a>
|
||||
</div>
|
||||
</div></div>';
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ try{
|
||||
<div class="bannerStat">
|
||||
<div>
|
||||
<div class="statName">Oggi</div>
|
||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today CET"));?></div>
|
||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today CET"));?></div>
|
||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today"));?></div>
|
||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today"));?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="statName">Ultima settimana</div>
|
||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days CET"));?></div>
|
||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days CET"));?></div>
|
||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days"));?></div>
|
||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days"));?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="statName">Totali</div>
|
||||
|
||||
@@ -144,11 +144,11 @@ try{
|
||||
<div class="notiziaStat">
|
||||
<div>
|
||||
<div class="statName">Oggi</div>
|
||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today CET"));?></div>
|
||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today"));?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="statName">Ultima settimana</div>
|
||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days CET"));?></div>
|
||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days"));?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="statName">Totali</div>
|
||||
|
||||
@@ -74,6 +74,8 @@ HTMLHelper::generateAdminHead();
|
||||
<li>Banner testata:<b>180x60px</b></li>
|
||||
<li>Banner corpo:<b>160x120px</b></li>
|
||||
<li>Banner lungo:<b>160x240px</b></li>
|
||||
<li>Banner Inizio pagina:<b>1000x150px</b></li>
|
||||
<li>Banner Fine pagina:<b>1000x200px</b></li>
|
||||
</ul>
|
||||
Tale restizione è consigliata anche per i banner di tipo <i>HTML5</i>.
|
||||
</p>
|
||||
|
||||
@@ -23,18 +23,6 @@ try{
|
||||
$newMedia = null;
|
||||
$mediaTypeSaved = PostHandler::get("mediaType");
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit = true;
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $newMedias = DaoMediaHandler::getMedias($banner);
|
||||
// if(sizeof($newMedias)>0){
|
||||
// $newMedia = reset($newMedias);
|
||||
// }
|
||||
// if($banner->hasProperty("type") && !is_null($banner->type)){
|
||||
// $mediaTypeSaved = $banner->type;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "save")==0){
|
||||
$mediaType = PostHandler::get("mediaType");
|
||||
if (!is_null($mediaType) && strcmp($mediaType, "")!=0){
|
||||
@@ -98,69 +86,7 @@ try{
|
||||
else {
|
||||
throw new GUIException("Selezionare il tipo di file multimediale da utilizzare");
|
||||
}
|
||||
|
||||
|
||||
// if(is_null($bannerId) || strcmp($bannerId, "")==0){
|
||||
// $banner->customer = PostHandler::get("customer");
|
||||
// $banner->type = PostHandler::get("mediaType");
|
||||
// $banner->start = new Mongodate(strtotime(PostHandler::get("dateStart")));
|
||||
// $banner->end = new Mongodate(strtotime(PostHandler::get("dateEnd")));
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// $bannerId = $banner->id;
|
||||
// }
|
||||
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $edit=true;
|
||||
// // $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $file = "";
|
||||
|
||||
// $mediaType = PostHandler::get("mediaType");
|
||||
// $banner->type=$mediaType;
|
||||
// if(strcmp($mediaType, "")!=0){
|
||||
// $tmp = array();
|
||||
// $saveable = new stdClass();
|
||||
// $saveable->mediaType = $mediaType;
|
||||
// if(strcmp($mediaType,MediaModel::TYPE_HTML5)==0){
|
||||
// $saveable->code = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewTextBasedMedia($saveable);
|
||||
// }
|
||||
// else if(strcmp($mediaType,MediaModel::TYPE_IMAGE)==0){
|
||||
// $file = $_FILES['data']['tmp_name'];
|
||||
// $info = pathinfo($_FILES['data']['name']);
|
||||
// // $file = PostHandler::get("data");
|
||||
// $media = DaoMediaHandler::createNewFileBasedMedia($saveable, $file,$info["extension"]);
|
||||
// }
|
||||
|
||||
// if(!is_null($media)){
|
||||
// GlobalVariables::get("dao")->save($media);
|
||||
// DaoMediaHandler::addMedia($banner, $media);
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Cannot save a null media in the news with id '".$bannerId."'");
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// throw new Exception("Invalid mediaType '".$mediaType."' while trying to add the media in editBanner");
|
||||
// }
|
||||
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
}
|
||||
// else if(array_key_exists("action", $_POST) && strcmp(PostHandler::get("action"), "delete")==0){
|
||||
// if(!is_null($bannerId) && strcmp($bannerId, "")!=0){
|
||||
// $banner = GlobalVariables::get("dao")->getFirst("BannerModel",array("id"=>$bannerId));
|
||||
// $medias = DaoMediaHandler::getMedias($banner);
|
||||
// // $media = reset($medias);
|
||||
// // $media = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$mediaId));
|
||||
// foreach ($medias as $media){
|
||||
// DaoMediaHandler::deleteMedia($banner, $media);
|
||||
// $banner->type = null;
|
||||
// GlobalVariables::get("dao")->save($banner);
|
||||
// }
|
||||
// }
|
||||
// GUIHandler::redirect("admin/listBanner.php");
|
||||
// }
|
||||
$formFile = '<input type="hidden" name="MAX_FILE_SIZE" value="52428800" />
|
||||
<span class="label">Seleziona file</span><input type="file" name="data" />';
|
||||
if($edit && !is_null($newMedia)){
|
||||
@@ -173,6 +99,7 @@ try{
|
||||
}catch(GUIException $ex){
|
||||
$error = $ex->getMessage();
|
||||
}catch (Exception $exec){
|
||||
var_dump($exec);
|
||||
LoggingFacilityManager::getLogger("gui")->log(LoggingFacility::$LEVEL_ERROR, $exec->getMessage());
|
||||
$error = "Si รจ verificato un errore inaspettato durante l'esecuzione della pagina. Se l'errore persiste contattare il supporto tecnico.";
|
||||
}
|
||||
@@ -196,6 +123,8 @@ try{
|
||||
<option value="<?php echo BannerModel::POSITION_HEAD;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_HEAD]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_BODY;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BODY]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_LONG;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_LONG]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_TOP;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_TOP]["label"];?></option>
|
||||
<option value="<?php echo BannerModel::POSITION_BOTTOM;?>"><?php echo BannerModel::$BANNER_POSITIONS[BannerModel::POSITION_BOTTOM]["label"];?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/*
|
||||
Author: Riccardo Di Dato
|
||||
Creation Date: 25/gen/2016
|
||||
*/
|
||||
|
||||
|
||||
require_once(dirname(__FILE__)."/../load.php");
|
||||
|
||||
GUIHandler::generateHtmlHeaders(array(),true);
|
||||
|
||||
if (!AdminLoginManager::isLogged()){
|
||||
GUIHandler::redirect("admin/login.php");
|
||||
}
|
||||
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_NORMALADMIN)){
|
||||
GUIHandler::redirect("admin/index.php");
|
||||
}
|
||||
|
||||
MenuGenerator::generateMenu();
|
||||
|
||||
HTMLHelper::generateAdminHead();
|
||||
|
||||
$saved = false;
|
||||
$action = PostHandler::get("action");
|
||||
if (!is_null($action) && strcmp("", $action)!=0){
|
||||
if (strcmp("save", $action)==0){
|
||||
|
||||
if (PostHandler::get(SimpleConfig::VARIE_LABEL)) {
|
||||
GlobalVariables::get("cfg")->setValue(SimpleConfig::VARIE_LABEL, PostHandler::get(SimpleConfig::VARIE_LABEL));
|
||||
}
|
||||
|
||||
$saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
if ($saved){
|
||||
echo '<div style="color:green;">Dati salvati con successo</div>';
|
||||
}
|
||||
?>
|
||||
<form id="taskForm" method="POST" action="">
|
||||
<input type="hidden" name="action" value="" />
|
||||
<div><span class="label"> </span><b>Tasks</b></div>
|
||||
<?php
|
||||
printf(
|
||||
'<div><span class="label">Varie (home)</span><input type="text" name="%s" value="%s" /><br/>',
|
||||
SimpleConfig::VARIE_LABEL,
|
||||
GlobalVariables::get("cfg")->hasValue(SimpleConfig::VARIE_LABEL) ? GlobalVariables::get("cfg")->getValue(SimpleConfig::VARIE_LABEL) : ""
|
||||
)
|
||||
?>
|
||||
</form>
|
||||
<div class="formBtns">
|
||||
<a href="#" id="taskForm_salva" >Salva</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(event){
|
||||
$("#taskForm_salva").click(function(event){
|
||||
$("form#taskForm input[type=hidden][name=action]").val("save");
|
||||
$("form#taskForm").submit();
|
||||
});
|
||||
$("#taskForm_annulla").click(function(event){
|
||||
$("form#taskForm input[type=hidden][name=action]").val("cancel");
|
||||